From patchwork Tue Apr 14 09:18:47 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gyan Doshi X-Patchwork-Id: 18943 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 D4FF3449B71 for ; Tue, 14 Apr 2020 12:19:16 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 9923968B95C; Tue, 14 Apr 2020 12:19:16 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mout-p-201.mailbox.org (mout-p-201.mailbox.org [80.241.56.171]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id B946968B16A for ; Tue, 14 Apr 2020 12:19:09 +0300 (EEST) Received: from smtp1.mailbox.org (smtp1.mailbox.org [IPv6:2001:67c:2050:105:465:1:1:0]) (using TLSv1.2 with cipher ECDHE-RSA-CHACHA20-POLY1305 (256/256 bits)) (No client certificate requested) by mout-p-201.mailbox.org (Postfix) with ESMTPS id 491g0Y1hyGzQlJT for ; Tue, 14 Apr 2020 11:19:09 +0200 (CEST) X-Virus-Scanned: amavisd-new at heinlein-support.de Received: from smtp1.mailbox.org ([80.241.60.240]) by spamfilter06.heinlein-hosting.de (spamfilter06.heinlein-hosting.de [80.241.56.125]) (amavisd-new, port 10030) with ESMTP id MT-5IYsnIVlK for ; Tue, 14 Apr 2020 11:19:04 +0200 (CEST) From: Gyan Doshi To: ffmpeg-devel@ffmpeg.org Date: Tue, 14 Apr 2020 14:48:47 +0530 Message-Id: <20200414091847.596-1-ffmpeg@gyani.pro> In-Reply-To: <20200414060106.1384-1-ffmpeg@gyani.pro> References: <20200414060106.1384-1-ffmpeg@gyani.pro> MIME-Version: 1.0 X-Rspamd-Queue-Id: 831091758 X-Rspamd-Score: 0.29 / 15.00 / 15.00 Subject: [FFmpeg-devel] [PATCH v2] 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. fate-mpeg4-resolution-change call changed to preserve existing timestamp correction by ffmpeg.c --- Tested with multiple satellite MPEG-TS inputs. fftools/ffmpeg.c | 2 +- tests/fate/mpeg4.mak | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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 " diff --git a/tests/fate/mpeg4.mak b/tests/fate/mpeg4.mak index ed6a2fac20..d7a9c62d7e 100644 --- a/tests/fate/mpeg4.mak +++ b/tests/fate/mpeg4.mak @@ -1,7 +1,7 @@ MPEG4_RESOLUTION_CHANGE = down-down down-up up-down up-up -fate-mpeg4-resolution-change-%: CMD = framemd5 -flags +bitexact -idct simple -i $(TARGET_SAMPLES)/mpeg4/resize_$(@:fate-mpeg4-resolution-change-%=%).h263 -sws_flags +bitexact +fate-mpeg4-resolution-change-%: CMD = framemd5 -dts_delta_threshold 1.99 -flags +bitexact -idct simple -i $(TARGET_SAMPLES)/mpeg4/resize_$(@:fate-mpeg4-resolution-change-%=%).h263 -sws_flags +bitexact FATE_MPEG4-$(call DEMDEC, H263, H263) := $(addprefix fate-mpeg4-resolution-change-, $(MPEG4_RESOLUTION_CHANGE))