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 4420243ABF for ; Sat, 10 Sep 2022 13:56:56 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id A85A168BAF4; Sat, 10 Sep 2022 16:56:54 +0300 (EEST) Received: from mail-oo1-f46.google.com (mail-oo1-f46.google.com [209.85.161.46]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 0A51268BAAA for ; Sat, 10 Sep 2022 16:56:48 +0300 (EEST) Received: by mail-oo1-f46.google.com with SMTP id p48-20020a4a95f3000000b0044b0f5a8d17so718999ooi.0 for ; Sat, 10 Sep 2022 06:56:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date; bh=N5q9npvoLv5l3xF5Ps+efUcU2uKLi9EZ+YmuF95IPe0=; b=UKnHX0oNQgBn118T5Mp4rZxgMP/DcalKeT+Y+UmBtpltfc4qf/KO4V0za8EJPUkWxx Qssc2wYe3r3X5W2mHmX9rk7zR7EPjyMPkYalrKEeinRZfUut8ztHidElgreAzh68GWOm YrjTcXayzo7HqxI24L70qs/llx7Xoalh2tSlgf4QA14Nl07hbSiMDXXnJLNJl7RVWcFG DBcNM+zAyWypZthoehDnAMSHQxCqtCgl/MXqMvq0XoqeSzQK/+u40Vq74f4n5IoEO/8G oPOm/BiyJdYfYbQ+BgbBzIzB68j/WMs6SBEUwA4BeBPhJkVqEdwaBNoFq+I9aOT4wW+h GdHQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date; bh=N5q9npvoLv5l3xF5Ps+efUcU2uKLi9EZ+YmuF95IPe0=; b=HqdguYHwm5weLIJZki/w/blDECvA5RRRVwewHMD3a7zpHch3EoN55X3O4pVCYe4/xV 9HAJbHXoqGSxIlqPgihffKAeqcw6USGmKvA89fb+dlvPRZS9ntRN360m+meaj/PBCTyr zVKRd5Os2RSwNtoSd24jl0MJtXCufKXCfIsn222scK0YkBDylgscUerHuhzf1WSUaEsU CKCijaO979E9R86JyAHOdYTOsisaMhH/PAH692UaJCs20XfEf4P9Qmu84kMYv13upe0F JyE737gR4ybVbpUTg0GQaBYHd6h2EahywpMEgrYeHUOdujHQcrIv4QBFUcF/f8yH+SAd GZCA== X-Gm-Message-State: ACgBeo3O0iknMrmUsq6Am8gFA6HASefs/r+EI4GfPpAoNXKhOyq9hM+w dQgwRNnIEBe6X0ms1TYl7hpMRjlpbNk= X-Google-Smtp-Source: AA6agR6MMwzjk49CgSd6ocJayBtbur+xNuIrm/om74Y4TN2LsXdIE/LmMo2V9BAARH7dwD+mzgxFmw== X-Received: by 2002:a4a:bb19:0:b0:44a:9cda:56a1 with SMTP id f25-20020a4abb19000000b0044a9cda56a1mr6451428oop.14.1662818206261; Sat, 10 Sep 2022 06:56:46 -0700 (PDT) Received: from localhost.localdomain ([191.97.187.183]) by smtp.gmail.com with ESMTPSA id g22-20020a9d6216000000b00636cc9926dbsm1419074otj.40.2022.09.10.06.56.45 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 10 Sep 2022 06:56:45 -0700 (PDT) From: James Almer To: ffmpeg-devel@ffmpeg.org Date: Sat, 10 Sep 2022 10:56:26 -0300 Message-Id: <20220910135626.1480-1-jamrial@gmail.com> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220910120540.718-1-jamrial@gmail.com> References: <20220910120540.718-1-jamrial@gmail.com> MIME-Version: 1.0 Subject: [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-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: 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; } -- 2.37.2 _______________________________________________ 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".