From patchwork Sat Mar 23 15:26:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marton Balint X-Patchwork-Id: 47374 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:c889:b0:1a3:b6bb:3029 with SMTP id hb9csp273409pzb; Sat, 23 Mar 2024 08:26:46 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXVFbDmgXKoJXeuCBkr6nwqAZZg0NMkEfWKdf6wwDluRbEXh0s41jq2W+lIJDK4TDh2iSCPJ7UM9br88WHJCqXxzJ3yq66KDGHEWw== X-Google-Smtp-Source: AGHT+IGeu8HLHSioB9K9U8+DlmRRQZrvuwHDPDlIWxLdIVPuWfvxi9xclyu71me53EnGnstjmXdJ X-Received: by 2002:a5d:47a7:0:b0:341:bd4c:f031 with SMTP id 7-20020a5d47a7000000b00341bd4cf031mr1831047wrb.4.1711207606201; Sat, 23 Mar 2024 08:26:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1711207606; cv=none; d=google.com; s=arc-20160816; b=XaHIzs+uwlBH7xqVxgUUelElH6qdIvl2Om3PBS4wZ8BIdyhFCtfN3epGRV0KFN3dVn h1lr0x4QYoxQwLO23Zyh8XAIHi89xZ8Hap9NXj30F6875uIl5/3ow/V6+jqR3Z3ES3Ao 2iYsWdjMcopg4R5yDubUOPJT4KpYR8+67IDewteFl7qceJwWAwwxnC0HU6ToI3UDbFI0 fbF93OjAb5XyudVAGeSNNpAwb79CAU+q5w+xiilaw6wEWqYCG8NGXT2dCsLV8r+Ol1WL dffx7pA121LUAsglTtQUJzN9xtWEuNaWo9ylUuv7TKTWWNfvXlMqgVofDPhPxLF02kMg ZZBw== 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=5ThohfdDw2SHPht+znmOrFxa6KdVXjbJEgOZ5dUPmPs=; fh=s+G8Ss4JbeMFkWPSp2LmIH/LXFyBlALRiww1j3FPjHY=; b=GIIc5z8b2Cyo8FTFWc9hi+X7b3LucIlR6oKL4L1HS/0WZI4nZ7KVkq7N3DezR0VgM3 kDybGrq79Rb0aAoY21e6qo9FIJdM/eW+RhEsNcYlrq4dSRigI6fAAlimRQnxdlXTpjun eVIOWyFh8KyfujOr+s8p3LwbPouVByc0pzxl61HN+LouS2ta0/M3rvvtNFiXw/RoV2ja N0MWWLurv1GHN1JrM7x6UTuEQHlhfM2xlSvwoKWp/WfAJnLkPk4lpDlz+S7G1a2iewIu N8SuZ2pNFdyhXv5kxNpiGso9CRzqbpnQ/IpsMU3DbV1M2WyQ1jmWrCf/FeBjbkv8Uf6q twgQ==; 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 cw2-20020a056402228200b0056bb595ce9fsi912621edb.478.2024.03.23.08.26.45; Sat, 23 Mar 2024 08:26:46 -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 C017568D3DC; Sat, 23 Mar 2024 17:26:42 +0200 (EET) 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 E0DBA68D29A for ; Sat, 23 Mar 2024 17:26:35 +0200 (EET) Received: from localhost (localhost [127.0.0.1]) by iq.passwd.hu (Postfix) with ESMTP id B4FB2E9F0B; Sat, 23 Mar 2024 16:26:35 +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 Pzbb48Sj2FD2; Sat, 23 Mar 2024 16:26:34 +0100 (CET) Received: from bluegene.passwd.hu (localhost [127.0.0.1]) by iq.passwd.hu (Postfix) with ESMTP id A3FB4E97E3; Sat, 23 Mar 2024 16:26:33 +0100 (CET) From: Marton Balint To: ffmpeg-devel@ffmpeg.org Date: Sat, 23 Mar 2024 16:26:25 +0100 Message-Id: <20240323152625.20980-1-cus@passwd.hu> X-Mailer: git-send-email 2.35.3 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH] avfilter/buffersrc: fix overriding unknown channel layouts with negotiated one 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: S/iYrhJCCOsr Fixes ffplay playback of unknown layouts, when SDL directly supports the audio format, such as: ffplay -f lavfi anullsrc=cl=2C,aformat=s16 Without the patch, "Channel layout change is not supported" errors are generated because buffersrc (unknown 2 channel) and buffersink (stereo) negotiated a stereo layout, but the stereo layout was never stored in the BufferSourceContext. This fixes a regression of 7251f909721a570726775acf61b2b9c28a950c76, but this is more of a regression of the avfilter channel layout conversion (1f96db959c1235bb7079d354e09914a0a2608f62). 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 ddcd403785..fcae4f8e69 100644 --- a/libavfilter/buffersrc.c +++ b/libavfilter/buffersrc.c @@ -507,7 +507,7 @@ static int config_props(AVFilterLink *link) } break; case AVMEDIA_TYPE_AUDIO: - if (!c->ch_layout.nb_channels) { + if (!c->ch_layout.nb_channels || c->ch_layout.order == AV_CHANNEL_ORDER_UNSPEC) { int ret = av_channel_layout_copy(&c->ch_layout, &link->ch_layout); if (ret < 0) return ret;