From patchwork Thu Jan 12 22:23:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Almer X-Patchwork-Id: 39989 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:bb05:b0:b6:a58c:cef with SMTP id fc5csp16228pzb; Thu, 12 Jan 2023 14:24:02 -0800 (PST) X-Google-Smtp-Source: AMrXdXsearSrWfInG9HEtl1LLU1vMUaroSpVZ2eRgenle1mWwKVQ1A0NN3U5A9iakvgt4ONWP7dZ X-Received: by 2002:a05:6402:2a08:b0:46f:f36b:a471 with SMTP id ey8-20020a0564022a0800b0046ff36ba471mr86557031edb.22.1673562242455; Thu, 12 Jan 2023 14:24:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673562242; cv=none; d=google.com; s=arc-20160816; b=jCG6E0Yh5+IwSTW9IvMOwt5unVpms65CzJ6TAHdxHxPm+RXQ+gwaqzvuDvHEmbGYUC xuhovRwrlxmiUaB88YQoID+EDiNYt9ZtsLJuIS5FRnpweWAh5j1uBU6fyk4CHIhHe4Zi aFE642xzSY9H+tdZsI2Ly4NSMoBRhBmhPrPrMah1yL/143ItEx55uMvEASck1Ogb82dU Q9oQmVyGqRxUqbMZvb6q1w1D1fQQvn04kKqmrPEo5btT6+A/P4J2Pputt+2vmwf01xDW ambPx3ZVaQEzmYt9Kip296YbUhZg0SyEceDE9IUSd3mUUYQIzs/2nwLvZ2aANUv7TBsr hODg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:references:in-reply-to:message-id :date:to:from:dkim-signature:delivered-to; bh=J3pPjI/72zf8iRVthuDDHnrKoE/iSq9m6+5m9N4XLhg=; b=H09BU59iLS3TzGLHhkJoNTzlEyqJLngFz8PghxATjWKawnKgoYiRPQHK5ZpAFDmj4c i766m3Y7AyJ7wDD1znkOTA7IYwKqqZ3brBOGDzujSBh1Ji+EcTpUIplLjpgzdBhN0hIZ wGFm1BQ9A7drZTOR/k7UFxggmvyfJPeWMutPj3iXgSyNe9L2rKZfqoGAbKMgVTsAH+d/ sjiy2I8ISOWp6RISxjmpXjwFGSJUdg3Oq0aX1v8ErMz+qhGd2DXEsmB8mi2SY6FaMspE bRwEYOynr6SCXWUr15vM+21P6yGnYfB8QdVgbqmgJ8zmmkiJ77Ln2xBEh8JidSPdYFid drWw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20210112 header.b=iageRq9C; 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; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id y7-20020a056402440700b0048cb4ab0e23si23252040eda.295.2023.01.12.14.24.02; Thu, 12 Jan 2023 14:24:02 -0800 (PST) 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; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20210112 header.b=iageRq9C; 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; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 1FB9968BC61; Fri, 13 Jan 2023 00:23:49 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-oi1-f176.google.com (mail-oi1-f176.google.com [209.85.167.176]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 191B06807B3 for ; Fri, 13 Jan 2023 00:23:42 +0200 (EET) Received: by mail-oi1-f176.google.com with SMTP id p133so1116549oig.8 for ; Thu, 12 Jan 2023 14:23:42 -0800 (PST) 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:message-id :reply-to; bh=lcL5B23qmR5pIrHykig5UScdzIgMB4rNsZpo70wEZ1A=; b=iageRq9CrT2zeu/bq33ieRHzGR5wkHOhd+CAjIRJwSpbAjiezy3IRDsX1o+PBAUUCh 9gvR8jZPf5HKS48z/z4kxt0Qa0jIEMab0JHl4HwunkR4swnmhfAhBVvBkABK18GhQTT3 BRJFp+7/NcHai1K1Ac5CcYkw26dYgKNU/u3qsJwLt7TiQS2yibconzWfZHibhklPNSne vH83I+PLZjoWVv9zJ8+uAo2Jh3btxxPzDZyROvEN28OLXP4CZf/8yhSVM7aGX8+/74D8 5sZ4n8TT4uuHUe62y9xDSIMMQRdcAjJGv7NAItirLkMdfQdA8jwZQHTU4U6gGR8lPwy0 BrOg== 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:message-id:reply-to; bh=lcL5B23qmR5pIrHykig5UScdzIgMB4rNsZpo70wEZ1A=; b=y31He+CmKBP3CUrW32E0pQ1fYMcGCch7ctmi39obkIYUErtCGvYEBmMyGTYJSsy6FF u67nnUu1KbrnyRgslizafaDoc0Ahy+4GWEqghQXmsQUmh28k7Q+TFmWzvShYOnaeaYIq 5poF56s2T19kl8pqqNG78YWSSBc1GKDRzUtZFjuevc50wdZBjoNOiRVupL1n+jC0JbJ6 EMdslU5eJmKKgMRspYZJXBTXRY1mLsSr6LHCXFes6lIIAJLvQukwGWlka9i0/ACGXyD1 9pnXXdzlx1gfi0ZTxP/n9stWEDr1DjPQpVI405HjbHZMgiG9hu8OhSFZt2UlkySE/AHe nIaw== X-Gm-Message-State: AFqh2ko1pcrhSHG2zCsBaV7JbKDqhNP18o0K+kz7Q3NQhNJeFbm9zxSS KAcCPC3ptGjzetDd6m3Ks3Vwv/znV7E= X-Received: by 2002:a05:6808:1b24:b0:359:a465:42b1 with SMTP id bx36-20020a0568081b2400b00359a46542b1mr38629975oib.1.1673562219764; Thu, 12 Jan 2023 14:23:39 -0800 (PST) Received: from localhost.localdomain (host197.190-225-105.telecom.net.ar. [190.225.105.197]) by smtp.gmail.com with ESMTPSA id t13-20020a9d774d000000b00670523bf1cfsm9786983otl.47.2023.01.12.14.23.38 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Jan 2023 14:23:39 -0800 (PST) From: James Almer To: ffmpeg-devel@ffmpeg.org Date: Thu, 12 Jan 2023 19:23:26 -0300 Message-Id: <20230112222326.22018-2-jamrial@gmail.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230112222326.22018-1-jamrial@gmail.com> References: <20230112222326.22018-1-jamrial@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 2/2] avcodec/ac3dec: export downmix info side data only when no downmix is done by the decoder 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: Sy1z/wCy/xTp Same as with Matrix Encoding, add a check to ensure the decoder is not doing a downmix of its own. Signed-off-by: James Almer --- libavcodec/ac3dec.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/libavcodec/ac3dec.c b/libavcodec/ac3dec.c index 7a84f3c85d..722a1028b7 100644 --- a/libavcodec/ac3dec.c +++ b/libavcodec/ac3dec.c @@ -1824,7 +1824,11 @@ skip: return ret; /* AVDownmixInfo */ - if ((downmix_info = av_downmix_info_update_side_data(frame))) { + if (s->channel_mode == (s->output_mode & ~AC3_OUTPUT_LFEON)) { + downmix_info = av_downmix_info_update_side_data(frame); + if (!downmix_info) + return AVERROR(ENOMEM); + switch (s->preferred_downmix) { case AC3_DMIXMOD_LTRT: downmix_info->preferred_downmix_type = AV_DOWNMIX_TYPE_LTRT; @@ -1847,8 +1851,7 @@ skip: downmix_info->lfe_mix_level = gain_levels_lfe[s->lfe_mix_level]; else downmix_info->lfe_mix_level = 0.0; // -inf dB - } else - return AVERROR(ENOMEM); + } *got_frame_ptr = 1;