Commit 0f97c501 authored by Justin Ruggles's avatar Justin Ruggles

shorten: only calculate output size when returning decoded samples, otherwise

just set data_size to zero.
parent e9e37f2d
...@@ -385,6 +385,7 @@ static int shorten_decode_frame(AVCodecContext *avctx, ...@@ -385,6 +385,7 @@ static int shorten_decode_frame(AVCodecContext *avctx,
int ret; int ret;
if ((ret = read_header(s)) < 0) if ((ret = read_header(s)) < 0)
return ret; return ret;
*data_size = 0;
} }
else else
{ {
...@@ -423,8 +424,9 @@ static int shorten_decode_frame(AVCodecContext *avctx, ...@@ -423,8 +424,9 @@ static int shorten_decode_frame(AVCodecContext *avctx,
break; break;
} }
case FN_QUIT: case FN_QUIT:
goto frame_done; break;
} }
*data_size = 0;
} else { } else {
/* process audio command */ /* process audio command */
int residual_size = 0; int residual_size = 0;
...@@ -510,12 +512,12 @@ static int shorten_decode_frame(AVCodecContext *avctx, ...@@ -510,12 +512,12 @@ static int shorten_decode_frame(AVCodecContext *avctx,
if (s->cur_chan == s->channels) { if (s->cur_chan == s->channels) {
samples = interleave_buffer(samples, s->channels, s->blocksize, s->decoded); samples = interleave_buffer(samples, s->channels, s->blocksize, s->decoded);
s->cur_chan = 0; s->cur_chan = 0;
goto frame_done; *data_size = (int8_t *)samples - (int8_t *)data;
} else {
*data_size = 0;
} }
} }
} }
frame_done:
*data_size = (int8_t *)samples - (int8_t *)data;
// s->last_blocksize = s->blocksize; // s->last_blocksize = s->blocksize;
s->bitindex = get_bits_count(&s->gb) - 8*((get_bits_count(&s->gb))/8); s->bitindex = get_bits_count(&s->gb) - 8*((get_bits_count(&s->gb))/8);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment