From 72b3e61281f32e0bd82126bceea61da2af4e90c9 Mon Sep 17 00:00:00 2001 From: Martin Pulec Date: Tue, 25 Apr 2023 15:09:45 +0200 Subject: [PATCH] lavc audio: if temporary buffer is filled, continue Returning doesn't make sense, because it would be impossible to drain the buffer since the call will end up exactly in the same place under similar circumstances (also with the same data_len). --- src/audio/codec/libavcodec.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/audio/codec/libavcodec.c b/src/audio/codec/libavcodec.c index d91ed4777..fc41aee02 100644 --- a/src/audio/codec/libavcodec.c +++ b/src/audio/codec/libavcodec.c @@ -3,7 +3,7 @@ * @author Martin Pulec */ /* - * Copyright (c) 2012-2021 CESNET z.s.p.o. + * Copyright (c) 2012-2023 CESNET z.s.p.o. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -432,20 +432,20 @@ static audio_channel *libavcodec_compress(void *state, audio_channel * channel) if (s->output_channel.bps == channel->bps) { if (s->tmp.data_len + channel->data_len > TMP_DATA_LEN) { log_msg(LOG_LEVEL_ERROR, MOD_NAME "Auxiliary buffer overflow!\n"); - return NULL; + } else { + int2float(s->tmp_data + s->tmp.data_len, channel->data, channel->data_len); + s->tmp.data_len += channel->data_len; } - int2float(s->tmp_data + s->tmp.data_len, channel->data, channel->data_len); - s->tmp.data_len += channel->data_len; } else { size_t data_len = channel->data_len / channel->bps * 4; resize_tmp_buffer(&s->tmp_buffer, &s->tmp_buffer_size, data_len); change_bps((char *) s->tmp_buffer, 4, channel->data, channel->bps, channel->data_len); if (s->tmp.data_len + data_len > TMP_DATA_LEN) { log_msg(LOG_LEVEL_ERROR, MOD_NAME "Auxiliary buffer overflow!\n"); - return NULL; + } else { + int2float(s->tmp_data + s->tmp.data_len, (char *) s->tmp_buffer, data_len); + s->tmp.data_len += data_len; } - int2float(s->tmp_data + s->tmp.data_len, (char *) s->tmp_buffer, data_len); - s->tmp.data_len += data_len; } } else { change_bps(s->tmp_data + s->tmp.data_len, s->output_channel.bps,