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
4c1f61b1
Commit
4c1f61b1
authored
Mar 23, 2013
by
Michael Niedermayer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ffmpeg: Correct inter stream timestamp discontinuities
Signed-off-by:
Michael Niedermayer
<
michaelni@gmx.at
>
parent
dda04a58
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
0 deletions
+21
-0
ffmpeg.c
ffmpeg.c
+20
-0
ffmpeg.h
ffmpeg.h
+1
-0
No files found.
ffmpeg.c
View file @
4c1f61b1
...
...
@@ -2942,6 +2942,23 @@ static int process_input(int file_index)
if
(
pkt
.
dts
!=
AV_NOPTS_VALUE
)
pkt
.
dts
*=
ist
->
ts_scale
;
if
(
pkt
.
dts
!=
AV_NOPTS_VALUE
&&
ist
->
next_dts
==
AV_NOPTS_VALUE
&&
!
copy_ts
&&
(
is
->
iformat
->
flags
&
AVFMT_TS_DISCONT
)
&&
ifile
->
last_ts
!=
AV_NOPTS_VALUE
)
{
int64_t
pkt_dts
=
av_rescale_q
(
pkt
.
dts
,
ist
->
st
->
time_base
,
AV_TIME_BASE_Q
);
int64_t
delta
=
pkt_dts
-
ifile
->
last_ts
;
if
(
delta
<
-
1LL
*
dts_delta_threshold
*
AV_TIME_BASE
||
(
delta
>
1LL
*
dts_delta_threshold
*
AV_TIME_BASE
&&
ist
->
st
->
codec
->
codec_type
!=
AVMEDIA_TYPE_SUBTITLE
)){
ifile
->
ts_offset
-=
delta
;
av_log
(
NULL
,
AV_LOG_DEBUG
,
"Inter stream timestamp discontinuity %"
PRId64
", new offset= %"
PRId64
"
\n
"
,
delta
,
ifile
->
ts_offset
);
pkt
.
dts
-=
av_rescale_q
(
delta
,
AV_TIME_BASE_Q
,
ist
->
st
->
time_base
);
if
(
pkt
.
pts
!=
AV_NOPTS_VALUE
)
pkt
.
pts
-=
av_rescale_q
(
delta
,
AV_TIME_BASE_Q
,
ist
->
st
->
time_base
);
}
}
if
(
pkt
.
dts
!=
AV_NOPTS_VALUE
&&
ist
->
next_dts
!=
AV_NOPTS_VALUE
&&
!
copy_ts
)
{
int64_t
pkt_dts
=
av_rescale_q
(
pkt
.
dts
,
ist
->
st
->
time_base
,
AV_TIME_BASE_Q
);
...
...
@@ -2979,6 +2996,9 @@ static int process_input(int file_index)
}
}
if
(
pkt
.
dts
!=
AV_NOPTS_VALUE
)
ifile
->
last_ts
=
av_rescale_q
(
pkt
.
dts
,
ist
->
st
->
time_base
,
AV_TIME_BASE_Q
);
if
(
debug_ts
)
{
av_log
(
NULL
,
AV_LOG_INFO
,
"demuxer+ffmpeg -> ist_index:%d type:%s pkt_pts:%s pkt_pts_time:%s pkt_dts:%s pkt_dts_time:%s off:%s off_time:%s
\n
"
,
ifile
->
ist_index
+
pkt
.
stream_index
,
av_get_media_type_string
(
ist
->
st
->
codec
->
codec_type
),
...
...
ffmpeg.h
View file @
4c1f61b1
...
...
@@ -278,6 +278,7 @@ typedef struct InputFile {
int
eagain
;
/* true if last read attempt returned EAGAIN */
int
ist_index
;
/* index of first stream in input_streams */
int64_t
ts_offset
;
int64_t
last_ts
;
int
nb_streams
;
/* number of stream that ffmpeg is aware of; may be different
from ctx.nb_streams if new streams appear during av_read_frame() */
int
nb_streams_warn
;
/* number of streams that the user was warned of */
...
...
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