diff options
author | Daniel Kang <daniel.d.kang@gmail.com> | 2011-01-18 11:30:33 -0500 |
---|---|---|
committer | Justin Ruggles <justin.ruggles@gmail.com> | 2011-01-18 11:30:33 -0500 |
commit | 1360f07e220ee0904de8c7fec9bc29f9be49bcd4 (patch) | |
tree | 9f2ba8d8d7befa2e823264cf81de2e35842b9d31 /libavcodec/dca.c | |
parent | 59e2118e973e73b760d11776be864b4b630098b6 (diff) | |
download | ffmpeg-1360f07e220ee0904de8c7fec9bc29f9be49bcd4.tar.gz |
Add check for changing number of channels in DCA.
Fixes issue 2505.
Diffstat (limited to 'libavcodec/dca.c')
-rw-r--r-- | libavcodec/dca.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/libavcodec/dca.c b/libavcodec/dca.c index eda89aa0f3..e224785a1e 100644 --- a/libavcodec/dca.c +++ b/libavcodec/dca.c @@ -273,6 +273,7 @@ typedef struct { /* Primary audio coding header */ int subframes; ///< number of subframes + int is_channels_set; ///< check for if the channel number is already set int total_channels; ///< number of channels including extensions int prim_channels; ///< number of primary audio channels int subband_activity[DCA_PRIM_CHANNELS_MAX]; ///< subband activity count @@ -1774,7 +1775,15 @@ static int dca_decode_frame(AVCodecContext * avctx, 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 (s->is_channels_set == 0) { + s->is_channels_set = 1; avctx->channels = channels; + } + if (avctx->channels != channels) { + av_log(avctx, AV_LOG_ERROR, "DCA decoder does not support number of " + "channels changing in stream. Skipping frame.\n"); + return -1; + } if (*data_size < (s->sample_blocks / 8) * 256 * sizeof(int16_t) * channels) return -1; |