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
2446a8cc
Commit
2446a8cc
authored
Oct 02, 2011
by
Marton Balint
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ffplay: use avctx->channels and avctx->freq before avcodec_open2 consistently
parent
1e7f7dc2
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
7 deletions
+10
-7
ffplay.c
ffplay.c
+10
-7
No files found.
ffplay.c
View file @
2446a8cc
...
...
@@ -2183,8 +2183,15 @@ static int stream_component_open(VideoState *is, int stream_index)
if
(
codec
->
capabilities
&
CODEC_CAP_DR1
)
avctx
->
flags
|=
CODEC_FLAG_EMU_EDGE
;
if
(
avctx
->
codec_type
==
AVMEDIA_TYPE_AUDIO
)
{
if
(
avctx
->
sample_rate
<=
0
||
avctx
->
channels
<=
0
){
fprintf
(
stderr
,
"Invalid sample rate or channel count
\n
"
);
return
-
1
;
}
wanted_spec
.
freq
=
avctx
->
sample_rate
;
wanted_spec
.
channels
=
avctx
->
channels
;
}
if
(
!
codec
||
avcodec_open2
(
avctx
,
codec
,
&
opts
)
<
0
)
return
-
1
;
...
...
@@ -2195,10 +2202,6 @@ static int stream_component_open(VideoState *is, int stream_index)
/* prepare audio output */
if
(
avctx
->
codec_type
==
AVMEDIA_TYPE_AUDIO
)
{
if
(
avctx
->
sample_rate
<=
0
||
avctx
->
channels
<=
0
){
fprintf
(
stderr
,
"Invalid sample rate or channel count
\n
"
);
return
-
1
;
}
wanted_spec
.
format
=
AUDIO_S16SYS
;
wanted_spec
.
silence
=
0
;
wanted_spec
.
samples
=
SDL_AUDIO_BUFFER_SIZE
;
...
...
@@ -2225,7 +2228,7 @@ static int stream_component_open(VideoState *is, int stream_index)
is
->
audio_diff_avg_count
=
0
;
/* since we do not have a precise anough audio fifo fullness,
we correct audio sync only if larger than this threshold */
is
->
audio_diff_threshold
=
2
.
0
*
SDL_AUDIO_BUFFER_SIZE
/
avctx
->
sample_rate
;
is
->
audio_diff_threshold
=
2
.
0
*
SDL_AUDIO_BUFFER_SIZE
/
wanted_spec
.
freq
;
memset
(
&
is
->
audio_pkt
,
0
,
sizeof
(
is
->
audio_pkt
));
packet_queue_init
(
&
is
->
audioq
);
...
...
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