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  <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.
This commit is contained in:
Zaheer Abbas Merali 2007-03-02 13:01:48 +00:00 committed by Tim-Philipp Müller
parent baff39b9d9
commit 4fd7bf7a94
3 changed files with 22 additions and 13 deletions

View file

@ -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:

2
common

@ -1 +1 @@
Subproject commit 54c2a701c28dcddaf051abf09a360223acd096c9
Subproject commit 9a56e28fc15440eb6852411321c46312e1d1bb73

View 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