mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-19 16:21:17 +00:00
gst/mpegaudioparse/gstmpegaudioparse.c: Don't recurse from mp3parse_bytepos_to_time() to mp3parse_total_time() if we'...
Original commit message from CVS: * gst/mpegaudioparse/gstmpegaudioparse.c: (gst_mp3parse_sink_event), (gst_mp3parse_emit_frame), (mp3parse_total_time), (mp3parse_bytepos_to_time): Don't recurse from mp3parse_bytepos_to_time() to mp3parse_total_time() if we're called from there already. Otherwise we end up in a endless recursion and crash with a stack overflow. This can happen when a Xing or VBRI header with TOC exists but it doesn't contain the total time. Fixes bug #545370.
This commit is contained in:
parent
69b2bd42d9
commit
6d5dba30d2
2 changed files with 21 additions and 9 deletions
12
ChangeLog
12
ChangeLog
|
@ -1,3 +1,15 @@
|
|||
2008-07-31 Sebastian Dröge <sebastian.droege@collabora.co.uk>
|
||||
|
||||
* gst/mpegaudioparse/gstmpegaudioparse.c:
|
||||
(gst_mp3parse_sink_event), (gst_mp3parse_emit_frame),
|
||||
(mp3parse_total_time), (mp3parse_bytepos_to_time):
|
||||
Don't recurse from mp3parse_bytepos_to_time() to mp3parse_total_time()
|
||||
if we're called from there already. Otherwise we end up in a endless
|
||||
recursion and crash with a stack overflow.
|
||||
|
||||
This can happen when a Xing or VBRI header with TOC exists but it
|
||||
doesn't contain the total time. Fixes bug #545370.
|
||||
|
||||
2008-07-31 Sebastian Dröge <sebastian.droege@collabora.co.uk>
|
||||
|
||||
* ext/lame/gstlame.c: (gst_lame_class_init),
|
||||
|
|
|
@ -128,7 +128,7 @@ static GstStateChangeReturn gst_mp3parse_change_state (GstElement * element,
|
|||
GstStateChange transition);
|
||||
|
||||
static gboolean mp3parse_bytepos_to_time (GstMPEGAudioParse * mp3parse,
|
||||
gint64 bytepos, GstClockTime * ts);
|
||||
gint64 bytepos, GstClockTime * ts, gboolean from_total_time);
|
||||
static gboolean
|
||||
mp3parse_total_bytes (GstMPEGAudioParse * mp3parse, gint64 * total);
|
||||
static gboolean
|
||||
|
@ -525,10 +525,10 @@ gst_mp3parse_sink_event (GstPad * pad, GstEvent * event)
|
|||
GstClockTime seg_start, seg_stop, seg_pos;
|
||||
|
||||
/* stop time is allowed to be open-ended, but not start & pos */
|
||||
if (!mp3parse_bytepos_to_time (mp3parse, stop, &seg_stop))
|
||||
if (!mp3parse_bytepos_to_time (mp3parse, stop, &seg_stop, FALSE))
|
||||
seg_stop = GST_CLOCK_TIME_NONE;
|
||||
if (mp3parse_bytepos_to_time (mp3parse, start, &seg_start) &&
|
||||
mp3parse_bytepos_to_time (mp3parse, pos, &seg_pos)) {
|
||||
if (mp3parse_bytepos_to_time (mp3parse, start, &seg_start, FALSE) &&
|
||||
mp3parse_bytepos_to_time (mp3parse, pos, &seg_pos, FALSE)) {
|
||||
gst_event_unref (event);
|
||||
event = gst_event_new_new_segment_full (update, rate, applied_rate,
|
||||
GST_FORMAT_TIME, seg_start, seg_stop, seg_pos);
|
||||
|
@ -667,7 +667,7 @@ gst_mp3parse_emit_frame (GstMPEGAudioParse * mp3parse, guint size,
|
|||
|
||||
/* No timestamp yet, convert our offset to a timestamp if we can, or
|
||||
* start at 0 */
|
||||
if (mp3parse_bytepos_to_time (mp3parse, mp3parse->cur_offset, &ts) &&
|
||||
if (mp3parse_bytepos_to_time (mp3parse, mp3parse->cur_offset, &ts, FALSE) &&
|
||||
GST_CLOCK_TIME_IS_VALID (ts))
|
||||
GST_BUFFER_TIMESTAMP (outbuf) = ts;
|
||||
else {
|
||||
|
@ -1550,7 +1550,7 @@ mp3parse_total_time (GstMPEGAudioParse * mp3parse, GstClockTime * total)
|
|||
return FALSE;
|
||||
|
||||
if (total_bytes != -1
|
||||
&& !mp3parse_bytepos_to_time (mp3parse, total_bytes, total))
|
||||
&& !mp3parse_bytepos_to_time (mp3parse, total_bytes, total, TRUE))
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
|
@ -1640,7 +1640,7 @@ no_bitrate:
|
|||
|
||||
static gboolean
|
||||
mp3parse_bytepos_to_time (GstMPEGAudioParse * mp3parse,
|
||||
gint64 bytepos, GstClockTime * ts)
|
||||
gint64 bytepos, GstClockTime * ts, gboolean from_total_time)
|
||||
{
|
||||
gint64 total_bytes;
|
||||
|
||||
|
@ -1657,7 +1657,7 @@ mp3parse_bytepos_to_time (GstMPEGAudioParse * mp3parse,
|
|||
}
|
||||
|
||||
/* If XING seek table exists use this for byte->time conversion */
|
||||
if ((mp3parse->xing_flags & XING_TOC_FLAG) &&
|
||||
if (!from_total_time && (mp3parse->xing_flags & XING_TOC_FLAG) &&
|
||||
mp3parse_total_bytes (mp3parse, &total_bytes) &&
|
||||
mp3parse_total_time (mp3parse, &total_time)) {
|
||||
gdouble fa, fb, fx;
|
||||
|
@ -1679,7 +1679,7 @@ mp3parse_bytepos_to_time (GstMPEGAudioParse * mp3parse,
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
if (mp3parse->vbri_seek_table &&
|
||||
if (!from_total_time && mp3parse->vbri_seek_table &&
|
||||
mp3parse_total_bytes (mp3parse, &total_bytes) &&
|
||||
mp3parse_total_time (mp3parse, &total_time)) {
|
||||
gint i = 0;
|
||||
|
|
Loading…
Reference in a new issue