diff options
author | Limin Wang <lance.lmwang@gmail.com> | 2020-05-29 22:05:46 +0800 |
---|---|---|
committer | Limin Wang <lance.lmwang@gmail.com> | 2020-06-13 06:59:19 +0800 |
commit | e6628ac8ffd3124e2d935cab565d9f76d895f43f (patch) | |
tree | 5fef69d3826ae0ea897e0fbb56e260957d207907 /libavcodec/ac3enc_template.c | |
parent | 861b20aa95c8e6369afd43aff6abd7285545ddde (diff) | |
download | ffmpeg-e6628ac8ffd3124e2d935cab565d9f76d895f43f.tar.gz |
avcodec/ac3enc_template: remove FF_ALLOC_ARRAY_OR_GOTO and gotos label
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
Diffstat (limited to 'libavcodec/ac3enc_template.c')
-rw-r--r-- | libavcodec/ac3enc_template.c | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/libavcodec/ac3enc_template.c b/libavcodec/ac3enc_template.c index be659872f7..985b35e5b6 100644 --- a/libavcodec/ac3enc_template.c +++ b/libavcodec/ac3enc_template.c @@ -41,19 +41,16 @@ int AC3_NAME(allocate_sample_buffers)(AC3EncodeContext *s) { int ch; - FF_ALLOC_OR_GOTO(s->avctx, s->windowed_samples, AC3_WINDOW_SIZE * - sizeof(*s->windowed_samples), alloc_fail); - FF_ALLOC_ARRAY_OR_GOTO(s->avctx, s->planar_samples, s->channels, sizeof(*s->planar_samples), - alloc_fail); + if (!FF_ALLOC_TYPED_ARRAY(s->windowed_samples, AC3_WINDOW_SIZE) || + !FF_ALLOC_TYPED_ARRAY(s->planar_samples, s->channels)) + return AVERROR(ENOMEM); + for (ch = 0; ch < s->channels; ch++) { - FF_ALLOCZ_OR_GOTO(s->avctx, s->planar_samples[ch], - (AC3_FRAME_SIZE+AC3_BLOCK_SIZE) * sizeof(**s->planar_samples), - alloc_fail); + if (!(s->planar_samples[ch] = av_mallocz((AC3_FRAME_SIZE + AC3_BLOCK_SIZE) * + sizeof(**s->planar_samples)))) + return AVERROR(ENOMEM); } - return 0; -alloc_fail: - return AVERROR(ENOMEM); } |