summaryrefslogtreecommitdiff
path: root/ffmpeg.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2007-08-08 18:54:33 +0000
committerMichael Niedermayer <michaelni@gmx.at>2007-08-08 18:54:33 +0000
commit81d6d520c050695ad842b2da690839298ed7e104 (patch)
treef66de504f4babcc39ed22c70ce8c0b8b03728512 /ffmpeg.c
parent4a897224b72b46c93d2c1c7cd61b22001caed66a (diff)
always handle negative timestamp differences as timestamp discontinuity
Originally committed as revision 9984 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'ffmpeg.c')
-rw-r--r--ffmpeg.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/ffmpeg.c b/ffmpeg.c
index e730da9763..bb40175ce5 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -1922,8 +1922,9 @@ static int av_encode(AVFormatContext **output_files,
// fprintf(stderr, "next:%"PRId64" dts:%"PRId64" off:%"PRId64" %d\n", ist->next_pts, pkt.dts, input_files_ts_offset[ist->file_index], ist->st->codec->codec_type);
if (pkt.dts != AV_NOPTS_VALUE && ist->next_pts != AV_NOPTS_VALUE) {
- int64_t delta= av_rescale_q(pkt.dts, ist->st->time_base, AV_TIME_BASE_Q) - ist->next_pts;
- if(FFABS(delta) > 1LL*dts_delta_threshold*AV_TIME_BASE && !copy_ts){
+ int64_t pkt_dts= av_rescale_q(pkt.dts, ist->st->time_base, AV_TIME_BASE_Q);
+ int64_t delta= pkt_dts - ist->next_pts;
+ if((FFABS(delta) > 1LL*dts_delta_threshold*AV_TIME_BASE || pkt_dts+1<ist->pts)&& !copy_ts){
input_files_ts_offset[ist->file_index]-= delta;
if (verbose > 2)
fprintf(stderr, "timestamp discontinuity %"PRId64", new offset= %"PRId64"\n", delta, input_files_ts_offset[ist->file_index]);