diff --git a/libavcodec/ac3dec.c b/libavcodec/ac3dec.c index 5c09a2e40deb5b09d632761680108bfda130e0ee..314eaa06240aa81f9acc9fdda540b352bf2e5555 100644 --- a/libavcodec/ac3dec.c +++ b/libavcodec/ac3dec.c @@ -312,6 +312,13 @@ static int ac3_decode_init(AVCodecContext *avctx) s->mul_bias = 32767.0f; } + /* allow downmixing to stereo or mono */ + if (avctx->channels > 0 && avctx->request_channels > 0 && + avctx->request_channels < avctx->channels && + avctx->request_channels <= 2) { + avctx->channels = avctx->request_channels; + } + return 0; }