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 ESMTPS id B260D4B981 for ; Thu, 30 Jan 2025 23:19:24 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id DC49268C153; Fri, 31 Jan 2025 01:19:20 +0200 (EET) Received: from iq.passwd.hu (iq.passwd.hu [217.27.212.140]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 0CA4868BFFD for ; Fri, 31 Jan 2025 01:19:15 +0200 (EET) Received: from localhost (localhost [127.0.0.1]) by iq.passwd.hu (Postfix) with ESMTP id 7F2DBEB8CD for ; Fri, 31 Jan 2025 00:19:55 +0100 (CET) X-Virus-Scanned: amavisd-new at passwd.hu Received: from iq.passwd.hu ([127.0.0.1]) by localhost (iq.passwd.hu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Z7Px4IX4qDzC for ; Fri, 31 Jan 2025 00:19:53 +0100 (CET) Received: from iq (iq [217.27.212.140]) by iq.passwd.hu (Postfix) with ESMTPS id 7D744EB8CA for ; Fri, 31 Jan 2025 00:19:53 +0100 (CET) Date: Fri, 31 Jan 2025 00:19:53 +0100 (CET) From: Marton Balint To: FFmpeg development discussions and patches In-Reply-To: <20250130162404.1399574-1-viraajraulgkar@gmail.com> Message-ID: <4850c071-2d27-5486-ab0f-be82e8323c7f@passwd.hu> References: <20250130162404.1399574-1-viraajraulgkar@gmail.com> MIME-Version: 1.0 Subject: Re: [FFmpeg-devel] [PATCH v3] avformat/riffdec: warn on invalid sample rate 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 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: On Thu, 30 Jan 2025, Viraaj Raulgaonkar wrote: > If std_strict_compliance < FF_COMPLIANCE_STRICT, then warn the user of > the invalid sample rate instead of returning an error. This allows the > sample rate to be decoded in certain cases. > > Fixes Trac Ticket #11361. > --- > libavformat/riffdec.c | 7 +++++-- > 1 file changed, 5 insertions(+), 2 deletions(-) > > diff --git a/libavformat/riffdec.c b/libavformat/riffdec.c > index b7a85a6ab2..1f4cacf1d5 100644 > --- a/libavformat/riffdec.c > +++ b/libavformat/riffdec.c > @@ -180,9 +180,12 @@ int ff_get_wav_header(void *logctx, AVIOContext *pb, > par->bit_rate = bitrate; > > if (par->sample_rate <= 0) { > - av_log(logctx, AV_LOG_ERROR, > + int strict = ((AVFormatContext*)logctx)->strict_std_compliance >= FF_COMPLIANCE_STRICT; You should change the type in the function declaration, not cast it here. Thanks, Marton > + av_log(logctx, strict ? AV_LOG_ERROR : AV_LOG_WARNING, > "Invalid sample rate: %d\n", par->sample_rate); > - return AVERROR_INVALIDDATA; > + if (strict) > + return AVERROR_INVALIDDATA; > + par->sample_rate = 0; > } > if (par->codec_id == AV_CODEC_ID_AAC_LATM) { > /* Channels and sample_rate values are those prior to applying SBR > -- > 2.39.5 > > _______________________________________________ > 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". > _______________________________________________ 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".