From patchwork Tue Apr 14 06:01:06 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gyan Doshi X-Patchwork-Id: 18940 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id 2049444B018 for ; Tue, 14 Apr 2020 09:01:33 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id F2AE768B9D6; Tue, 14 Apr 2020 09:01:32 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mout-p-102.mailbox.org (mout-p-102.mailbox.org [80.241.56.152]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 307F368B6C9 for ; Tue, 14 Apr 2020 09:01:25 +0300 (EEST) Received: from smtp2.mailbox.org (smtp2.mailbox.org [80.241.60.241]) (using TLSv1.2 with cipher ECDHE-RSA-CHACHA20-POLY1305 (256/256 bits)) (No client certificate requested) by mout-p-102.mailbox.org (Postfix) with ESMTPS id 491ZcP19Y2zKmTQ for ; Tue, 14 Apr 2020 08:01:25 +0200 (CEST) X-Virus-Scanned: amavisd-new at heinlein-support.de Received: from smtp2.mailbox.org ([80.241.60.241]) by spamfilter05.heinlein-hosting.de (spamfilter05.heinlein-hosting.de [80.241.56.123]) (amavisd-new, port 10030) with ESMTP id D1fj_chAim35 for ; Tue, 14 Apr 2020 08:01:22 +0200 (CEST) From: Gyan Doshi To: ffmpeg-devel@ffmpeg.org Date: Tue, 14 Apr 2020 11:31:06 +0530 Message-Id: <20200414060106.1384-1-ffmpeg@gyani.pro> MIME-Version: 1.0 X-Rspamd-Queue-Id: 3E112176B X-Rspamd-Score: 0.29 / 15.00 / 15.00 Subject: [FFmpeg-devel] [PATCH] ffmpeg: allow full range of dts_delta_threshold X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" 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 "