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
e98cd24a
Commit
e98cd24a
authored
Dec 15, 2013
by
Marton Balint
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ffplay: precalculate audio output frame size and byte per sec
Signed-off-by:
Marton Balint
<
cus@passwd.hu
>
parent
f4c62b9f
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
0 deletions
+8
-0
ffplay.c
ffplay.c
+8
-0
No files found.
ffplay.c
View file @
e98cd24a
...
...
@@ -145,6 +145,8 @@ typedef struct AudioParams {
int
channels
;
int64_t
channel_layout
;
enum
AVSampleFormat
fmt
;
int
frame_size
;
int
bytes_per_sec
;
}
AudioParams
;
typedef
struct
Clock
{
...
...
@@ -2468,6 +2470,12 @@ static int audio_open(void *opaque, int64_t wanted_channel_layout, int wanted_nb
audio_hw_params
->
freq
=
spec
.
freq
;
audio_hw_params
->
channel_layout
=
wanted_channel_layout
;
audio_hw_params
->
channels
=
spec
.
channels
;
audio_hw_params
->
frame_size
=
av_samples_get_buffer_size
(
NULL
,
audio_hw_params
->
channels
,
1
,
audio_hw_params
->
fmt
,
1
);
audio_hw_params
->
bytes_per_sec
=
av_samples_get_buffer_size
(
NULL
,
audio_hw_params
->
channels
,
audio_hw_params
->
freq
,
audio_hw_params
->
fmt
,
1
);
if
(
audio_hw_params
->
bytes_per_sec
<=
0
||
audio_hw_params
->
frame_size
<=
0
)
{
av_log
(
NULL
,
AV_LOG_ERROR
,
"av_samples_get_buffer_size failed
\n
"
);
return
-
1
;
}
return
spec
.
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