diff options
author | Reimar Döffinger <Reimar.Doeffinger@gmx.de> | 2011-04-30 23:19:04 +0200 |
---|---|---|
committer | Reimar Döffinger <Reimar.Doeffinger@gmx.de> | 2011-05-01 19:13:01 +0200 |
commit | 636ee66f1c188de9d92cb794f8765390d8177c42 (patch) | |
tree | cafa7581984e703e786453efe855297d3fc93d87 /libavcodec/dca.c | |
parent | 35fe66abbc9a6d151cedbc8d0261dc007aa71fe2 (diff) | |
download | ffmpeg-streaming-636ee66f1c188de9d92cb794f8765390d8177c42.zip ffmpeg-streaming-636ee66f1c188de9d92cb794f8765390d8177c42.tar.gz |
Fix data_size handling for AC3 and dca decoders.
They use now code identical to the AAC decoder.
The AC3 decoder previously did not check the data_size and
the dca decoder checked against and set wrong values for float.
Diffstat (limited to 'libavcodec/dca.c')
-rw-r--r-- | libavcodec/dca.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/libavcodec/dca.c b/libavcodec/dca.c index 1e26eed..03bf7f7 100644 --- a/libavcodec/dca.c +++ b/libavcodec/dca.c @@ -1622,6 +1622,7 @@ static int dca_decode_frame(AVCodecContext * avctx, { const uint8_t *buf = avpkt->data; int buf_size = avpkt->size; + int data_size_tmp; int lfe_samples; int num_core_channels = 0; @@ -1813,10 +1814,11 @@ static int dca_decode_frame(AVCodecContext * avctx, return -1; } - /* ffdshow custom code */ - if (*data_size < (s->sample_blocks / 8) * 256 * sizeof(samples[0]) * channels) + data_size_tmp = (s->sample_blocks / 8) * 256 * channels; + data_size_tmp *= avctx->sample_fmt == AV_SAMPLE_FMT_FLT ? sizeof(*samples_flt) : sizeof(*samples); + if (*data_size < data_size_tmp) return -1; - *data_size = 256 / 8 * s->sample_blocks * sizeof(samples[0]) * channels; + *data_size = data_size_tmp; /* filter to get final output */ for (i = 0; i < (s->sample_blocks / 8); i++) { |