From 4fd7bf7a9473e0d7f3809af1f247babbb19c571a Mon Sep 17 00:00:00 2001 From: Zaheer Abbas Merali Date: Fri, 2 Mar 2007 13:01:48 +0000 Subject: [PATCH] ext/mpeg2dec/gstmpeg2dec.c: Never post a (fatal) error message on the bus on decoding errors. We should only do this ... Original commit message from CVS: Patch by: Zaheer Abbas Merali * 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 | 12 ++++++++++++ common | 2 +- ext/mpeg2dec/gstmpeg2dec.c | 21 +++++++++------------ 3 files changed, 22 insertions(+), 13 deletions(-) diff --git a/ChangeLog b/ChangeLog index b7bc853701..8768e8573f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2007-03-02 Tim-Philipp Müller + + Patch by: Zaheer Abbas Merali + + * 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 * configure.ac: diff --git a/common b/common index 54c2a701c2..9a56e28fc1 160000 --- a/common +++ b/common @@ -1 +1 @@ -Subproject commit 54c2a701c28dcddaf051abf09a360223acd096c9 +Subproject commit 9a56e28fc15440eb6852411321c46312e1d1bb73 diff --git a/ext/mpeg2dec/gstmpeg2dec.c b/ext/mpeg2dec/gstmpeg2dec.c index 6df23a7447..c8437c630b 100644 --- a/ext/mpeg2dec/gstmpeg2dec.c +++ b/ext/mpeg2dec/gstmpeg2dec.c @@ -52,10 +52,10 @@ GST_ELEMENT_DETAILS ("mpeg1 and mpeg2 video decoder", "Uses libmpeg2 to decode MPEG video streams", "Wim Taymans "); -/* 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