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 <pkv.str...@gmail.com> 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 <pkv.str...@gmail.com> --- 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++) { -- 2.16.2.windows.1
_______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel