|
|
|
@ -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), |
|
|
|
|