ext/mpeg2dec/gstmpeg2dec.c: Never post a (fatal) error message on the bus on decoding...
authorZaheer Abbas Merali <zaheermerali@gmail.com>
Fri, 2 Mar 2007 13:01:48 +0000 (13:01 +0000)
committerTim-Philipp Müller <tim@centricular.net>
Fri, 2 Mar 2007 13:01:48 +0000 (13:01 +0000)
Original commit message from CVS:
Patch by: Zaheer Abbas Merali  <zaheermerali at gmail com>
* ext/mpeg2dec/gstmpeg2dec.c: (gst_mpeg2dec_chain):
Never post a (fatal) error message on the bus on decoding errors. We
should only do this if we can't recover, but mpeg2dec can always
recover. This is needed for DVB streams, for example, where there
may be temporary glitches in the stream. Instead of an error
message, post a warning message on the bus for every N decoding
errors. Fixes #370020.

ChangeLog
common
ext/mpeg2dec/gstmpeg2dec.c

index b7bc853701767b604a2dc523bfecd98089fb5818..8768e8573f523085841fda013fde6b8913773734 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2007-03-02  Tim-Philipp Müller  <tim at centricular dot net>
+
+       Patch by: Zaheer Abbas Merali  <zaheermerali at gmail com>
+
+       * ext/mpeg2dec/gstmpeg2dec.c: (gst_mpeg2dec_chain):
+         Never post a (fatal) error message on the bus on decoding errors. We
+         should only do this if we can't recover, but mpeg2dec can always
+         recover. This is needed for DVB streams, for example, where there
+         may be temporary glitches in the stream. Instead of an error
+         message, post a warning message on the bus for every N decoding
+         errors. Fixes #370020.
+
 2007-02-28  Thomas Vander Stichele  <thomas at apestaart dot org>
 
        * configure.ac:
diff --git a/common b/common
index 54c2a701c28dcddaf051abf09a360223acd096c9..9a56e28fc15440eb6852411321c46312e1d1bb73 160000 (submodule)
--- a/common
+++ b/common
@@ -1 +1 @@
-Subproject commit 54c2a701c28dcddaf051abf09a360223acd096c9
+Subproject commit 9a56e28fc15440eb6852411321c46312e1d1bb73
index 6df23a7447f565bea8e61f94c351b969643c3982..c8437c630b4df9755a9595b918d273c9e264ed28 100644 (file)
@@ -52,10 +52,10 @@ GST_ELEMENT_DETAILS ("mpeg1 and mpeg2 video decoder",
     "Uses libmpeg2 to decode MPEG video streams",
     "Wim Taymans <wim.taymans@chello.be>");
 
-/* error out after receiving MAX_ERROR_COUNT STATE_INVALID return value
- * from mpeg2_parse. -1 means never error out
+/* Send a warning message about decoding errors after receiving this many
+ * STATE_INVALID return values from mpeg2_parse. -1 means never.
  */
-#define MAX_ERROR_COUNT (5)
+#define WARN_THRESHOLD (5)
 
 #ifdef enable_user_data
 static GstStaticPadTemplate user_data_template_factory =
@@ -1020,12 +1020,15 @@ gst_mpeg2dec_chain (GstPad * pad, GstBuffer * buf)
         break;
         /* error */
       case STATE_INVALID:
+        /* FIXME: at some point we should probably send newsegment events to
+         * let downstream know that parts of the stream are missing */
         mpeg2dec->error_count++;
         GST_WARNING_OBJECT (mpeg2dec, "Decoding error #%d",
             mpeg2dec->error_count);
-        if (mpeg2dec->error_count >= MAX_ERROR_COUNT && MAX_ERROR_COUNT > 0) {
-          GST_WARNING_OBJECT (mpeg2dec, "Too many decoding errors");
-          goto exit_error;
+        if (mpeg2dec->error_count >= WARN_THRESHOLD && WARN_THRESHOLD > 0) {
+          GST_ELEMENT_WARNING (mpeg2dec, STREAM, DECODE,
+              ("%d consecutive decoding errors", mpeg2dec->error_count),
+              (NULL));
         }
         goto exit;
       default:
@@ -1064,12 +1067,6 @@ exit:
     ret = GST_FLOW_OK;
     goto done;
   }
-exit_error:
-  {
-    GST_ELEMENT_ERROR (mpeg2dec, STREAM, DECODE, (NULL), (NULL));
-    ret = GST_FLOW_ERROR;
-    goto done;
-  }
 }
 
 static gboolean