Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
F
ffmpeg
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
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
ffmpeg
Commits
e37d4920
Commit
e37d4920
authored
Dec 15, 2013
by
Marton Balint
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ffplay: use precalculated frame size and bytes per sec values
Signed-off-by:
Marton Balint
<
cus@passwd.hu
>
parent
e98cd24a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
6 deletions
+3
-6
ffplay.c
ffplay.c
+3
-6
No files found.
ffplay.c
View file @
e37d4920
...
...
@@ -2380,8 +2380,6 @@ static void sdl_audio_callback(void *opaque, Uint8 *stream, int len)
{
VideoState
*
is
=
opaque
;
int
audio_size
,
len1
;
int
bytes_per_sec
;
int
frame_size
=
av_samples_get_buffer_size
(
NULL
,
is
->
audio_tgt
.
channels
,
1
,
is
->
audio_tgt
.
fmt
,
1
);
audio_callback_time
=
av_gettime
();
...
...
@@ -2391,7 +2389,7 @@ static void sdl_audio_callback(void *opaque, Uint8 *stream, int len)
if
(
audio_size
<
0
)
{
/* if error, just output silence */
is
->
audio_buf
=
is
->
silence_buf
;
is
->
audio_buf_size
=
sizeof
(
is
->
silence_buf
)
/
frame_size
*
frame_size
;
is
->
audio_buf_size
=
sizeof
(
is
->
silence_buf
)
/
is
->
audio_tgt
.
frame_size
*
is
->
audio_tgt
.
frame_size
;
}
else
{
if
(
is
->
show_mode
!=
SHOW_MODE_VIDEO
)
update_sample_display
(
is
,
(
int16_t
*
)
is
->
audio_buf
,
audio_size
);
...
...
@@ -2407,11 +2405,10 @@ static void sdl_audio_callback(void *opaque, Uint8 *stream, int len)
stream
+=
len1
;
is
->
audio_buf_index
+=
len1
;
}
bytes_per_sec
=
is
->
audio_tgt
.
freq
*
is
->
audio_tgt
.
channels
*
av_get_bytes_per_sample
(
is
->
audio_tgt
.
fmt
);
is
->
audio_write_buf_size
=
is
->
audio_buf_size
-
is
->
audio_buf_index
;
/* Let's assume the audio driver that is used by SDL has two periods. */
if
(
!
isnan
(
is
->
audio_clock
))
{
set_clock_at
(
&
is
->
audclk
,
is
->
audio_clock
-
(
double
)(
2
*
is
->
audio_hw_buf_size
+
is
->
audio_write_buf_size
)
/
bytes_per_sec
,
is
->
audio_clock_serial
,
audio_callback_time
/
1000000
.
0
);
set_clock_at
(
&
is
->
audclk
,
is
->
audio_clock
-
(
double
)(
2
*
is
->
audio_hw_buf_size
+
is
->
audio_write_buf_size
)
/
is
->
audio_tgt
.
bytes_per_sec
,
is
->
audio_clock_serial
,
audio_callback_time
/
1000000
.
0
);
sync_clock_to_slave
(
&
is
->
extclk
,
&
is
->
audclk
);
}
}
...
...
@@ -2580,7 +2577,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
*
is
->
audio_hw_buf_size
/
av_samples_get_buffer_size
(
NULL
,
is
->
audio_tgt
.
channels
,
is
->
audio_tgt
.
freq
,
is
->
audio_tgt
.
fmt
,
1
)
;
is
->
audio_diff_threshold
=
2
.
0
*
is
->
audio_hw_buf_size
/
is
->
audio_tgt
.
bytes_per_sec
;
memset
(
&
is
->
audio_pkt
,
0
,
sizeof
(
is
->
audio_pkt
));
memset
(
&
is
->
audio_pkt_temp
,
0
,
sizeof
(
is
->
audio_pkt_temp
));
...
...
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