From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id 9631B476EA for ; Tue, 19 Dec 2023 15:04:00 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 02CEC68D0E5; Tue, 19 Dec 2023 17:03:59 +0200 (EET) Received: from nef.ens.fr (nef2.ens.fr [129.199.96.40]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id D13FF68CF0D for ; Tue, 19 Dec 2023 17:03:52 +0200 (EET) X-ENS-nef-client: 129.199.129.80 ( name = phare.normalesup.org ) Received: from phare.normalesup.org (phare.normalesup.org [129.199.129.80]) by nef.ens.fr (8.14.4/1.01.28121999) with ESMTP id 3BJF3qCA002152 ; Tue, 19 Dec 2023 16:03:52 +0100 Received: by phare.normalesup.org (Postfix, from userid 1001) id 03A23EB5BC; Tue, 19 Dec 2023 16:03:51 +0100 (CET) Date: Tue, 19 Dec 2023 16:03:51 +0100 From: Nicolas George To: FFmpeg development discussions and patches Message-ID: References: <20231214030948.GH6420@pb2> <20231214143911.39198-1-ffmpeg@haasn.xyz> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20231214143911.39198-1-ffmpeg@haasn.xyz> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.4.3 (nef.ens.fr [129.199.96.32]); Tue, 19 Dec 2023 16:03:52 +0100 (CET) Subject: Re: [FFmpeg-devel] [PATCH] avfilter/formats: set audio fmt lists for vaf filters 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 Cc: Niklas Haas Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: Niklas Haas (12023-12-14): > From: Niklas Haas > > Currently, the logic inside the FF_FILTER_FORMATS_QUERY_FUNC branch > prevents this code from running in the event that we have a filter with > a single video input and a single audio output, as the resulting audio > output link will not have its channel counts / samplerates correctly > initialized to their default values, possibly triggering a segfault > downstream. > > An example of such a filter is vaf_spectrumsynth. Although this > particular filter already sets up the channel counts and samplerates as > part of the query function and therefore avoids triggering this bug, the > bug still exists in principle. (And importantly, sets a wrong precedent) > --- > libavfilter/formats.c | 9 +++++---- > 1 file changed, 5 insertions(+), 4 deletions(-) You are asking the framework to guess the audio format when it has NOTHING to base its guess on. This is a terrible idea. When a filter has no audio input but must produce audio, only the filter itself knows what kind of audio it will produce, and it should say so in query_formats(). What happens in spectrumsynth is what MUST happens. It is not a wrong precedent, it is the proper way of things. The worry that a filter will forget to do so and result in a segfault seems wrong to me: just testing the filter before committing would reveal it, not even regression testing is necessary. But if you really want, I would not object to a consistency check after the call to query_formats(). Regards, -- Nicolas George _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".