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
6aeea1df
Commit
6aeea1df
authored
Feb 23, 2012
by
Justin Ruggles
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ac3enc: choose the closest bit rate to the one requested instead of failing
parent
78e9852a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
6 deletions
+11
-6
ac3enc.c
libavcodec/ac3enc.c
+11
-6
No files found.
libavcodec/ac3enc.c
View file @
6aeea1df
...
...
@@ -2189,15 +2189,20 @@ static av_cold int validate_options(AC3EncodeContext *s)
wpf
--
;
s
->
frame_size_min
=
2
*
wpf
;
}
else
{
int
best_br
=
0
,
best_code
=
0
,
best_diff
=
INT_MAX
;
for
(
i
=
0
;
i
<
19
;
i
++
)
{
if
((
ff_ac3_bitrate_tab
[
i
]
>>
s
->
bit_alloc
.
sr_shift
)
*
1000
==
avctx
->
bit_rate
)
int
br
=
(
ff_ac3_bitrate_tab
[
i
]
>>
s
->
bit_alloc
.
sr_shift
)
*
1000
;
int
diff
=
abs
(
br
-
avctx
->
bit_rate
);
if
(
diff
<
best_diff
)
{
best_br
=
br
;
best_code
=
i
;
best_diff
=
diff
;
}
if
(
!
best_diff
)
break
;
}
if
(
i
==
19
)
{
av_log
(
avctx
,
AV_LOG_ERROR
,
"invalid bit rate
\n
"
);
return
AVERROR
(
EINVAL
);
}
s
->
frame_size_code
=
i
<<
1
;
avctx
->
bit_rate
=
best_br
;
s
->
frame_size_code
=
best_code
<<
1
;
s
->
frame_size_min
=
2
*
ff_ac3_frame_size_tab
[
s
->
frame_size_code
][
s
->
bit_alloc
.
sr_code
];
s
->
num_blks_code
=
0x3
;
s
->
num_blocks
=
6
;
...
...
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