[FFmpeg-devel] [PATCH] ffmpeg: allow full range of dts_delta_threshold

Gyan Doshi ffmpeg at gyani.pro
Tue Apr 14 09:01:06 EEST 2020


For inputs from demuxers with AVFMT_TS_DISCONT flag,
the existing condition,

  delta < -1LL*dts_delta_threshold*AV_TIME_BASE

is rendered superflous due to the fixed threshold in

pkt_dts + AV_TIME_BASE/10 < FFMAX(ist->pts, ist->dts)

This prevents users from setting a high threshold to
avoid discontinuity correction due to errant timestamps.

Now, the maximum of the two thresholds is used.
---
Tested with multiple satellite MPEG-TS inputs.

 fftools/ffmpeg.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
index 0578265c1e..505fef5bdc 100644
--- a/fftools/ffmpeg.c
+++ b/fftools/ffmpeg.c
@@ -4480,7 +4480,7 @@ static int process_input(int file_index)
         if (is->iformat->flags & AVFMT_TS_DISCONT) {
             if (delta < -1LL*dts_delta_threshold*AV_TIME_BASE ||
                 delta >  1LL*dts_delta_threshold*AV_TIME_BASE ||
-                pkt_dts + AV_TIME_BASE/10 < FFMAX(ist->pts, ist->dts)) {
+                pkt_dts + FFMAX(AV_TIME_BASE/10, dts_delta_threshold*AV_TIME_BASE) < FFMAX(ist->pts, ist->dts)) {
                 ifile->ts_offset -= delta;
                 av_log(NULL, AV_LOG_DEBUG,
                        "timestamp discontinuity for stream #%d:%d "
-- 
2.26.0



More information about the ffmpeg-devel mailing list