avcodec/alac: remove FF_ALLOC_OR_GOTO and gotos label

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
This commit is contained in:
Limin Wang 2020-05-29 22:38:31 +08:00
parent 67de2d6a8c
commit bdbe3f06a2
1 changed files with 7 additions and 8 deletions

View File

@ -489,6 +489,7 @@ static int allocate_buffers(ALACContext *alac)
{ {
int ch; int ch;
unsigned buf_size = alac->max_samples_per_frame * sizeof(int32_t); unsigned buf_size = alac->max_samples_per_frame * sizeof(int32_t);
unsigned extra_buf_size = buf_size + AV_INPUT_BUFFER_PADDING_SIZE;
for (ch = 0; ch < 2; ch++) { for (ch = 0; ch < 2; ch++) {
alac->predict_error_buffer[ch] = NULL; alac->predict_error_buffer[ch] = NULL;
@ -497,21 +498,19 @@ static int allocate_buffers(ALACContext *alac)
} }
for (ch = 0; ch < FFMIN(alac->channels, 2); ch++) { for (ch = 0; ch < FFMIN(alac->channels, 2); ch++) {
FF_ALLOC_OR_GOTO(alac->avctx, alac->predict_error_buffer[ch], if (!(alac->predict_error_buffer[ch] = av_malloc(buf_size)))
buf_size, buf_alloc_fail); return AVERROR(ENOMEM);
alac->direct_output = alac->sample_size > 16; alac->direct_output = alac->sample_size > 16;
if (!alac->direct_output) { if (!alac->direct_output) {
FF_ALLOC_OR_GOTO(alac->avctx, alac->output_samples_buffer[ch], if (!(alac->output_samples_buffer[ch] = av_malloc(extra_buf_size)))
buf_size + AV_INPUT_BUFFER_PADDING_SIZE, buf_alloc_fail); return AVERROR(ENOMEM);
} }
FF_ALLOC_OR_GOTO(alac->avctx, alac->extra_bits_buffer[ch], if (!(alac->extra_bits_buffer[ch] = av_malloc(extra_buf_size)))
buf_size + AV_INPUT_BUFFER_PADDING_SIZE, buf_alloc_fail); return AVERROR(ENOMEM);
} }
return 0; return 0;
buf_alloc_fail:
return AVERROR(ENOMEM);
} }
static int alac_set_info(ALACContext *alac) static int alac_set_info(ALACContext *alac)