[FFmpeg-devel] [PATCH] lavc/ac3: set channel_layout when downmixing.

Nicolas George nicolas.george at normalesup.org
Wed Aug 7 17:21:52 CEST 2013


Fix a "Guessed Channel Layout" warning.

Signed-off-by: Nicolas George <nicolas.george at normalesup.org>
---
 libavcodec/aac_ac3_parser.c |    1 +
 libavcodec/ac3dec.c         |    1 +
 2 files changed, 2 insertions(+)


FATE passes.
Note that this instance of av_get_default_channel_layout is only called with
channels = 1 or 2.


diff --git a/libavcodec/aac_ac3_parser.c b/libavcodec/aac_ac3_parser.c
index 6f1e188..ec52fb7 100644
--- a/libavcodec/aac_ac3_parser.c
+++ b/libavcodec/aac_ac3_parser.c
@@ -90,6 +90,7 @@ get_next:
                 (avctx->codec_id == AV_CODEC_ID_AC3 ||
                  avctx->codec_id == AV_CODEC_ID_EAC3)))) {
             avctx->channels = avctx->request_channels;
+            avctx->channel_layout = av_get_default_channel_layout(avctx->channels);
         } else {
             avctx->channels = s->channels;
             avctx->channel_layout = s->channel_layout;
diff --git a/libavcodec/ac3dec.c b/libavcodec/ac3dec.c
index fc15a41..da7a273 100644
--- a/libavcodec/ac3dec.c
+++ b/libavcodec/ac3dec.c
@@ -182,6 +182,7 @@ static av_cold int ac3_decode_init(AVCodecContext *avctx)
             avctx->request_channels < avctx->channels &&
             avctx->request_channels <= 2) {
         avctx->channels = avctx->request_channels;
+        avctx->channel_layout = av_get_default_channel_layout(avctx->channels);
     }
     s->downmixed = 1;
 
-- 
1.7.10.4



More information about the ffmpeg-devel mailing list