From 4bd919792f7358fc9e2adcc5d801e5a5d3fa24e1 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Sun, 13 Apr 2003 15:01:27 +0000 Subject: [PATCH] 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. --- common | 2 +- ext/mpeg2dec/gstmpeg2dec.c | 11 ++++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/common b/common index 50879a63c4..0ce4bbf0bc 160000 --- a/common +++ b/common @@ -1 +1 @@ -Subproject commit 50879a63c4fa8f2544d4d89a9dbfa0f5720c3266 +Subproject commit 0ce4bbf0bc51c08694a8a1e0bec7624094b043d6 diff --git a/ext/mpeg2dec/gstmpeg2dec.c b/ext/mpeg2dec/gstmpeg2dec.c index 50c77790bd..7262da804d 100644 --- a/ext/mpeg2dec/gstmpeg2dec.c +++ b/ext/mpeg2dec/gstmpeg2dec.c @@ -464,13 +464,16 @@ gst_mpeg2dec_chain (GstPad *pad, GstBuffer *buf) GST_DEBUG (GST_CAT_CLOCK, "no pts"); } + GST_DEBUG (0, "calling _buffer"); mpeg2_buffer (mpeg2dec->decoder, data, end); + GST_DEBUG (0, "calling _buffer done"); while (!done) { gboolean slice = FALSE; + GST_DEBUG (0, "calling parse"); state = mpeg2_parse (mpeg2dec->decoder); - GST_DEBUG (0, "state %d", state); + GST_DEBUG (0, "parse state %d", state); switch (state) { case STATE_SEQUENCE: { @@ -623,8 +626,10 @@ gst_mpeg2dec_chain (GstPad *pad, GstBuffer *buf) break; /* error */ case STATE_INVALID: - gst_element_error (GST_ELEMENT (mpeg2dec), "decoding error"); - done = TRUE; + g_warning ("mpeg2dec: decoding error"); + /* 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; default: g_warning ("%s: unhandled state %d, FIXME",