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
3886572a
Commit
3886572a
authored
Jul 06, 2013
by
Marton Balint
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ffplay: do not update audio clock with old audio pts if current frame is AV_NOPTS_VALUE
Signed-off-by:
Marton Balint
<
cus@passwd.hu
>
parent
aa74810f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
5 deletions
+8
-5
ffplay.c
ffplay.c
+8
-5
No files found.
ffplay.c
View file @
3886572a
...
@@ -2297,10 +2297,11 @@ static int audio_decode_frame(VideoState *is)
...
@@ -2297,10 +2297,11 @@ static int audio_decode_frame(VideoState *is)
audio_clock0
=
is
->
audio_clock
;
audio_clock0
=
is
->
audio_clock
;
/* update the audio clock with the pts */
/* update the audio clock with the pts */
if
(
is
->
frame
->
pts
!=
AV_NOPTS_VALUE
)
{
if
(
is
->
frame
->
pts
!=
AV_NOPTS_VALUE
)
is
->
audio_clock
=
is
->
frame
->
pts
*
av_q2d
(
tb
)
+
(
double
)
is
->
frame
->
nb_samples
/
is
->
frame
->
sample_rate
;
is
->
audio_clock
=
is
->
frame
->
pts
*
av_q2d
(
tb
)
+
(
double
)
is
->
frame
->
nb_samples
/
is
->
frame
->
sample_rate
;
is
->
audio_clock_serial
=
is
->
audio_pkt_temp_serial
;
else
}
is
->
audio_clock
=
NAN
;
is
->
audio_clock_serial
=
is
->
audio_pkt_temp_serial
;
#ifdef DEBUG
#ifdef DEBUG
{
{
static
double
last_clock
;
static
double
last_clock
;
...
@@ -2374,8 +2375,10 @@ static void sdl_audio_callback(void *opaque, Uint8 *stream, int len)
...
@@ -2374,8 +2375,10 @@ static void sdl_audio_callback(void *opaque, Uint8 *stream, int len)
bytes_per_sec
=
is
->
audio_tgt
.
freq
*
is
->
audio_tgt
.
channels
*
av_get_bytes_per_sample
(
is
->
audio_tgt
.
fmt
);
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
;
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. */
/* Let's assume the audio driver that is used by SDL has two periods. */
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
);
if
(
!
isnan
(
is
->
audio_clock
))
{
sync_clock_to_slave
(
&
is
->
extclk
,
&
is
->
audclk
);
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
);
sync_clock_to_slave
(
&
is
->
extclk
,
&
is
->
audclk
);
}
}
}
static
int
audio_open
(
void
*
opaque
,
int64_t
wanted_channel_layout
,
int
wanted_nb_channels
,
int
wanted_sample_rate
,
struct
AudioParams
*
audio_hw_params
)
static
int
audio_open
(
void
*
opaque
,
int64_t
wanted_channel_layout
,
int
wanted_nb_channels
,
int
wanted_sample_rate
,
struct
AudioParams
*
audio_hw_params
)
...
...
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