From df0d0d6ba23b91844425ba982da4dfc6c671226b Mon Sep 17 00:00:00 2001 From: Benjamin Otte Date: Sun, 10 Feb 2002 14:13:41 +0000 Subject: [PATCH] bugfix: make mad decode the whole stream Original commit message from CVS: bugfix: make mad decode the whole stream --- common | 2 +- ext/mad/gstmad.c | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/common b/common index c2d7711457..42efc7fe3e 160000 --- a/common +++ b/common @@ -1 +1 @@ -Subproject commit c2d7711457d468d527890f2057883c133b50c3b7 +Subproject commit 42efc7fe3eda3ea184fa620f2e0dbc4977f16c26 diff --git a/ext/mad/gstmad.c b/ext/mad/gstmad.c index d75c6f2b22..f8c0421055 100644 --- a/ext/mad/gstmad.c +++ b/ext/mad/gstmad.c @@ -366,8 +366,8 @@ gst_mad_chain (GstPad *pad, GstBuffer *buffer) mad_input_buffer = mad->tempbuffer; - /* it we have enough data we can proceed */ - while (mad->tempsize >= MAD_BUFFER_MDLEN) { + /* if we have data we can try to proceed */ + while (mad->tempsize >= 0) { gint consumed; guint nchannels, nsamples; mad_fixed_t const *left_ch, *right_ch; @@ -377,6 +377,10 @@ gst_mad_chain (GstPad *pad, GstBuffer *buffer) mad_stream_buffer (&mad->stream, mad_input_buffer, mad->tempsize); if (mad_frame_decode (&mad->frame, &mad->stream) == -1) { + /* not enough data, need to wait for next buffer? */ + if (mad->stream.error == MAD_ERROR_BUFLEN) { + break; + } if (!MAD_RECOVERABLE (mad->stream.error)) { gst_element_error (GST_ELEMENT (mad), "fatal error decoding stream"); return;