Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
F
ffmpeg.wasm-core
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Linshizhi
ffmpeg.wasm-core
Commits
ef21b3d3
Commit
ef21b3d3
authored
Jul 24, 2014
by
Carl Eugen Hoyos
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Ignore xing number of frames if the file is larger than indicated.
Fixes ticket #3777.
parent
badcd3da
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
1 deletion
+16
-1
mp3dec.c
libavformat/mp3dec.c
+16
-1
No files found.
libavformat/mp3dec.c
View file @
ef21b3d3
...
...
@@ -138,6 +138,7 @@ static void mp3_parse_info_tag(AVFormatContext *s, AVStream *st,
MP3DecContext
*
mp3
=
s
->
priv_data
;
static
const
int64_t
xing_offtbl
[
2
][
2
]
=
{{
32
,
17
},
{
17
,
9
}};
uint64_t
fsize
=
avio_size
(
s
->
pb
);
/* Check for Xing / Info tag */
avio_skip
(
s
->
pb
,
xing_offtbl
[
c
->
lsf
==
1
][
c
->
nb_channels
==
1
]);
...
...
@@ -151,6 +152,17 @@ static void mp3_parse_info_tag(AVFormatContext *s, AVStream *st,
mp3
->
frames
=
avio_rb32
(
s
->
pb
);
if
(
v
&
XING_FLAG_SIZE
)
mp3
->
header_filesize
=
avio_rb32
(
s
->
pb
);
if
(
fsize
&&
mp3
->
header_filesize
)
{
uint64_t
min
,
delta
;
min
=
FFMIN
(
fsize
,
mp3
->
header_filesize
);
delta
=
FFMAX
(
fsize
,
mp3
->
header_filesize
)
-
min
;
if
(
fsize
>
mp3
->
header_filesize
&&
delta
>
min
>>
4
)
{
mp3
->
frames
=
0
;
}
else
if
(
delta
>
min
>>
4
)
{
av_log
(
s
,
AV_LOG_WARNING
,
"filesize and duration do not match (growing file?)
\n
"
);
}
}
if
(
v
&
XING_FLAG_TOC
)
read_xing_toc
(
s
,
mp3
->
header_filesize
,
av_rescale_q
(
mp3
->
frames
,
(
AVRational
){
spf
,
c
->
sample_rate
},
...
...
@@ -399,7 +411,10 @@ static int mp3_seek(AVFormatContext *s, int stream_index, int64_t timestamp,
int
i
,
j
;
int
dir
=
(
flags
&
AVSEEK_FLAG_BACKWARD
)
?
-
1
:
1
;
if
(
mp3
->
is_cbr
&&
st
->
duration
>
0
&&
mp3
->
header_filesize
>
s
->
data_offset
)
{
if
(
mp3
->
is_cbr
&&
st
->
duration
>
0
&&
mp3
->
header_filesize
>
s
->
data_offset
&&
mp3
->
frames
)
{
int64_t
filesize
=
avio_size
(
s
->
pb
);
int64_t
duration
;
if
(
filesize
<=
s
->
data_offset
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment