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 9E4F343DBA for ; Sat, 10 Sep 2022 12:06:32 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 57B2468BB1C; Sat, 10 Sep 2022 15:06:30 +0300 (EEST) Received: from mail-oa1-f53.google.com (mail-oa1-f53.google.com [209.85.160.53]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 8A58968B20B for ; Sat, 10 Sep 2022 15:06:24 +0300 (EEST) Received: by mail-oa1-f53.google.com with SMTP id 586e51a60fabf-127d10b4f19so10750960fac.9 for ; Sat, 10 Sep 2022 05:06:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:from:to:cc:subject:date; bh=OIliapVgzauqmxrfXaP+Mz7cC1BFhAHnPFuiKGjTKVs=; b=gPIllRAQoBtiFC7WVjt7rXUuKad+CKGfmyirC84cYkGoDdO+FV/cjYagWztC1PONk3 KuKfR4BnDo7O3jzjjnyC57FtY8T8HBrhx/8EziWjy4ejX702wEiU7IR1RmI+HKNuTPZH b2xRUTzBISGfgN2qRZT3zUKHE+3AIW61WKZLrB3Xzjf72CwC2D//z8i9FTUBpi7NYfA9 7aWx9pC364gzzWZPMyZI73qZyKENJuKY+GLj5jm/UogEhmj6esSYDNPY7Ku7iRUtIBTl 37DrfLYi1FOQFL0oNVxI59/6tsrJDRJCRsxmeu2mzLeewKhziaKyqivjA6UHOLPg2G96 ifPQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:x-gm-message-state:from:to:cc:subject:date; bh=OIliapVgzauqmxrfXaP+Mz7cC1BFhAHnPFuiKGjTKVs=; b=bfa7dkERi2AaPD0wKP5RDokSzAw801H0638RgRV8LDM+mAQggRmp8d9uudK4pL/rpR aAEXefIIHDtvn+kJKm2t+q56+EOkVgN+kYXiRZSeVynDgNtc9yD4fAeq8xAfNpxBPBPS QSWjUZF4Z/j9z5jYXlROCt2xgCK4BCHgI5g8ZpdZez5VCj5BoMhJnPXfyxJdMmQ4AIrh fGyJoNwZQgF/oEtCN5rp+as2oiQtwNhPQZxbbc5aaIt/LU9RGPvuU3hK+EbHQXdlJ+Yr OQB33WNXrGTes0Aq7v/FOuMvUrTNQPabyfLHBxVfeLPQcPKV7uPOqWiqlgd0mq3s/ya5 9EAw== X-Gm-Message-State: ACgBeo3MpRdo8+02ZikU89W/0Pjh6+q6SjSQi/muYxy6qLKCo8sGA3zx zaVZZfu7XvVsLqzUbftYem7MPlGdwJ8= X-Google-Smtp-Source: AA6agR4wiXwoZ+61wq55QOTIqaOu0j38p9+jXWmsOwIvJJN0OwvKHX0AshV+xoT94BgKnVzWL1cq9g== X-Received: by 2002:aca:2b05:0:b0:34e:9594:6302 with SMTP id i5-20020aca2b05000000b0034e95946302mr2810886oik.107.1662811582531; Sat, 10 Sep 2022 05:06:22 -0700 (PDT) Received: from localhost.localdomain ([191.97.187.183]) by smtp.gmail.com with ESMTPSA id u15-20020a056870f28f00b0012b5bbbff1dsm142000oap.42.2022.09.10.05.06.21 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 10 Sep 2022 05:06:22 -0700 (PDT) From: James Almer To: ffmpeg-devel@ffmpeg.org Date: Sat, 10 Sep 2022 09:05:40 -0300 Message-Id: <20220910120540.718-1-jamrial@gmail.com> X-Mailer: git-send-email 2.37.2 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH] 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 | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/libavformat/riffdec.c b/libavformat/riffdec.c index 3946ecb72f..aef6b6625a 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,13 @@ 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 (par->ch_layout.order == AV_CHANNEL_ORDER_NATIVE && + 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".