From patchwork Fri May 5 09:07:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 41481 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:dca6:b0:f3:34fa:f187 with SMTP id ky38csp329475pzb; Fri, 5 May 2023 02:07:44 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4deOyczxHBLOL8md09oKDEkCic8aedZ/fGpDP04Qp19Dxnutza1SrxxYYS4NIWgnVP70Ch X-Received: by 2002:a05:6402:1857:b0:50b:fb29:1d91 with SMTP id v23-20020a056402185700b0050bfb291d91mr780668edy.1.1683277663866; Fri, 05 May 2023 02:07:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683277663; cv=none; d=google.com; s=arc-20160816; b=wVVV/r6svglDdmjG2fyIrnHid9Oq+iGkckru7lNKBhYO/gqrElbfzMF1ACJ6H66q+Z oiAuaDeiDyvKR7iHvYqpFVj21/NWtEDh2BtQSXzbZzdIhFI1QOHQ48YeMumGIQsO+Qk5 vbJhBwmG4+RUwRpp5nGKHDsH2V98Z2WYPB4rMVJjVdiUgUdpYoiyHqmZOiHMC8m3MSZf +iDwMVBt4J7HgFTm7/WAeuvPdIa+1TalLKfogMzUepTRGv+dxEzYY71LOD0fC+YLJfYl xyxcZNzHrxdLmHhd5ZfUVbRxp9/Fg9tUEGnL8/LYua3usRVABJB26h7z/NvvmCM5/k1o Xj3Q== 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=5aSJBzYYk3IkVEqcN/zgQ0vD1A4hqHy2rn5iobfQUcc=; b=vl1ZeSt+5/JmtQPtCQ6UCAFo4aNt57x61i3z6o4qnI7F5ZfRvUdiiwXISwzmQxyaFK qHgorFjl76ceuo2YZ0cRaZTkTxJN4Dl9Sw5jCBgeG6rA+IaEoltVDMd6WV4EleeoICM6 oFK1KJz9xEUHVLOb8e39vJT6DIk4icwYlHMOyq1m4UJMiEEGTZrQ4ec0ojlmUdxbPiTa JyAZfFfAGNx5X5paGPeLDifsnGy3IgRXsI3z/NqW0+mJ9ms8NngnOWNTt8Zz5GO09/mp 7xtL6nu98yS1AKIxPfT5F8413Kuk6uIVqKkA2cUq5VnnIbzumdNeHcAtLS7dLAUQYZgt r6fw== 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 w25-20020aa7dcd9000000b0050bcf4d1a54si4535567edu.242.2023.05.05.02.07.43; Fri, 05 May 2023 02:07:43 -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 43AAD68C0FC; Fri, 5 May 2023 12:07:38 +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 2C2A768AB4A for ; Fri, 5 May 2023 12:07:31 +0300 (EEST) Received: from localhost (localhost [IPv6:::1]) by mail0.khirnov.net (Postfix) with ESMTP id 84D5B2406CC for ; Fri, 5 May 2023 11:07:30 +0200 (CEST) Received: from mail0.khirnov.net ([IPv6:::1]) by localhost (mail0.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id 5BV5AISPK1JH for ; Fri, 5 May 2023 11:07:30 +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 F12322404EC for ; Fri, 5 May 2023 11:07:29 +0200 (CEST) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:::1]) by libav.khirnov.net (Postfix) with ESMTP id BCBE73A11B4 for ; Fri, 5 May 2023 11:07:29 +0200 (CEST) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Fri, 5 May 2023 11:07:15 +0200 Message-Id: <20230505090723.24872-3-anton@khirnov.net> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230505090723.24872-1-anton@khirnov.net> References: <20230505090723.24872-1-anton@khirnov.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 03/11] fftools/ffmpeg_enc: stop configuring filter inputs from encoder flush 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: 6py4mX73dT+4 When no frames are ever seen by an encoder, encoder flush will do a last-ditch attempt to configure its source filtergraph in order to at least get the stream parameters. This involves extracting demuxer parameters from filtergraph source inputs, which is * a bad layering violation * probably unreachable, because decoders are flushed before encoders, which should call ifilter_send_eof(), which will also set these parameters; however due to complex control flow it is hard to be entirely sure this code can never be triggered Even if this code can actually be reached, it is probably better to return an error as the comment above it says. --- fftools/ffmpeg_enc.c | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/fftools/ffmpeg_enc.c b/fftools/ffmpeg_enc.c index 5707199ac5..06a1cbc95f 100644 --- a/fftools/ffmpeg_enc.c +++ b/fftools/ffmpeg_enc.c @@ -1137,16 +1137,6 @@ void enc_flush(void) "Finishing stream without any data written to it.\n"); if (ost->filter && !fg->graph) { - int x; - for (x = 0; x < fg->nb_inputs; x++) { - InputFilter *ifilter = fg->inputs[x]; - if (ifilter->format < 0 && - ifilter_parameters_from_codecpar(ifilter, ifilter->ist->par) < 0) { - av_log(ost, AV_LOG_ERROR, "Error copying paramerets from input stream\n"); - exit_program(1); - } - } - if (!ifilter_has_all_input_formats(fg)) continue;