mirror of
https://github.com/xenia-project/FFmpeg.git
synced 2024-11-24 03:59:43 +00:00
sipr: fix the output data size check and only calculate it once.
This commit is contained in:
parent
12bd8532cf
commit
1b5a189f06
@ -509,7 +509,7 @@ static int sipr_decode_frame(AVCodecContext *avctx, void *datap,
|
||||
GetBitContext gb;
|
||||
float *data = datap;
|
||||
int subframe_size = ctx->mode == MODE_16k ? L_SUBFR_16k : SUBFR_SIZE;
|
||||
int i;
|
||||
int i, out_size;
|
||||
|
||||
ctx->avctx = avctx;
|
||||
if (avpkt->size < (mode_par->bits_per_frame >> 3)) {
|
||||
@ -520,7 +520,11 @@ static int sipr_decode_frame(AVCodecContext *avctx, void *datap,
|
||||
*data_size = 0;
|
||||
return -1;
|
||||
}
|
||||
if (*data_size < subframe_size * mode_par->subframe_count * sizeof(float)) {
|
||||
|
||||
out_size = mode_par->frames_per_packet * subframe_size *
|
||||
mode_par->subframe_count *
|
||||
av_get_bytes_per_sample(avctx->sample_fmt);
|
||||
if (*data_size < out_size) {
|
||||
av_log(avctx, AV_LOG_ERROR,
|
||||
"Error processing packet: output buffer (%d) too small\n",
|
||||
*data_size);
|
||||
@ -542,8 +546,7 @@ static int sipr_decode_frame(AVCodecContext *avctx, void *datap,
|
||||
data += subframe_size * mode_par->subframe_count;
|
||||
}
|
||||
|
||||
*data_size = mode_par->frames_per_packet * subframe_size *
|
||||
mode_par->subframe_count * sizeof(float);
|
||||
*data_size = out_size;
|
||||
|
||||
return mode_par->bits_per_frame >> 3;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user