From patchwork Mon Dec 7 10:08:42 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Jan_Ekstr=C3=B6m?= X-Patchwork-Id: 24385 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 365B744AA24 for ; Mon, 7 Dec 2020 12:16:08 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 1CE31689997; Mon, 7 Dec 2020 12:16:08 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wr1-f65.google.com (mail-wr1-f65.google.com [209.85.221.65]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 58368688041 for ; Mon, 7 Dec 2020 12:16:01 +0200 (EET) Received: by mail-wr1-f65.google.com with SMTP id 91so8244658wrj.7 for ; Mon, 07 Dec 2020 02:16:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=+rZf2bJsAhkUbshEycL53r8Qw24N5jAJa2fiHFcpov4=; b=S9NKSCvlVUjgpuorF4T7gd/z8gJSAIITw5mtG3QlNA6t+cGkDV1O1sOylOSzv399PC zmXDH+2PHMnjlUR1bW3r87UPAdx25/GSNM1p/J20U33QUpK9pA2UiqeUE/uSTv2OTifl gM2eYJctmWB8xBVvx4VIbuT2EXo3qFhuxG1B3dnkNvYXiBz/nAVzpV3LcDd2xjPNZo78 4KVmyA2Tjl6oKp2RURfKeGuJ0iBnLoc5AzqJMCWVejhRQRdNXeuYpdIWmOSwhQkRib7I PaFy8Hq/Veqn2WIvvzcg2roDjdDEs211dAtXGr+05DxDG+X+5Vx2naJKaX9xQSvkg1XE kg9g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=+rZf2bJsAhkUbshEycL53r8Qw24N5jAJa2fiHFcpov4=; b=cY70oMivC1l3wmqxIRRImOlzThLe2Go4ttUBElu4SL9jyA9NJjihBl29+yiUoSz0wn OCQrJefdPqaEvbWPq3khbuTv7J27/aK9gSkJtYwQExVJQpZCf3OfZTt7kXSsNbXsv8yk UYs0Bsunk5jSqbLdCyCrdB5qpwRle79lvwWuc+GZnjmdcvOgz719sGnEQVYDPu6x013Z tPOc0VSxSFEDa5C/o9BVplcb43O8bxOOq6e/7B/lRfCLvR1y5scgIkBNjyh75MiPqyI1 LbU1ORD7QLgoevRZsk38Lxsu5FbH5YTAKoOByfMppHZi4wAzDDdDlRTZR7I+kw4wB5On RmxA== X-Gm-Message-State: AOAM531HtiZ+EC7z/WszFH8NGuaRCl+cNKuBkPCKuJdXU4LVn79J+NKg +TbcXolbbJ+9JNvA1PgWvFJlKHA/78gxKg== X-Google-Smtp-Source: ABdhPJxIC51dX8YLGx6TPZ4/CxUIOZ542c2DpGPa+er9GT8zcNJ3eLaVB8QdMyogucLK4SwABh47yw== X-Received: by 2002:a05:651c:147:: with SMTP id c7mr7945899ljd.455.1607335731067; Mon, 07 Dec 2020 02:08:51 -0800 (PST) Received: from localhost.localdomain (91-159-194-103.elisa-laajakaista.fi. [91.159.194.103]) by smtp.gmail.com with ESMTPSA id v5sm45061ljj.135.2020.12.07.02.08.50 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Dec 2020 02:08:50 -0800 (PST) From: =?utf-8?q?Jan_Ekstr=C3=B6m?= To: ffmpeg-devel@ffmpeg.org Date: Mon, 7 Dec 2020 12:08:42 +0200 Message-Id: <20201207100845.17520-3-jeebjp@gmail.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201207100845.17520-1-jeebjp@gmail.com> References: <20201207100845.17520-1-jeebjp@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 2/5] avformat/fifo: fix handling of stream-time non-NOPTS recovery 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" From: Jan Ekström Until now the proper diff between last_recovery_ts and packet's pts was only done when last_recovery_ts was AV_NOPTS_VALUE. This is kind of an oxymoron as the result of comparing that difference to AV_NOPTS_VALUE most likely always be relatively large. Thus, move the immediate recovery to when last_recovery_ts is AV_NOPTS_VALUE, and do a proper difference between the values otherwise. Signed-off-by: Jan Ekström --- libavformat/fifo.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libavformat/fifo.c b/libavformat/fifo.c index 55cbf14ae93..b940d0dafe1 100644 --- a/libavformat/fifo.c +++ b/libavformat/fifo.c @@ -339,12 +339,12 @@ static int fifo_thread_attempt_recovery(FifoThreadContext *ctx, FifoMessage *msg if (fifo->recovery_wait_streamtime) { if (ctx->last_recovery_ts == AV_NOPTS_VALUE) { + /* Enforce recovery immediately */ + time_since_recovery = fifo->recovery_wait_time; + } else { AVRational tb = avf->streams[pkt->stream_index]->time_base; time_since_recovery = av_rescale_q(pkt->pts - ctx->last_recovery_ts, tb, AV_TIME_BASE_Q); - } else { - /* Enforce recovery immediately */ - time_since_recovery = fifo->recovery_wait_time; } } else { time_since_recovery = av_gettime_relative() - ctx->last_recovery_ts;