diff options
author | Paul B Mahol <onemda@gmail.com> | 2021-09-04 14:42:21 +0200 |
---|---|---|
committer | Paul B Mahol <onemda@gmail.com> | 2021-09-04 14:46:40 +0200 |
commit | 19b52a7cc49948baee561331130fb0904cf83b1e (patch) | |
tree | 879c82ba8809edc1e25420d07165682e6ea7b59e /libavcodec/mlpenc.c | |
parent | 30c213fa6c31b1fc30d88aecf6cdca6d4d7bac54 (diff) | |
download | ffmpeg-19b52a7cc49948baee561331130fb0904cf83b1e.tar.gz |
avcodec/mlpenc: remove log messages when allocation fails at init
Diffstat (limited to 'libavcodec/mlpenc.c')
-rw-r--r-- | libavcodec/mlpenc.c | 30 |
1 files changed, 6 insertions, 24 deletions
diff --git a/libavcodec/mlpenc.c b/libavcodec/mlpenc.c index 9c1575fb27..91cdee2d1b 100644 --- a/libavcodec/mlpenc.c +++ b/libavcodec/mlpenc.c @@ -598,26 +598,17 @@ static av_cold int mlp_encode_init(AVCodecContext *avctx) size = avctx->frame_size * ctx->max_restart_interval; ctx->lpc_sample_buffer = av_calloc(size, sizeof(*ctx->lpc_sample_buffer)); - if (!ctx->lpc_sample_buffer) { - av_log(avctx, AV_LOG_ERROR, - "Not enough memory for buffering samples.\n"); + if (!ctx->lpc_sample_buffer) return AVERROR(ENOMEM); - } size = ctx->one_sample_buffer_size * ctx->max_restart_interval; ctx->major_scratch_buffer = av_calloc(size, sizeof(*ctx->major_scratch_buffer)); - if (!ctx->major_scratch_buffer) { - av_log(avctx, AV_LOG_ERROR, - "Not enough memory for buffering samples.\n"); + if (!ctx->major_scratch_buffer) return AVERROR(ENOMEM); - } ctx->major_inout_buffer = av_calloc(size, sizeof(*ctx->major_inout_buffer)); - if (!ctx->major_inout_buffer) { - av_log(avctx, AV_LOG_ERROR, - "Not enough memory for buffering samples.\n"); + if (!ctx->major_inout_buffer) return AVERROR(ENOMEM); - } ctx->num_substreams = 1; // TODO: change this after adding multi-channel support for TrueHD @@ -705,19 +696,13 @@ static av_cold int mlp_encode_init(AVCodecContext *avctx) ctx->sequence_size = sum; size = ctx->restart_intervals * ctx->sequence_size * ctx->avctx->channels; ctx->channel_params = av_calloc(size, sizeof(*ctx->channel_params)); - if (!ctx->channel_params) { - av_log(avctx, AV_LOG_ERROR, - "Not enough memory for analysis context.\n"); + if (!ctx->channel_params) return AVERROR(ENOMEM); - } size = ctx->restart_intervals * ctx->sequence_size * ctx->num_substreams; ctx->decoding_params = av_calloc(size, sizeof(*ctx->decoding_params)); - if (!ctx->decoding_params) { - av_log(avctx, AV_LOG_ERROR, - "Not enough memory for analysis context.\n"); + if (!ctx->decoding_params) return AVERROR(ENOMEM); - } for (substr = 0; substr < ctx->num_substreams; substr++) { RestartHeader *rh = &ctx->restart_header [substr]; @@ -732,11 +717,8 @@ static av_cold int mlp_encode_init(AVCodecContext *avctx) } if ((ret = ff_lpc_init(&ctx->lpc_ctx, ctx->number_of_samples, - MLP_MAX_LPC_ORDER, FF_LPC_TYPE_LEVINSON)) < 0) { - av_log(avctx, AV_LOG_ERROR, - "Not enough memory for LPC context.\n"); + MLP_MAX_LPC_ORDER, FF_LPC_TYPE_LEVINSON)) < 0) return ret; - } for (int i = 0; i < NUM_FILTERS; i++) { ctx->filter_state_buffer[i] = av_calloc(avctx->frame_size * ctx->max_restart_interval, |