From patchwork Sun Mar 31 18:36:55 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marton Balint X-Patchwork-Id: 47687 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:9f96:b0:1a3:b6bb:3029 with SMTP id mm22csp359474pzb; Sun, 31 Mar 2024 11:37:14 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXhCQ592S5dOuRRSKxchMSoc8YAt/RWuGVjX5W/WUcOygbxR16iIiDcZ7AlH0z+rQ441zpMg/mhgB+rSlud5qfsYBAAO45HgTtpgA== X-Google-Smtp-Source: AGHT+IEY1EnOWuqup79aI46nyYwSiIDeueN76NNHt7GF4o1jZVwjqp1KEued9tZxXpkCVzdhP1RW X-Received: by 2002:a17:906:6810:b0:a4e:60c0:6a96 with SMTP id k16-20020a170906681000b00a4e60c06a96mr1074129ejr.7.1711910233816; Sun, 31 Mar 2024 11:37:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1711910233; cv=none; d=google.com; s=arc-20160816; b=lF68urkn/30l4qaoCk8nxxOh/GSjHDYOFl7nzzoOxaFW0LCfVt635fvCetxyeiiRHH cELZ/KRExetqGYVwg3w+f3HU6l2De4TW45ZBEYMSBabbanPxIa56Qd690tkKoyOaGfJ6 z+N/HUa8EjhYz/PRMiJk5bBYFrtr1PiVVftYR68jglRGVTq8/DNTcs9HSVeiIXRnDN7a JKm+roedcU9LbKz/G/p7N7OJq7EPPViyLQmLS5WEpb4HXWs6+EH7Qar+SYV4kvDgHyhz QqbAp8jsWVS82v3YTnsyrPi6jyFjgteMwqf75fGPkH51DVaV04UXx1fYqpxKO8KsiRM0 VIyA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:mime-version:message-id:date:to:from :delivered-to; bh=E9UUIBk+EEo57N304wNlYxbLXc9VdWZSC4P4mT0wgmo=; fh=s+G8Ss4JbeMFkWPSp2LmIH/LXFyBlALRiww1j3FPjHY=; b=y2BDAJBdm3ik/kNpZNJvSmK8QIblEgcUVAssoE0KqII2pgJ0jxM6pWMbQasMFKPK/z ZvdwwTtnRu2WVouPEe5cIZLnq1OEOyHw7DRDMiaOxQcW+15kidwDFER94bK/OtxIrJ2y 2vFCV+Dm3v/e28LC0cL9Y4svY7dHQub3uw8wKFFlprME0Lr3mVWI46gPQBWkJ5CToqVX /tN6AjsYtVmfOCV3KlUfPsS6rILeNU/wszHvijqpxowgwsdDnaYcd0Dch6p4xsEf7uL6 a17U51x0lLauH23FKasxbzA6ihaGi5T66d8faZNuujC05yY/VXv5YBe9uIjPKSWZzBvD eUCA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id br19-20020a170906d15300b00a46e8c027f4si3782313ejb.179.2024.03.31.11.37.13; Sun, 31 Mar 2024 11:37:13 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 5E48B68CCD7; Sun, 31 Mar 2024 21:37:09 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from iq.passwd.hu (iq.passwd.hu [217.27.212.140]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 2D7C568C1AA for ; Sun, 31 Mar 2024 21:37:03 +0300 (EEST) Received: from localhost (localhost [127.0.0.1]) by iq.passwd.hu (Postfix) with ESMTP id 8926CE9D9D; Sun, 31 Mar 2024 20:37:02 +0200 (CEST) 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 VAmzvc1GTAkr; Sun, 31 Mar 2024 20:37:01 +0200 (CEST) Received: from bluegene.passwd.hu (localhost [127.0.0.1]) by iq.passwd.hu (Postfix) with ESMTP id F1624E6F41; Sun, 31 Mar 2024 20:37:00 +0200 (CEST) From: Marton Balint To: ffmpeg-devel@ffmpeg.org Date: Sun, 31 Mar 2024 20:36:55 +0200 Message-Id: <20240331183655.4592-1-cus@passwd.hu> X-Mailer: git-send-email 2.35.3 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH] avfilter/buffersrc: never override channel count in av_buffersrc_add_frame_flags 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: Marton Balint Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: H5Yrmon+YwoM Overriding unknown layouts with the negotiated layout is OK, but the number of channels should match with what was negotiated. Signed-off-by: Marton Balint --- libavfilter/buffersrc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavfilter/buffersrc.c b/libavfilter/buffersrc.c index 130751775a..3ea3ca92c9 100644 --- a/libavfilter/buffersrc.c +++ b/libavfilter/buffersrc.c @@ -215,7 +215,7 @@ int attribute_align_arg av_buffersrc_add_frame_flags(AVFilterContext *ctx, AVFra break; case AVMEDIA_TYPE_AUDIO: /* For layouts unknown on input but known on link after negotiation. */ - if (frame->ch_layout.order == AV_CHANNEL_ORDER_UNSPEC) { + if (frame->ch_layout.order == AV_CHANNEL_ORDER_UNSPEC && frame->ch_layout.nb_channels == s->ch_layout.nb_channels) { ret = av_channel_layout_copy(&frame->ch_layout, &s->ch_layout); if (ret < 0) return ret;