Try to recover from decoding errors, use a hack(?) to make libmpeg2 not crash.

Original commit message from CVS:
Try to recover from decoding errors, use a hack(?) to make libmpeg2 not
crash.
This commit is contained in:
Wim Taymans 2003-04-13 15:01:27 +00:00
parent 9dfada637e
commit 4bd919792f
2 changed files with 9 additions and 4 deletions

2
common

@ -1 +1 @@
Subproject commit 50879a63c4fa8f2544d4d89a9dbfa0f5720c3266 Subproject commit 0ce4bbf0bc51c08694a8a1e0bec7624094b043d6

View file

@ -464,13 +464,16 @@ gst_mpeg2dec_chain (GstPad *pad, GstBuffer *buf)
GST_DEBUG (GST_CAT_CLOCK, "no pts"); GST_DEBUG (GST_CAT_CLOCK, "no pts");
} }
GST_DEBUG (0, "calling _buffer");
mpeg2_buffer (mpeg2dec->decoder, data, end); mpeg2_buffer (mpeg2dec->decoder, data, end);
GST_DEBUG (0, "calling _buffer done");
while (!done) { while (!done) {
gboolean slice = FALSE; gboolean slice = FALSE;
GST_DEBUG (0, "calling parse");
state = mpeg2_parse (mpeg2dec->decoder); state = mpeg2_parse (mpeg2dec->decoder);
GST_DEBUG (0, "state %d", state); GST_DEBUG (0, "parse state %d", state);
switch (state) { switch (state) {
case STATE_SEQUENCE: case STATE_SEQUENCE:
{ {
@ -623,8 +626,10 @@ gst_mpeg2dec_chain (GstPad *pad, GstBuffer *buf)
break; break;
/* error */ /* error */
case STATE_INVALID: case STATE_INVALID:
gst_element_error (GST_ELEMENT (mpeg2dec), "decoding error"); g_warning ("mpeg2dec: decoding error");
done = TRUE; /* it looks like setting a new frame in libmpeg2 avoids a crash */
/* FIXME figure out how this screws up sync and buffer leakage */
gst_mpeg2dec_alloc_buffer (mpeg2dec, info, GST_BUFFER_OFFSET (buf));
break; break;
default: default:
g_warning ("%s: unhandled state %d, FIXME", g_warning ("%s: unhandled state %d, FIXME",