# HG changeset patch # User banan # Date 1207808117 0 # Node ID 1b90003d4d60694e4969befd73c4e5b841f7fc2a # Parent 5e7c69ebc0192b84c7a6b925ee338f2da30ea7e2 Only set channels in the stream if previously unset, fixes resampling crash on broken dca frames diff -r 5e7c69ebc019 -r 1b90003d4d60 dca.c --- a/dca.c Wed Apr 09 22:11:21 2008 +0000 +++ b/dca.c Thu Apr 10 06:15:17 2008 +0000 @@ -1173,7 +1173,14 @@ s->output = DCA_STEREO; } - avctx->channels = channels; + /* There is nothing that prevents a dts frame to change channel configuration + but FFmpeg doesn't support that so only set the channels if it is previously + unset. Ideally during the first probe for channels the crc should be checked + and only set avctx->channels when the crc is ok. Right now the decoder could + set the channels based on a broken first frame.*/ + if (!avctx->channels) + avctx->channels = channels; + if(*data_size < (s->sample_blocks / 8) * 256 * sizeof(int16_t) * channels) return -1; *data_size = 0;