diff options
author | Young-Ho Cha <ganadist@chollian.net> | 2006-05-13 18:39:13 +0000 |
---|---|---|
committer | Tim-Philipp Müller <tim@centricular.net> | 2006-05-13 18:39:13 +0000 |
commit | 15bae29658142bb724a3b4b0d9f68d1dccdbaf53 (patch) | |
tree | 10a6aadcd0cc042066ecdc2eff930aa2a4df95f9 | |
parent | 3ca1e62f030ce440af47a35f6c68ef7cfa267076 (diff) | |
download | gst-plugins-bad-15bae29658142bb724a3b4b0d9f68d1dccdbaf53.tar.gz gst-plugins-bad-15bae29658142bb724a3b4b0d9f68d1dccdbaf53.tar.bz2 gst-plugins-bad-15bae29658142bb724a3b4b0d9f68d1dccdbaf53.zip |
ext/faad/gstfaad.*: If we encounter a decoding error, don't error out immediately, but try to resync (or see if we ha...
Original commit message from CVS:
Patch by: Young-Ho Cha <ganadist chollian net>
* ext/faad/gstfaad.c: (gst_faad_init), (gst_faad_chain),
(gst_faad_change_state):
* ext/faad/gstfaad.h:
If we encounter a decoding error, don't error out immediately,
but try to resync (or see if we have better luck with the next
buffer in case of framed input). Only error out after five
consecutive errors. Fixes #341563.
-rw-r--r-- | ChangeLog | 12 | ||||
-rw-r--r-- | ext/faad/gstfaad.c | 17 | ||||
-rw-r--r-- | ext/faad/gstfaad.h | 1 |
3 files changed, 28 insertions, 2 deletions
@@ -1,3 +1,15 @@ +2006-05-13 Tim-Philipp Müller <tim at centricular dot net> + + Patch by: Young-Ho Cha <ganadist chollian net> + + * ext/faad/gstfaad.c: (gst_faad_init), (gst_faad_chain), + (gst_faad_change_state): + * ext/faad/gstfaad.h: + If we encounter a decoding error, don't error out immediately, + but try to resync (or see if we have better luck with the next + buffer in case of framed input). Only error out after five + consecutive errors. Fixes #341563. + 2006-05-12 Wim Taymans <wim@fluendo.com> * ext/xvid/gstxvidenc.c: (gst_xvidenc_class_init), diff --git a/ext/faad/gstfaad.c b/ext/faad/gstfaad.c index 2c745d0e..76d4a73c 100644 --- a/ext/faad/gstfaad.c +++ b/ext/faad/gstfaad.c @@ -51,6 +51,8 @@ extern int8_t faacDecInit2 (faacDecHandle, guint8 *, guint32, GST_DEBUG_CATEGORY_STATIC (faad_debug); #define GST_CAT_DEFAULT faad_debug +#define MAX_DECODE_ERRORS 5 + static const GstElementDetails faad_details = GST_ELEMENT_DETAILS ("AAC audio decoder", "Codec/Decoder/Audio", @@ -192,6 +194,7 @@ gst_faad_init (GstFaad * faad) faad->bytes_in = 0; faad->sum_dur_out = 0; faad->packetised = FALSE; + faad->error_count = 0; faad->sinkpad = gst_pad_new_from_static_template (&sink_template, "sink"); gst_element_add_pad (GST_ELEMENT (faad), faad->sinkpad); @@ -1208,8 +1211,17 @@ gst_faad_chain (GstPad * pad, GstBuffer * buffer) out = faacDecDecode (faad->handle, &info, input_data + skip_bytes, input_size - skip_bytes); - if (info.error) - goto decode_error; + if (info.error) { + faad->error_count++; + if (faad->error_count >= MAX_DECODE_ERRORS) + goto decode_error; + GST_DEBUG_OBJECT (faad, + "Failed to decode buffer: %s, count = %d, trying to resync", + faacDecGetErrorMessage (info.error), faad->error_count); + continue; + } + + faad->error_count = 0; /* all fine, reset error counter */ } if (info.bytesconsumed > input_size) @@ -1387,6 +1399,7 @@ gst_faad_change_state (GstElement * element, GstStateChange transition) faad->prev_ts = GST_CLOCK_TIME_NONE; faad->bytes_in = 0; faad->sum_dur_out = 0; + faad->error_count = 0; break; case GST_STATE_CHANGE_READY_TO_NULL: gst_faad_close_decoder (faad); diff --git a/ext/faad/gstfaad.h b/ext/faad/gstfaad.h index 160b8ba4..2650223f 100644 --- a/ext/faad/gstfaad.h +++ b/ext/faad/gstfaad.h @@ -63,6 +63,7 @@ typedef struct _GstFaad { gint64 next_ts; /* timestamp of next buffer */ guint64 bytes_in; /* bytes received */ guint64 sum_dur_out; /* sum of durations of decoded buffers we sent out */ + gint error_count; } GstFaad; typedef struct _GstFaadClass { |