You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-08-15 14:13:16 +02:00
avcodec/mlpenc: remove log messages when allocation fails at init
This commit is contained in:
@@ -598,26 +598,17 @@ static av_cold int mlp_encode_init(AVCodecContext *avctx)
|
|||||||
|
|
||||||
size = avctx->frame_size * ctx->max_restart_interval;
|
size = avctx->frame_size * ctx->max_restart_interval;
|
||||||
ctx->lpc_sample_buffer = av_calloc(size, sizeof(*ctx->lpc_sample_buffer));
|
ctx->lpc_sample_buffer = av_calloc(size, sizeof(*ctx->lpc_sample_buffer));
|
||||||
if (!ctx->lpc_sample_buffer) {
|
if (!ctx->lpc_sample_buffer)
|
||||||
av_log(avctx, AV_LOG_ERROR,
|
|
||||||
"Not enough memory for buffering samples.\n");
|
|
||||||
return AVERROR(ENOMEM);
|
return AVERROR(ENOMEM);
|
||||||
}
|
|
||||||
|
|
||||||
size = ctx->one_sample_buffer_size * ctx->max_restart_interval;
|
size = ctx->one_sample_buffer_size * ctx->max_restart_interval;
|
||||||
ctx->major_scratch_buffer = av_calloc(size, sizeof(*ctx->major_scratch_buffer));
|
ctx->major_scratch_buffer = av_calloc(size, sizeof(*ctx->major_scratch_buffer));
|
||||||
if (!ctx->major_scratch_buffer) {
|
if (!ctx->major_scratch_buffer)
|
||||||
av_log(avctx, AV_LOG_ERROR,
|
|
||||||
"Not enough memory for buffering samples.\n");
|
|
||||||
return AVERROR(ENOMEM);
|
return AVERROR(ENOMEM);
|
||||||
}
|
|
||||||
|
|
||||||
ctx->major_inout_buffer = av_calloc(size, sizeof(*ctx->major_inout_buffer));
|
ctx->major_inout_buffer = av_calloc(size, sizeof(*ctx->major_inout_buffer));
|
||||||
if (!ctx->major_inout_buffer) {
|
if (!ctx->major_inout_buffer)
|
||||||
av_log(avctx, AV_LOG_ERROR,
|
|
||||||
"Not enough memory for buffering samples.\n");
|
|
||||||
return AVERROR(ENOMEM);
|
return AVERROR(ENOMEM);
|
||||||
}
|
|
||||||
|
|
||||||
ctx->num_substreams = 1; // TODO: change this after adding multi-channel support for TrueHD
|
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;
|
ctx->sequence_size = sum;
|
||||||
size = ctx->restart_intervals * ctx->sequence_size * ctx->avctx->channels;
|
size = ctx->restart_intervals * ctx->sequence_size * ctx->avctx->channels;
|
||||||
ctx->channel_params = av_calloc(size, sizeof(*ctx->channel_params));
|
ctx->channel_params = av_calloc(size, sizeof(*ctx->channel_params));
|
||||||
if (!ctx->channel_params) {
|
if (!ctx->channel_params)
|
||||||
av_log(avctx, AV_LOG_ERROR,
|
|
||||||
"Not enough memory for analysis context.\n");
|
|
||||||
return AVERROR(ENOMEM);
|
return AVERROR(ENOMEM);
|
||||||
}
|
|
||||||
|
|
||||||
size = ctx->restart_intervals * ctx->sequence_size * ctx->num_substreams;
|
size = ctx->restart_intervals * ctx->sequence_size * ctx->num_substreams;
|
||||||
ctx->decoding_params = av_calloc(size, sizeof(*ctx->decoding_params));
|
ctx->decoding_params = av_calloc(size, sizeof(*ctx->decoding_params));
|
||||||
if (!ctx->decoding_params) {
|
if (!ctx->decoding_params)
|
||||||
av_log(avctx, AV_LOG_ERROR,
|
|
||||||
"Not enough memory for analysis context.\n");
|
|
||||||
return AVERROR(ENOMEM);
|
return AVERROR(ENOMEM);
|
||||||
}
|
|
||||||
|
|
||||||
for (substr = 0; substr < ctx->num_substreams; substr++) {
|
for (substr = 0; substr < ctx->num_substreams; substr++) {
|
||||||
RestartHeader *rh = &ctx->restart_header [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,
|
if ((ret = ff_lpc_init(&ctx->lpc_ctx, ctx->number_of_samples,
|
||||||
MLP_MAX_LPC_ORDER, FF_LPC_TYPE_LEVINSON)) < 0) {
|
MLP_MAX_LPC_ORDER, FF_LPC_TYPE_LEVINSON)) < 0)
|
||||||
av_log(avctx, AV_LOG_ERROR,
|
|
||||||
"Not enough memory for LPC context.\n");
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
|
||||||
|
|
||||||
for (int i = 0; i < NUM_FILTERS; i++) {
|
for (int i = 0; i < NUM_FILTERS; i++) {
|
||||||
ctx->filter_state_buffer[i] = av_calloc(avctx->frame_size * ctx->max_restart_interval,
|
ctx->filter_state_buffer[i] = av_calloc(avctx->frame_size * ctx->max_restart_interval,
|
||||||
|
Reference in New Issue
Block a user