mp3parse: fix accurate seeks to near 0

Integer underflow made accurate seeks to near zero fail and seek to
completely the wrong place. Fix by clamping to zero, since we can't seek
to negative times anyway.
This commit is contained in:
Michael Smith 2009-02-25 13:34:05 -08:00
parent ca2990b67c
commit d61498d842

View file

@ -1794,12 +1794,14 @@ mp3parse_handle_seek (GstMPEGAudioParse * mp3parse, GstEvent * event)
MPEGAudioSeekEntry *entry = NULL, *start_entry = NULL, *stop_entry = NULL; MPEGAudioSeekEntry *entry = NULL, *start_entry = NULL, *stop_entry = NULL;
GList *start_node, *stop_node; GList *start_node, *stop_node;
gint64 seek_ts = (cur > mp3parse->max_bitreservoir) ?
(cur - mp3parse->max_bitreservoir) : 0;
for (start_node = mp3parse->seek_table; start_node; for (start_node = mp3parse->seek_table; start_node;
start_node = start_node->next) { start_node = start_node->next) {
entry = start_node->data; entry = start_node->data;
if (cur - mp3parse->max_bitreservoir >= entry->timestamp) { if (seek_ts >= entry->timestamp) {
start_entry = entry; start_entry = entry;
break; break;
} }