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
eb4fc6ac
Commit
eb4fc6ac
authored
Nov 10, 2011
by
Michael Niedermayer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ffmpeg: update timestamping code to handle frame threads
Signed-off-by:
Michael Niedermayer
<
michaelni@gmx.at
>
parent
80f716cd
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
4 deletions
+18
-4
ffmpeg.c
ffmpeg.c
+18
-4
No files found.
ffmpeg.c
View file @
eb4fc6ac
...
@@ -1630,6 +1630,7 @@ static int output_packet(InputStream *ist, int ist_index,
...
@@ -1630,6 +1630,7 @@ static int output_packet(InputStream *ist, int ist_index,
void
*
buffer_to_free
=
NULL
;
void
*
buffer_to_free
=
NULL
;
static
unsigned
int
samples_size
=
0
;
static
unsigned
int
samples_size
=
0
;
AVSubtitle
subtitle
,
*
subtitle_to_free
;
AVSubtitle
subtitle
,
*
subtitle_to_free
;
int64_t
pkt_dts
=
AV_NOPTS_VALUE
;
int64_t
pkt_pts
=
AV_NOPTS_VALUE
;
int64_t
pkt_pts
=
AV_NOPTS_VALUE
;
#if CONFIG_AVFILTER
#if CONFIG_AVFILTER
int
frame_available
;
int
frame_available
;
...
@@ -1652,8 +1653,11 @@ static int output_packet(InputStream *ist, int ist_index,
...
@@ -1652,8 +1653,11 @@ static int output_packet(InputStream *ist, int ist_index,
avpkt
=
*
pkt
;
avpkt
=
*
pkt
;
}
}
if
(
pkt
->
dts
!=
AV_NOPTS_VALUE
)
if
(
pkt
->
dts
!=
AV_NOPTS_VALUE
){
ist
->
next_pts
=
ist
->
pts
=
av_rescale_q
(
pkt
->
dts
,
ist
->
st
->
time_base
,
AV_TIME_BASE_Q
);
if
(
ist
->
st
->
codec
->
codec_type
!=
AVMEDIA_TYPE_VIDEO
||
!
ist
->
decoding_needed
)
ist
->
next_pts
=
ist
->
pts
=
av_rescale_q
(
pkt
->
dts
,
ist
->
st
->
time_base
,
AV_TIME_BASE_Q
);
pkt_dts
=
av_rescale_q
(
pkt
->
dts
,
ist
->
st
->
time_base
,
AV_TIME_BASE_Q
);
}
if
(
pkt
->
pts
!=
AV_NOPTS_VALUE
)
if
(
pkt
->
pts
!=
AV_NOPTS_VALUE
)
pkt_pts
=
av_rescale_q
(
pkt
->
pts
,
ist
->
st
->
time_base
,
AV_TIME_BASE_Q
);
pkt_pts
=
av_rescale_q
(
pkt
->
pts
,
ist
->
st
->
time_base
,
AV_TIME_BASE_Q
);
...
@@ -1710,8 +1714,15 @@ static int output_packet(InputStream *ist, int ist_index,
...
@@ -1710,8 +1714,15 @@ static int output_packet(InputStream *ist, int ist_index,
if
(
!
(
decoded_frame
=
avcodec_alloc_frame
()))
if
(
!
(
decoded_frame
=
avcodec_alloc_frame
()))
return
AVERROR
(
ENOMEM
);
return
AVERROR
(
ENOMEM
);
avpkt
.
pts
=
pkt_pts
;
avpkt
.
pts
=
pkt_pts
;
avpkt
.
dts
=
ist
->
p
ts
;
avpkt
.
dts
=
pkt_d
ts
;
pkt_pts
=
AV_NOPTS_VALUE
;
pkt_pts
=
AV_NOPTS_VALUE
;
if
(
pkt_dts
!=
AV_NOPTS_VALUE
&&
ist
->
st
->
codec
->
time_base
.
num
!=
0
)
{
int
ticks
=
ist
->
st
->
parser
?
ist
->
st
->
parser
->
repeat_pict
+
1
:
ist
->
st
->
codec
->
ticks_per_frame
;
pkt_dts
+=
((
int64_t
)
AV_TIME_BASE
*
ist
->
st
->
codec
->
time_base
.
num
*
ticks
)
/
ist
->
st
->
codec
->
time_base
.
den
;
}
else
pkt_dts
=
AV_NOPTS_VALUE
;
ret
=
avcodec_decode_video2
(
ist
->
st
->
codec
,
ret
=
avcodec_decode_video2
(
ist
->
st
->
codec
,
decoded_frame
,
&
got_output
,
&
avpkt
);
decoded_frame
,
&
got_output
,
&
avpkt
);
...
@@ -1723,7 +1734,10 @@ static int output_packet(InputStream *ist, int ist_index,
...
@@ -1723,7 +1734,10 @@ static int output_packet(InputStream *ist, int ist_index,
av_freep
(
&
decoded_frame
);
av_freep
(
&
decoded_frame
);
goto
discard_packet
;
goto
discard_packet
;
}
}
ist
->
next_pts
=
ist
->
pts
=
decoded_frame
->
best_effort_timestamp
;
if
(
decoded_frame
->
best_effort_timestamp
!=
AV_NOPTS_VALUE
)
ist
->
next_pts
=
ist
->
pts
=
decoded_frame
->
best_effort_timestamp
;
if
(
ist
->
st
->
codec
->
time_base
.
num
!=
0
)
{
if
(
ist
->
st
->
codec
->
time_base
.
num
!=
0
)
{
int
ticks
=
ist
->
st
->
parser
?
ist
->
st
->
parser
->
repeat_pict
+
1
:
ist
->
st
->
codec
->
ticks_per_frame
;
int
ticks
=
ist
->
st
->
parser
?
ist
->
st
->
parser
->
repeat_pict
+
1
:
ist
->
st
->
codec
->
ticks_per_frame
;
ist
->
next_pts
+=
((
int64_t
)
AV_TIME_BASE
*
ist
->
next_pts
+=
((
int64_t
)
AV_TIME_BASE
*
...
...
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