From patchwork Mon Oct 22 00:11:01 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "pkv.stream" X-Patchwork-Id: 10742 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id 162584493C9 for ; Mon, 22 Oct 2018 03:11:05 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 6838C68A66A; Mon, 22 Oct 2018 03:10:46 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wr1-f68.google.com (mail-wr1-f68.google.com [209.85.221.68]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 736C568A558 for ; Mon, 22 Oct 2018 03:10:40 +0300 (EEST) Received: by mail-wr1-f68.google.com with SMTP id i4-v6so4204634wrr.13 for ; Sun, 21 Oct 2018 17:11:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=to:from:subject:message-id:date:user-agent:mime-version :content-language; bh=2cF8prx0p1eDRSVta996xB9cZASvCmsAJaO3y8zwv9c=; b=L9jL4eT+cnrh7zEbLa96Wuf4AetzN8fgp2zB/TVxPmqLP+XS5a15GW/60wzDVOjlbw sHxVIy6b/BRPik2yz9gw1kH+VHxu1BvokEfWPqL17YBD2jAU6yyE93YgFPIkreja/Mrt N1w45B6SKZkD32n0ezPUfiI9LDlDDv1ZBnm5Oujod8KKO/FvoMKVORU5XbEabxAYv0me SxSa704jWAip73PqVYcdPps3/MbXecahTUgfZNex9sy2+aUCTSaKtnS41Obkbc5dHUqJ dfc+GU5+n0fgBsbSEqJ/Xp5IIxDzBh888EmNouUMFK57n0JMeRafN7MzicqfpgdFmj+8 wS5Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:to:from:subject:message-id:date:user-agent :mime-version:content-language; bh=2cF8prx0p1eDRSVta996xB9cZASvCmsAJaO3y8zwv9c=; b=uZwtng5JuoFJz8BDhXTa7+wfSpermQfwNUPLYCoDybp0H2c0W3vT8ztc3LawGSvd+m 2P66ocAMA6Q3Bnu7fhHegqzLJdREUEp8Qt/ZFBy4X93hRFgxU7+iOF0cDHQZrJHzFbVJ zxKlSwy/zMf9McabkwE4Q0ak8mQkItDe5hUrgoYf/DFqKax8zoQ6I0YNT48OXNe+fhuI rqK6OJn8jEq1yFg4ffXkItCG4kDR4lvK2W2v/Gp/LsSII7F9zx/CshnjdRAGTf1V3oX9 NNlvSClDmbtxxqTaDcOlpLHYjar88sVgMqmJ3Pm/Z6ZB/NSAZPJWP/BslzS76Sgpa8yG ny0A== X-Gm-Message-State: AGRZ1gKjLcwJQus26jOouWmJoCSoSosq7un23n+aNMRArmNBSX3UV7/+ KxRrmwiTiXG9dHV5JkNYgFAAMv3i X-Google-Smtp-Source: AJdET5fjHjVQI7tWpbDdPajZxVI6MsrtzTTxwBBVyieKZGGYwDhJVkzaGsT3w5Pp32eKaPEgMVgZ2g== X-Received: by 2002:adf:9246:: with SMTP id 64-v6mr11358136wrj.130.1540167067227; Sun, 21 Oct 2018 17:11:07 -0700 (PDT) Received: from [192.168.0.101] (176-159-7-188.abo.bbox.fr. [176.159.7.188]) by smtp.googlemail.com with ESMTPSA id v76-v6sm17629214wmd.32.2018.10.21.17.11.06 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 21 Oct 2018 17:11:06 -0700 (PDT) To: ffmpeg-devel@ffmpeg.org From: "pkv.stream" Message-ID: <46f5bafa-e262-0af1-8a48-9bd4d509df9a@gmail.com> Date: Mon, 22 Oct 2018 02:11:01 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1 MIME-Version: 1.0 Content-Language: fr Subject: [FFmpeg-devel] [PATCH] avcodec/aacenc: Treat single channel as mono and bypass PCE X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 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" A single channel is normally interpreted as mono. However if channelsplit filter is used, the individual channels are given their channel mask (ex: FL) as channel layout. This can cause issue with the native encoder since PCE was added because only channel layouts in spec will be encoded without PCE. (they are listed in aac_normal_chan_layouts[]). To avoid that, the layout for a single channel is set to mono and therefore its encoding is achieved without PCE. This fixes ticket 7266. From 8c4932f25f7dced818721f292fc4ba8eb26d799a Mon Sep 17 00:00:00 2001 From: pkviet Date: Mon, 22 Oct 2018 01:57:36 +0200 Subject: [PATCH] avcodec/aacenc: Treat single channel as mono and bypass PCE A single channel is normally interpreted as mono. However if channelsplit filter is used, the individual channels are given their channel mask (ex: FL) as channel layout. This can cause issue with the native encoder since PCE was added because only channel layouts in spec will be encoded without PCE. (they are listed in aac_normal_chan_layouts[]). To avoid that, the layout for a single channel is set to mono and therefore its encoding is achieved without PCE. This fixes ticket 7266. Signed-off-by: pkviet --- libavcodec/aacenc.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libavcodec/aacenc.c b/libavcodec/aacenc.c index 4d0abb107f..1ee12ee669 100644 --- a/libavcodec/aacenc.c +++ b/libavcodec/aacenc.c @@ -972,6 +972,8 @@ static av_cold int aac_encode_init(AVCodecContext *avctx) /* Channel map and unspecified bitrate guessing */ s->channels = avctx->channels; + if (s->channels == 1) + avctx->channel_layout = AV_CH_LAYOUT_MONO; s->needs_pce = 1; for (i = 0; i < FF_ARRAY_ELEMS(aac_normal_chan_layouts); i++) {