mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-09 19:09:41 +00:00
mp3parse: Don't reject valid Xing tables of contents
Some Xing headers apparently start the TOC at byte 1 instead of 0. Don't reject them because of it, just subtract the initial offset when reading the table.
This commit is contained in:
parent
85a88a0a64
commit
b18371c1ca
1 changed files with 8 additions and 8 deletions
|
@ -978,22 +978,22 @@ gst_mp3parse_handle_first_frame (GstMPEGAudioParse * mp3parse)
|
|||
if (xing_flags & XING_TOC_FLAG) {
|
||||
int i, percent = 0;
|
||||
guchar *table = mp3parse->xing_seek_table;
|
||||
guchar old = 0;
|
||||
guchar old = 0, new;
|
||||
guint first;
|
||||
|
||||
if (data[0] != 0) {
|
||||
GST_WARNING_OBJECT (mp3parse, "Skipping broken Xing TOC");
|
||||
mp3parse->xing_flags &= ~XING_TOC_FLAG;
|
||||
goto skip_toc;
|
||||
}
|
||||
first = data[0];
|
||||
GST_DEBUG_OBJECT (mp3parse,
|
||||
"Subtracting initial offset of %d bytes from Xing TOC", first);
|
||||
|
||||
/* xing seek table: percent time -> 1/256 bytepos */
|
||||
for (i = 0; i < 100; i++) {
|
||||
mp3parse->xing_seek_table[i] = data[i];
|
||||
if (old > data[i]) {
|
||||
new = data[i] - first;
|
||||
if (old > new) {
|
||||
GST_WARNING_OBJECT (mp3parse, "Skipping broken Xing TOC");
|
||||
mp3parse->xing_flags &= ~XING_TOC_FLAG;
|
||||
goto skip_toc;
|
||||
}
|
||||
mp3parse->xing_seek_table[i] = old = new;
|
||||
}
|
||||
|
||||
/* build inverse table: 1/256 bytepos -> 1/100 percent time */
|
||||
|
|
Loading…
Reference in a new issue