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
1ca5c178
Commit
1ca5c178
authored
May 25, 2014
by
Marton Balint
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ffplay: calculate SDL audio buffer size based on sample rate
Signed-off-by:
Marton Balint
<
cus@passwd.hu
>
parent
ba800def
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
4 deletions
+6
-4
ffplay.c
ffplay.c
+6
-4
No files found.
ffplay.c
View file @
1ca5c178
...
...
@@ -67,9 +67,11 @@ const int program_birth_year = 2003;
#define MAX_QUEUE_SIZE (15 * 1024 * 1024)
#define MIN_FRAMES 5
/* SDL audio buffer size, in samples. Should be small to have precise
/*
Minimum
SDL audio buffer size, in samples. Should be small to have precise
A/V sync as SDL does not have hardware buffer fullness info. */
#define SDL_AUDIO_BUFFER_SIZE 1024
#define SDL_AUDIO_MIN_BUFFER_SIZE 512
/* Calculate actual buffer size keeping in mind not cause too frequent audio callbacks */
#define SDL_AUDIO_MAX_CALLBACKS_PER_SEC 60
/* no AV sync correction is done if below the minimum AV sync threshold */
#define AV_SYNC_THRESHOLD_MIN 0.04
...
...
@@ -202,7 +204,7 @@ typedef struct VideoState {
AVStream
*
audio_st
;
PacketQueue
audioq
;
int
audio_hw_buf_size
;
uint8_t
silence_buf
[
SDL_AUDIO_BUFFER_SIZE
];
uint8_t
silence_buf
[
SDL_AUDIO_
MIN_
BUFFER_SIZE
];
uint8_t
*
audio_buf
;
uint8_t
*
audio_buf1
;
unsigned
int
audio_buf_size
;
/* in bytes */
...
...
@@ -2483,7 +2485,7 @@ static int audio_open(void *opaque, int64_t wanted_channel_layout, int wanted_nb
next_sample_rate_idx
--
;
wanted_spec
.
format
=
AUDIO_S16SYS
;
wanted_spec
.
silence
=
0
;
wanted_spec
.
samples
=
SDL_AUDIO_BUFFER_SIZE
;
wanted_spec
.
samples
=
FFMAX
(
SDL_AUDIO_MIN_BUFFER_SIZE
,
2
<<
av_log2
(
wanted_spec
.
freq
/
SDL_AUDIO_MAX_CALLBACKS_PER_SEC
))
;
wanted_spec
.
callback
=
sdl_audio_callback
;
wanted_spec
.
userdata
=
opaque
;
while
(
SDL_OpenAudio
(
&
wanted_spec
,
&
spec
)
<
0
)
{
...
...
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