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.
This commit is contained in:
Ronald S. Bultje 2004-05-18 00:25:09 +00:00
parent a6e29991bf
commit a32b513bfc
2 changed files with 24 additions and 9 deletions

View File

@ -1,3 +1,9 @@
2004-05-17 Ronald Bultje <rbultje@ronald.bitfreak.net>
* 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 <stephane.loeuillet@tiscali.fr> 2004-05-18 Stephane Loeuillet <stephane.loeuillet@tiscali.fr>
* m4/a52.m4 : fix compilation with -Wall -Werror * m4/a52.m4 : fix compilation with -Wall -Werror

View File

@ -908,19 +908,25 @@ gst_mad_handle_event (GstPad * pad, GstBuffer * buffer)
GstEvent *discont; GstEvent *discont;
/* see how long the input bytes take */ /* see how long the input bytes take */
format = GST_FORMAT_TIME; if (GST_EVENT_DISCONT_OFFSET (event, i).format != GST_FORMAT_TIME) {
if (!gst_pad_convert (pad, format = GST_FORMAT_TIME;
GST_EVENT_DISCONT_OFFSET (event, i).format, if (!gst_pad_convert (pad,
value, &format, &time)) { GST_EVENT_DISCONT_OFFSET (event, i).format,
time = 0; value, &format, &time)) {
continue;
}
} else {
time = value;
} }
/* for now, this is the best we can do to get the total number /* 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; format = GST_FORMAT_DEFAULT;
if (!gst_pad_convert (mad->srcpad, if (!gst_pad_convert (mad->srcpad,
GST_FORMAT_TIME, time, &format, &mad->total_samples)) { GST_FORMAT_TIME, time, &format, &mad->total_samples)) {
mad->total_samples = 0; continue;
} }
if (GST_PAD_IS_USABLE (mad->srcpad)) { if (GST_PAD_IS_USABLE (mad->srcpad)) {
@ -928,9 +934,13 @@ gst_mad_handle_event (GstPad * pad, GstBuffer * buffer)
time, NULL); time, NULL);
gst_pad_push (mad->srcpad, GST_DATA (discont)); 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; mad->tempsize = 0;
/* we don't need to restart when we get here */ /* we don't need to restart when we get here */
mad->restart = FALSE; mad->restart = FALSE;
@ -945,7 +955,6 @@ gst_mad_handle_event (GstPad * pad, GstBuffer * buffer)
gst_pad_event_default (pad, event); gst_pad_event_default (pad, event);
break; break;
} }
return;
} }
static gboolean static gboolean