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
9eafdd51
Commit
9eafdd51
authored
Mar 02, 2013
by
Marton Balint
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ffplay: use frame->pts if available for setting the audio clock
Signed-off-by:
Marton Balint
<
cus@passwd.hu
>
parent
1822519d
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
8 deletions
+11
-8
ffplay.c
ffplay.c
+11
-8
No files found.
ffplay.c
View file @
9eafdd51
...
...
@@ -2091,6 +2091,12 @@ static int audio_decode_frame(VideoState *is)
flush_complete
=
1
;
continue
;
}
if
(
is
->
frame
->
pts
==
AV_NOPTS_VALUE
&&
pkt_temp
->
pts
!=
AV_NOPTS_VALUE
)
is
->
frame
->
pts
=
av_rescale_q
(
pkt_temp
->
pts
,
is
->
audio_st
->
time_base
,
dec
->
time_base
);
if
(
pkt_temp
->
pts
!=
AV_NOPTS_VALUE
)
pkt_temp
->
pts
+=
(
double
)
is
->
frame
->
nb_samples
/
is
->
frame
->
sample_rate
/
av_q2d
(
is
->
audio_st
->
time_base
);
data_size
=
av_samples_get_buffer_size
(
NULL
,
av_frame_get_channels
(
is
->
frame
),
is
->
frame
->
nb_samples
,
is
->
frame
->
format
,
1
);
...
...
@@ -2154,8 +2160,11 @@ static int audio_decode_frame(VideoState *is)
}
audio_clock0
=
is
->
audio_clock
;
is
->
audio_clock
+=
(
double
)
data_size
/
(
av_frame_get_channels
(
is
->
frame
)
*
is
->
frame
->
sample_rate
*
av_get_bytes_per_sample
(
is
->
frame
->
format
));
/* update the audio clock with the pts */
if
(
is
->
frame
->
pts
!=
AV_NOPTS_VALUE
)
{
is
->
audio_clock
=
is
->
frame
->
pts
*
av_q2d
(
dec
->
time_base
)
+
(
double
)
is
->
frame
->
nb_samples
/
is
->
frame
->
sample_rate
;
is
->
audio_clock_serial
=
is
->
audio_pkt_temp_serial
;
}
#ifdef DEBUG
{
static
double
last_clock
;
...
...
@@ -2190,12 +2199,6 @@ static int audio_decode_frame(VideoState *is)
}
*
pkt_temp
=
*
pkt
;
/* if update the audio clock with the pts */
if
(
pkt
->
pts
!=
AV_NOPTS_VALUE
)
{
is
->
audio_clock
=
av_q2d
(
is
->
audio_st
->
time_base
)
*
pkt
->
pts
;
is
->
audio_clock_serial
=
is
->
audio_pkt_temp_serial
;
}
}
}
...
...
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