+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),
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
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);
/* 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 {
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;
static gboolean
mp3parse_bytepos_to_time (GstMPEGAudioParse * mp3parse,
- gint64 bytepos, GstClockTime * ts)
+ gint64 bytepos, GstClockTime * ts, gboolean from_total_time)
{
gint64 total_bytes;
}
/* 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;
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;