From patchwork Tue Jan 11 09:58:27 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 33223 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a6b:cd86:0:0:0:0:0 with SMTP id d128csp3547139iog; Tue, 11 Jan 2022 02:02:37 -0800 (PST) X-Google-Smtp-Source: ABdhPJxOIdvybQ7/+2THRsPWSmuKQklWOeZOQk2fx3GNCzXOXF/+XJeesSDYFRqjmRIrdTrFTRNT X-Received: by 2002:a17:906:8a72:: with SMTP id hy18mr2884664ejc.614.1641895357023; Tue, 11 Jan 2022 02:02:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1641895357; cv=none; d=google.com; s=arc-20160816; b=sJsh2a8Nnjj+RVzok+lpLyqn56qlw5fe8kEOZx9PRuE5sdtQI26MnmqtwBQLTqa2eo iWbz/Or31IJw6t5zcC/virCVWHWwz8YucZ0RC1s9DzijClZbGy0x5KmLa+pY3xBteZTw Wgv9A6FmMtuuL64gR2i8TLXcN3MEl7gOCOqfLvu54TuNvM0+tiebB5fuND0QYDQEOheQ hLajarnvFXmmCFVAXBtX+lemsnR0zmG0G/1B4dnXkrDj0I+ytQHc0M+MnJjahVumu1qc Q55x0BbLUAAQcPNkj3NAHmszhGQ64L2samqn3f/74F8vP6VgP+unZzFEc/4Zm7kUl9Hz GTEA== 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=nqq9hL0HTziw8GJUEePcMP/78inNb8CC/vew3STmVNI=; b=kVBZbr6ChOC+1etbGb8tVW4Ryb4qLbMutprg40FOtfvptfZEmwA+oaEerriNNbfpQW MxbtWwvL+d2OJX/zgR1eq7ROoRApecwl872ra7rRV5Zc7MCENJwcLpMc2rhtTWB9MHJd AfYMguWiLwBFWPWXlkw9ZgrBFYFnhQSzHOC90Y6f0CZ/yhwT7qqclqC+Fm6SXywmbfzm z5sjHQYdPxPqUeHMpBsskR2KFcfe1d7mSGmflH6qZgZ1Z/hVtshB4BeFLnQSXnTcj1JR fNz7dyj7YKClu4cAmOm+/SWPRvhvGwhtMK0HXLph2lJo5gYlCFLVDXk8cpue/8mLjcmz xKYg== 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 nb41si3674166ejc.104.2022.01.11.02.02.36; Tue, 11 Jan 2022 02:02:37 -0800 (PST) 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 B9E3F68AFF3; Tue, 11 Jan 2022 11:59:29 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail0.khirnov.net (red.khirnov.net [176.97.15.12]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id E1B5868AF57 for ; Tue, 11 Jan 2022 11:59:14 +0200 (EET) Received: from localhost (localhost [IPv6:::1]) by mail0.khirnov.net (Postfix) with ESMTP id 48EC1240688 for ; Tue, 11 Jan 2022 10:59:14 +0100 (CET) Received: from mail0.khirnov.net ([IPv6:::1]) by localhost (mail0.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id dtB90v8bq9jR for ; Tue, 11 Jan 2022 10:59:13 +0100 (CET) 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 mail0.khirnov.net (Postfix) with ESMTPS id F1AC7240692 for ; Tue, 11 Jan 2022 10:59:02 +0100 (CET) Received: by libav.khirnov.net (Postfix, from userid 1000) id 3F9083A0D2E; Tue, 11 Jan 2022 10:59:02 +0100 (CET) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Tue, 11 Jan 2022 10:58:27 +0100 Message-Id: <20220111095830.31542-25-anton@khirnov.net> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20220111095830.31542-1-anton@khirnov.net> References: <20220111095830.31542-1-anton@khirnov.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 25/28] ffmpeg_mux: stop using AVStream.nb_frames in do_video_stats() 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: qyVC6/Ayde1G Its use for muxing is not documented, in practice it is incremented per each packet successfully passed to the muxer's write_packet(). Since there is a lot of indirection between ffmpeg submitting a packet to the muxer and it actually being written (e.g. the interleaving queue), using nb_frames to count packets sent to the muxer is incorrect. Use OutputStream.packets_written instead. --- fftools/ffmpeg_mux.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fftools/ffmpeg_mux.c b/fftools/ffmpeg_mux.c index 8a64661c9c..ef6b7ddd97 100644 --- a/fftools/ffmpeg_mux.c +++ b/fftools/ffmpeg_mux.c @@ -72,7 +72,7 @@ static void do_video_stats(OutputStream *ost, int frame_size) } enc = ost->enc_ctx; - frame_number = ost->st->nb_frames; + frame_number = ost->packets_written - 1; if (vstats_version <= 1) { fprintf(vstats_file, "frame= %5d q= %2.1f ", frame_number, ost->quality / (float)FF_QP2LAMBDA);