From a32b513bfc91e78e063678005890e6f8f75b0df1 Mon Sep 17 00:00:00 2001 From: "Ronald S. Bultje" Date: Tue, 18 May 2004 00:25:09 +0000 Subject: [PATCH] ext/mad/gstmad.c: Fix for when the first format in a discont event is not a byte-based one. Should fix #137710. Original commit message from CVS: * ext/mad/gstmad.c: (gst_mad_handle_event): Fix for when the first format in a discont event is not a byte-based one. Should fix #137710. --- ChangeLog | 6 ++++++ ext/mad/gstmad.c | 27 ++++++++++++++++++--------- 2 files changed, 24 insertions(+), 9 deletions(-) diff --git a/ChangeLog b/ChangeLog index 405b9e1a7c..d8706573f3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2004-05-17 Ronald Bultje + + * ext/mad/gstmad.c: (gst_mad_handle_event): + Fix for when the first format in a discont event is not a + byte-based one. Should fix #137710. + 2004-05-18 Stephane Loeuillet * m4/a52.m4 : fix compilation with -Wall -Werror diff --git a/ext/mad/gstmad.c b/ext/mad/gstmad.c index 8fca237630..3efd839d1b 100644 --- a/ext/mad/gstmad.c +++ b/ext/mad/gstmad.c @@ -908,19 +908,25 @@ gst_mad_handle_event (GstPad * pad, GstBuffer * buffer) GstEvent *discont; /* see how long the input bytes take */ - format = GST_FORMAT_TIME; - if (!gst_pad_convert (pad, - GST_EVENT_DISCONT_OFFSET (event, i).format, - value, &format, &time)) { - time = 0; + if (GST_EVENT_DISCONT_OFFSET (event, i).format != GST_FORMAT_TIME) { + format = GST_FORMAT_TIME; + if (!gst_pad_convert (pad, + GST_EVENT_DISCONT_OFFSET (event, i).format, + value, &format, &time)) { + continue; + } + } else { + time = value; } /* for now, this is the best we can do to get the total number - * of samples */ + * of samples. This is suboptimal because the incoming event + * might contain this information already (although I believe + * that this doesn't happen anywhere so far). */ format = GST_FORMAT_DEFAULT; if (!gst_pad_convert (mad->srcpad, GST_FORMAT_TIME, time, &format, &mad->total_samples)) { - mad->total_samples = 0; + continue; } if (GST_PAD_IS_USABLE (mad->srcpad)) { @@ -928,9 +934,13 @@ gst_mad_handle_event (GstPad * pad, GstBuffer * buffer) time, NULL); gst_pad_push (mad->srcpad, GST_DATA (discont)); } - break; + goto done; } } + GST_WARNING ("Failed to retrieve sample position"); + /* this isn't really correct? */ + gst_pad_event_default (pad, event); + done: mad->tempsize = 0; /* we don't need to restart when we get here */ mad->restart = FALSE; @@ -945,7 +955,6 @@ gst_mad_handle_event (GstPad * pad, GstBuffer * buffer) gst_pad_event_default (pad, event); break; } - return; } static gboolean