changeset 7725:2cddcef36256 libavcodec

dca: Set data_size outside block loop.
author andoma
date Fri, 29 Aug 2008 10:12:44 +0000
parents ea9aa2aa4caa
children 6209e2477cff
files dca.c
diffstat 1 files changed, 1 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/dca.c	Fri Aug 29 10:09:51 2008 +0000
+++ b/dca.c	Fri Aug 29 10:12:44 2008 +0000
@@ -1183,12 +1183,11 @@
 
     if(*data_size < (s->sample_blocks / 8) * 256 * sizeof(int16_t) * channels)
         return -1;
-    *data_size = 0;
+    *data_size = 256 / 8 * s->sample_blocks * sizeof(int16_t) * channels;
     for (i = 0; i < (s->sample_blocks / 8); i++) {
         dca_decode_block(s);
         s->dsp.float_to_int16_interleave(samples, s->samples_chanptr, 256, channels);
         samples += 256 * channels;
-        *data_size += 256 * sizeof(int16_t) * channels;
     }
 
     return buf_size;