1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-04-24 17:12:34 +02:00

check for request_channels at codec init

Originally committed as revision 11415 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
Justin Ruggles 2008-01-05 15:22:53 +00:00
parent 6cd325c106
commit 95283c1701

View File

@ -312,6 +312,13 @@ static int ac3_decode_init(AVCodecContext *avctx)
s->mul_bias = 32767.0f; 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; return 0;
} }