aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenjamin Larsson <banan@ludd.ltu.se>2008-04-10 06:15:17 +0000
committerBenjamin Larsson <banan@ludd.ltu.se>2008-04-10 06:15:17 +0000
commit4a24837e07c4782658d1475b77506bccc3d0b5e2 (patch)
treed2a40c4dd18a06f06567e272b00cbb538832cfc9
parentfd31550d239c4aa09075ee1778222596e6637144 (diff)
downloadffmpeg-4a24837e07c4782658d1475b77506bccc3d0b5e2.tar.gz
Only set channels in the stream if previously unset, fixes resampling crash on broken dca frames
Originally committed as revision 12780 to svn://svn.ffmpeg.org/ffmpeg/trunk
-rw-r--r--libavcodec/dca.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/libavcodec/dca.c b/libavcodec/dca.c
index 98fa1f66f9..ea0462451c 100644
--- a/libavcodec/dca.c
+++ b/libavcodec/dca.c
@@ -1173,7 +1173,14 @@ static int dca_decode_frame(AVCodecContext * avctx,
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;