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
f50b6be5
Commit
f50b6be5
authored
Oct 29, 2011
by
Justin Ruggles
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mace: only calculate output buffer size once
parent
ce33320b
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
4 deletions
+7
-4
mace.c
libavcodec/mace.c
+7
-4
No files found.
libavcodec/mace.c
View file @
f50b6be5
...
...
@@ -243,11 +243,14 @@ static int mace_decode_frame(AVCodecContext *avctx,
int16_t
*
samples
=
data
;
MACEContext
*
ctx
=
avctx
->
priv_data
;
int
i
,
j
,
k
,
l
;
int
out_size
;
int
is_mace3
=
(
avctx
->
codec_id
==
CODEC_ID_MACE3
);
if
(
*
data_size
<
(
3
*
buf_size
<<
(
2
-
is_mace3
)))
{
av_log
(
avctx
,
AV_LOG_ERROR
,
"Output buffer too small!
\n
"
);
return
-
1
;
out_size
=
3
*
(
buf_size
<<
(
1
-
is_mace3
))
*
av_get_bytes_per_sample
(
avctx
->
sample_fmt
);
if
(
*
data_size
<
out_size
)
{
av_log
(
avctx
,
AV_LOG_ERROR
,
"Output buffer is too small
\n
"
);
return
AVERROR
(
EINVAL
);
}
for
(
i
=
0
;
i
<
avctx
->
channels
;
i
++
)
{
...
...
@@ -274,7 +277,7 @@ static int mace_decode_frame(AVCodecContext *avctx,
}
}
*
data_size
=
3
*
buf_size
<<
(
2
-
is_mace3
)
;
*
data_size
=
out_size
;
return
buf_size
;
}
...
...
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