Commit 29abb04e authored by Justin Ruggles's avatar Justin Ruggles

libspeexdec: If the channel count is not valid, decode as stereo.

When initialized as stereo, libspeex can decode either mono or stereo packets
and will output stereo.
parent 3b061c5e
...@@ -70,9 +70,11 @@ static av_cold int libspeex_decode_init(AVCodecContext *avctx) ...@@ -70,9 +70,11 @@ static av_cold int libspeex_decode_init(AVCodecContext *avctx)
} }
avctx->sample_rate = 8000 << spx_mode; avctx->sample_rate = 8000 << spx_mode;
if (avctx->channels > 2) { if (avctx->channels < 1 || avctx->channels > 2) {
av_log(avctx, AV_LOG_ERROR, "Only stereo and mono are supported.\n"); /* libspeex can handle mono or stereo if initialized as stereo */
return AVERROR(EINVAL); av_log(avctx, AV_LOG_ERROR, "Invalid channel count: %d.\n"
"Decoding as stereo.\n", avctx->channels);
avctx->channels = 2;
} }
speex_bits_init(&s->bits); speex_bits_init(&s->bits);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment