mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-23 15:48:23 +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) {
|
if (xing_flags & XING_TOC_FLAG) {
|
||||||
int i, percent = 0;
|
int i, percent = 0;
|
||||||
guchar *table = mp3parse->xing_seek_table;
|
guchar *table = mp3parse->xing_seek_table;
|
||||||
guchar old = 0;
|
guchar old = 0, new;
|
||||||
|
guint first;
|
||||||
|
|
||||||
if (data[0] != 0) {
|
first = data[0];
|
||||||
GST_WARNING_OBJECT (mp3parse, "Skipping broken Xing TOC");
|
GST_DEBUG_OBJECT (mp3parse,
|
||||||
mp3parse->xing_flags &= ~XING_TOC_FLAG;
|
"Subtracting initial offset of %d bytes from Xing TOC", first);
|
||||||
goto skip_toc;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* xing seek table: percent time -> 1/256 bytepos */
|
/* xing seek table: percent time -> 1/256 bytepos */
|
||||||
for (i = 0; i < 100; i++) {
|
for (i = 0; i < 100; i++) {
|
||||||
mp3parse->xing_seek_table[i] = data[i];
|
new = data[i] - first;
|
||||||
if (old > data[i]) {
|
if (old > new) {
|
||||||
GST_WARNING_OBJECT (mp3parse, "Skipping broken Xing TOC");
|
GST_WARNING_OBJECT (mp3parse, "Skipping broken Xing TOC");
|
||||||
mp3parse->xing_flags &= ~XING_TOC_FLAG;
|
mp3parse->xing_flags &= ~XING_TOC_FLAG;
|
||||||
goto skip_toc;
|
goto skip_toc;
|
||||||
}
|
}
|
||||||
|
mp3parse->xing_seek_table[i] = old = new;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* build inverse table: 1/256 bytepos -> 1/100 percent time */
|
/* build inverse table: 1/256 bytepos -> 1/100 percent time */
|
||||||
|
|
Loading…
Reference in a new issue