From patchwork Tue Sep 19 19:10:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 43793 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:a886:b0:149:dfde:5c0a with SMTP id ca6csp169150pzb; Tue, 19 Sep 2023 12:22:18 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEqzrvEupiCjSSNAZ2aILQSrHUWr1LRW/29ErH/Q0zTzqU/mUi4RyyH3OwRVSLIxGvPYLvV X-Received: by 2002:a2e:8882:0:b0:2c0:af3:27db with SMTP id k2-20020a2e8882000000b002c00af327dbmr326444lji.22.1695151338543; Tue, 19 Sep 2023 12:22:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695151338; cv=none; d=google.com; s=arc-20160816; b=b9CmE1sGoOtj6J/Q1OvIBPQBFo15pcovhZzzokQxH9FP/kzPu5uRnlx1UBqXJF3B53 PRzyxyAMfEQ/cSnQunyvl6YdSxW7P9/0D1MQLslb5/V9+O30jvjGq2cSoF7i3EnwOu5d U6Lah+aq66KiSplrhd7S1/SesJfuc+WRJmXYFCFmx+MkPAwX/3tLUPoJkCM19Izoa6V9 bvXictMvwGc2BazloWh4gfWz0gxOkAcZ1BSfIt8boFOdiKDwbc3o3Q8I0Axh4TbyrEk2 EbcXCc7QQqBrGZ6jrs1Hi/9x6rpkQH0ThDyT+trR+Bj07kd78jfv8Mu6jL4muvJz2B58 +BdA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:references:in-reply-to:message-id :date:to:from:delivered-to; bh=wGlMXqfJ9AuihyU6eLBYjA0xSEPplM1SnNto2wY2fQg=; fh=YOA8vD9MJZuwZ71F/05pj6KdCjf6jQRmzLS+CATXUQk=; b=UPWdS03LxEUi/pm+0hqHak71YZg4JbBfXlBJ8BUMhX/G4ReWmyMeV9O6gXyyVh0UYs wQIrhXIwiGIFnpYR+rmhq/aA0y4cr8XFP6N7nxWflK1Nux6jzlKGYVU7k/AUor66YbMZ tZAZZTmbuzTTQ2DWBAuapd814Q7bBL0met7yT5CE2WZ/PI2pNP3mXcc02uFwWyQC2dPL fN9IXJhWVFY/Qz0+bm2JDttdrd0Ad4d+MJRlbyUL2UQs2/oKaQQnJjwhDitsIw9aOwCP gtobIZep7PLXcHSWGq60i4ZOB053At2dYU7kPuVrRTYhqSIsEJSvrV9NYX4wIZnRijv1 q6lA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id qk15-20020a170906d9cf00b0099bbff8672fsi11325271ejb.696.2023.09.19.12.22.17; Tue, 19 Sep 2023 12:22:18 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 5E3B468C951; Tue, 19 Sep 2023 22:21:10 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail1.khirnov.net (quelana.khirnov.net [94.230.150.81]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id D3ECE68C948 for ; Tue, 19 Sep 2023 22:21:08 +0300 (EEST) Received: from localhost (mail1.khirnov.net [IPv6:::1]) by mail1.khirnov.net (Postfix) with ESMTP id 7503410 for ; Tue, 19 Sep 2023 21:21:08 +0200 (CEST) Received: from mail1.khirnov.net ([IPv6:::1]) by localhost (mail1.khirnov.net [IPv6:::1]) (amavis, port 10024) with ESMTP id xEywAeeZkEIP for ; Tue, 19 Sep 2023 21:21:03 +0200 (CEST) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:2a00:c500:561:201::7]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "libav.khirnov.net", Issuer "smtp.khirnov.net SMTP CA" (verified OK)) by mail1.khirnov.net (Postfix) with ESMTPS id 75956514A for ; Tue, 19 Sep 2023 21:20:42 +0200 (CEST) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:::1]) by libav.khirnov.net (Postfix) with ESMTP id 69BCF3A1515 for ; Tue, 19 Sep 2023 21:20:42 +0200 (CEST) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Tue, 19 Sep 2023 21:10:36 +0200 Message-Id: <20230919191044.18873-10-anton@khirnov.net> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230919191044.18873-1-anton@khirnov.net> References: <20230919191044.18873-1-anton@khirnov.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 09/27] fftools/ffmpeg: stop accessing OutputStream.last_dropped in print_report() X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 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" X-TUID: 63k+FkShymF5 That field is used by the framerate code to track whether any output has been generated for the last input frame(*). Its use in the last invocation of print_report() is meant to meant to account (in the number of dropped frames printed in the log) for the very last filtered frame being dropped. However, that is a highly inappropriate place to do so, as it makes assumptions about vsync logic in completely unrelated code. Move the increment to encoder flush instead. (*) the name is misleading, as the input frame has not yet been dropped and may still be output in the future --- fftools/ffmpeg.c | 3 --- fftools/ffmpeg_enc.c | 3 +++ 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c index 14f55cbec7..a854589bef 100644 --- a/fftools/ffmpeg.c +++ b/fftools/ffmpeg.c @@ -566,9 +566,6 @@ static void print_report(int is_last_report, int64_t timer_start, int64_t cur_ti pts -= copy_ts_first_pts; } } - - if (is_last_report) - nb_frames_drop += ost->last_dropped; } us = FFABS64U(pts) % AV_TIME_BASE; diff --git a/fftools/ffmpeg_enc.c b/fftools/ffmpeg_enc.c index 0ad3a7b6b1..2250d22bd3 100644 --- a/fftools/ffmpeg_enc.c +++ b/fftools/ffmpeg_enc.c @@ -761,6 +761,9 @@ static int encode_frame(OutputFile *of, OutputStream *ost, AVFrame *frame) if (frame->sample_aspect_ratio.num && !ost->frame_aspect_ratio.num) enc->sample_aspect_ratio = frame->sample_aspect_ratio; + } else if (ost->last_dropped) { + ost->nb_frames_drop++; + ost->last_dropped = 0; } update_benchmark(NULL);