From patchwork Fri Oct 14 10:15:48 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 38735 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:4a86:b0:9d:28a3:170e with SMTP id fn6csp244420pzb; Fri, 14 Oct 2022 03:19:12 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4D0u69rsnY6OzDSKuWESvvco4ZxDdYKZENYBJwnHLTMosLollrO1X7ZPwQJMhzgcy9qZOC X-Received: by 2002:a17:907:c15:b0:78d:af58:4274 with SMTP id ga21-20020a1709070c1500b0078daf584274mr3028874ejc.150.1665742752082; Fri, 14 Oct 2022 03:19:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1665742752; cv=none; d=google.com; s=arc-20160816; b=BKtf4Rs65iyol9Vo558KsMsOV5CUEE+C+6RQyoDIXPkoMxAoM6m7YJt23g5YlmPdhS YymAgCccgiBpMUIeGiZw9I8SaqVnBbMZXsZzEQopvdEczqA2kOoZhqQu/KaD0QuiGvsz fKLp4ZSBAOqZjs2mcC9eQW27XSPSBR64YNAw73lmVub25FR92lrAAJLfwctJrWpntTeT a//KSVcI3cS60uaAfZk9WDPCoeJfTJdPe3GMOJ6u/cr7ts8Kd7j32eis9JOl7VtCd9eV OBbnsRw1ZnxELFEeI2H0ADVbBmINpuCHtZOfmTF0OAvlScf+6Mi49wVGMqst/F75RPEJ jr6Q== 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=+2zxQyF1MKUGIWR8uOkGkeKv1p/3Hh6U5eaUOuE2Ytg=; b=k6PAAjIVFP9/zg6E8QJ0k9F4L72ycwjlejYYP5BVSp4hV+DjNNotp0CFQ/PVRZWIrl o9HP60y5E7OBTnvwERHPx2sqD6B6406vr5OIIr+H/qIsMGtfj3Oe74DgB1qp/iF6sOvk fpnZEAbsReiLppGNe91ODx66Y58R+noKa0aRlj6DFFGPRmJmDWZXOs5VL0XzDNaFQpmL 8yoRhY/1AeYboVoNp/XWQfGRBNzeYN2Lb1vIX5F3+H4VpjweXpMlVyEomYkQdiaShMGE p27LtIpy2R8ojq2TODQPKat/h+p9xI10hx9qR/ZIb03ESEYPS1DVoeaVEEA+Y0MeQrIs swqQ== 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 a101-20020a509eee000000b00457f5aa9dc6si2006749edf.528.2022.10.14.03.19.11; Fri, 14 Oct 2022 03:19:12 -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 5F42D68BDC3; Fri, 14 Oct 2022 13:18:37 +0300 (EEST) 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 3D0C368BD98 for ; Fri, 14 Oct 2022 13:18:28 +0300 (EEST) Received: from localhost (localhost [IPv6:::1]) by mail0.khirnov.net (Postfix) with ESMTP id ED1F82404E4 for ; Fri, 14 Oct 2022 12:18:27 +0200 (CEST) Received: from mail0.khirnov.net ([IPv6:::1]) by localhost (mail0.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id 9Gsg2uBbIFUE for ; Fri, 14 Oct 2022 12:18:27 +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 mail0.khirnov.net (Postfix) with ESMTPS id 015C52405F9 for ; Fri, 14 Oct 2022 12:18:25 +0200 (CEST) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:::1]) by libav.khirnov.net (Postfix) with ESMTP id 3AAFB3A184A for ; Fri, 14 Oct 2022 12:18:24 +0200 (CEST) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Fri, 14 Oct 2022 12:15:48 +0200 Message-Id: <20221014101548.3486-9-anton@khirnov.net> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20221014101548.3486-1-anton@khirnov.net> References: <20221013134904.10104-1-anton@khirnov.net> <20221014101548.3486-1-anton@khirnov.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 22/22] fftools/ffmpeg_mux: move muxing queue fields from OutputStream to MuxStream 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: 5G6L/sFvlJr0 They are private to the muxer and do not need to be visible outside of it. --- fftools/ffmpeg.h | 5 ----- fftools/ffmpeg_mux.c | 4 ++-- fftools/ffmpeg_mux.h | 5 +++++ fftools/ffmpeg_mux_init.c | 8 ++++---- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/fftools/ffmpeg.h b/fftools/ffmpeg.h index b98bb45331..8f03d638c3 100644 --- a/fftools/ffmpeg.h +++ b/fftools/ffmpeg.h @@ -596,11 +596,6 @@ typedef struct OutputStream { /* packet quality factor */ int quality; - int max_muxing_queue_size; - - /* Threshold after which max_muxing_queue_size will be in effect */ - size_t muxing_queue_data_threshold; - /* packet picture type */ int pict_type; diff --git a/fftools/ffmpeg_mux.c b/fftools/ffmpeg_mux.c index 525c15b4ae..2b70143978 100644 --- a/fftools/ffmpeg_mux.c +++ b/fftools/ffmpeg_mux.c @@ -264,8 +264,8 @@ static int queue_packet(Muxer *mux, OutputStream *ost, AVPacket *pkt) size_t cur_size = av_fifo_can_read(ms->muxing_queue); size_t pkt_size = pkt ? pkt->size : 0; unsigned int are_we_over_size = - (ms->muxing_queue_data_size + pkt_size) > ost->muxing_queue_data_threshold; - size_t limit = are_we_over_size ? ost->max_muxing_queue_size : SIZE_MAX; + (ms->muxing_queue_data_size + pkt_size) > ms->muxing_queue_data_threshold; + size_t limit = are_we_over_size ? ms->max_muxing_queue_size : SIZE_MAX; size_t new_size = FFMIN(2 * cur_size, limit); if (new_size <= cur_size) { diff --git a/fftools/ffmpeg_mux.h b/fftools/ffmpeg_mux.h index 8470f971cc..6ea7c692ef 100644 --- a/fftools/ffmpeg_mux.h +++ b/fftools/ffmpeg_mux.h @@ -48,6 +48,11 @@ typedef struct MuxStream { */ size_t muxing_queue_data_size; + int max_muxing_queue_size; + + /* Threshold after which max_muxing_queue_size will be in effect */ + size_t muxing_queue_data_threshold; + /* dts of the last packet sent to the muxer, in the stream timebase * used for making up missing dts values */ int64_t last_mux_dts; diff --git a/fftools/ffmpeg_mux_init.c b/fftools/ffmpeg_mux_init.c index 3f2db04f52..24b4631326 100644 --- a/fftools/ffmpeg_mux_init.c +++ b/fftools/ffmpeg_mux_init.c @@ -330,11 +330,11 @@ static OutputStream *new_output_stream(Muxer *mux, OptionsContext *o, MATCH_PER_STREAM_OPT(disposition, str, ost->disposition, oc, st); ost->disposition = av_strdup(ost->disposition); - ost->max_muxing_queue_size = 128; - MATCH_PER_STREAM_OPT(max_muxing_queue_size, i, ost->max_muxing_queue_size, oc, st); + ms->max_muxing_queue_size = 128; + MATCH_PER_STREAM_OPT(max_muxing_queue_size, i, ms->max_muxing_queue_size, oc, st); - ost->muxing_queue_data_threshold = 50*1024*1024; - MATCH_PER_STREAM_OPT(muxing_queue_data_threshold, i, ost->muxing_queue_data_threshold, oc, st); + ms->muxing_queue_data_threshold = 50*1024*1024; + MATCH_PER_STREAM_OPT(muxing_queue_data_threshold, i, ms->muxing_queue_data_threshold, oc, st); MATCH_PER_STREAM_OPT(bits_per_raw_sample, i, ost->bits_per_raw_sample, oc, st);