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 452BC4130C for ; Sun, 11 Sep 2022 12:39:48 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id C0C5A68BAC6; Sun, 11 Sep 2022 15:39:45 +0300 (EEST) Received: from mail-oa1-f46.google.com (mail-oa1-f46.google.com [209.85.160.46]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 01B1D68B9ED for ; Sun, 11 Sep 2022 15:39:39 +0300 (EEST) Received: by mail-oa1-f46.google.com with SMTP id 586e51a60fabf-11eab59db71so16457932fac.11 for ; Sun, 11 Sep 2022 05:39:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:in-reply-to:references:to:from :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date; bh=mmokGzo11ItzZQ+bkopFXQxyJzB0YAgAdWsNtdjwGvs=; b=G/If1hd2iBumQuVoaMMwkVvcgmx7NsqsStBaFuNBdr2Io4kdCPjX12MAhgTvJoTS+j iudtB9KDV1D59SWldMGLz6ziPbnf49/GB8DaCEqt0LMdkAenO/iq6C+3PWjUup/aDqmF U8tu8BjD4gWHYgUnr7T5RH0sPYEnYVYIlnlY4GOlov9wzWIzkvSDh++TvPRMJBBBy2R1 pKpx9gTPUd3PUqRmu8Yv5j1CUhDfzpQ9LkrVrNyr+l6QH6BV5Uxzok13+6XxD3kjBVum sL0abQdGSYuH+pMW1sZwQEXw03JhdSAJ+rWs8maLeV+FtCjrkt+ajLV7r4NfmQdtfAW5 8vRw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:references:to:from :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date; bh=mmokGzo11ItzZQ+bkopFXQxyJzB0YAgAdWsNtdjwGvs=; b=I8jzdtDL3dt0S4FNdmWs12CJujMiblYj6i1Ze070JFpiAjutl2Gcjl7gMap7mEPIhe QyhEhlPytckhFxrAKVlianYbmDVtQZHDskhmSzYuJCgQg0Q7Pj0fC7duDD3KILuhv/L6 EQKc6N97hWTbSSVCY9fDv/snrvJyRvFj2rUdgyKbUu7odF4B3j2F6a+r94TBJZFf3v1z EKd9ti56JFNPfDmUiqf//u+Pj99Ru3AU0PxhPazWLvzVpGvgoJXGaJkeUKcxYiR6kYiM k4KGbZ3//C+I42NiUCpA653dE2mKsPkaBGP2hesum1LIjnKU+RDkevJx0qdpdoQ+dB27 pNew== X-Gm-Message-State: ACgBeo0G6L1dgPh1GOM8GkthoFuan752gAb3vb7IZYAdvQLnfkDgJT2C Bd2BmEipEmF18YldXzNLFVh5s9cXFVI= X-Google-Smtp-Source: AA6agR6OnGuI7iK9wEa8DOjModcHCscC6Nww9z4tJB5Hu+B3ZuTlC5KJ6Xj5ssq5xXwbUC87z2OqBA== X-Received: by 2002:a05:6808:130a:b0:344:cc03:c635 with SMTP id y10-20020a056808130a00b00344cc03c635mr7084209oiv.134.1662899977718; Sun, 11 Sep 2022 05:39:37 -0700 (PDT) Received: from [192.168.0.13] ([191.97.187.183]) by smtp.gmail.com with ESMTPSA id t16-20020a9d66d0000000b0061c9ab1032dsm2926798otm.18.2022.09.11.05.39.36 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 11 Sep 2022 05:39:37 -0700 (PDT) Message-ID: <6fa2a888-ccb0-de87-3b1d-980a3502ab69@gmail.com> Date: Sun, 11 Sep 2022 09:39:37 -0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.13.0 Content-Language: en-US From: James Almer To: ffmpeg-devel@ffmpeg.org References: <20220910120540.718-1-jamrial@gmail.com> <20220910135626.1480-1-jamrial@gmail.com> In-Reply-To: <20220910135626.1480-1-jamrial@gmail.com> Subject: Re: [FFmpeg-devel] [PATCH v2] avformat/riffdec: don't unconditionally overwrite WAVEFORMATEXTENSIBLE layout 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 9/10/2022 10:56 AM, James Almer wrote: > Do it only if the value conflicts with the previous channels value. > > Fixes ticket #9912 > > Signed-off-by: James Almer > --- > libavformat/riffdec.c | 11 ++++++++--- > 1 file changed, 8 insertions(+), 3 deletions(-) > > diff --git a/libavformat/riffdec.c b/libavformat/riffdec.c > index 3946ecb72f..c1e4a04550 100644 > --- a/libavformat/riffdec.c > +++ b/libavformat/riffdec.c > @@ -102,6 +102,8 @@ int ff_get_wav_header(AVFormatContext *s, AVIOContext *pb, > return AVERROR_INVALIDDATA; > } > > + av_channel_layout_uninit(&par->ch_layout); > + > par->codec_type = AVMEDIA_TYPE_AUDIO; > if (!big_endian) { > id = avio_rl16(pb); > @@ -189,9 +191,12 @@ int ff_get_wav_header(AVFormatContext *s, AVIOContext *pb, > if (par->codec_id == AV_CODEC_ID_ADPCM_G726 && par->sample_rate) > par->bits_per_coded_sample = par->bit_rate / par->sample_rate; > > - av_channel_layout_uninit(&par->ch_layout); > - par->ch_layout.order = AV_CHANNEL_ORDER_UNSPEC; > - par->ch_layout.nb_channels = channels; > + /* ignore WAVEFORMATEXTENSIBLE layout if different from channel count */ > + if (channels != par->ch_layout.nb_channels) { > + av_channel_layout_uninit(&par->ch_layout); > + par->ch_layout.order = AV_CHANNEL_ORDER_UNSPEC; > + par->ch_layout.nb_channels = channels; > + } > > return 0; > } Will apply _______________________________________________ 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".