[FFmpeg-devel,2/2] avcodec/dcaenc: propagate errors
Commit Message
---
libavcodec/dcaenc.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
Comments
On 7/24/2017 9:24 AM, foo86 wrote:
> ---
> libavcodec/dcaenc.c | 12 ++++++------
> 1 file changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/libavcodec/dcaenc.c b/libavcodec/dcaenc.c
> index c1d72bfd16..fea67bf37c 100644
> --- a/libavcodec/dcaenc.c
> +++ b/libavcodec/dcaenc.c
> @@ -129,7 +129,7 @@ static int subband_bufer_alloc(DCAEncContext *c)
> (SUBBAND_SAMPLES + DCA_ADPCM_COEFFS),
> sizeof(int32_t));
> if (!bufer)
> - return -1;
> + return AVERROR(ENOMEM);
>
> /* we need a place for DCA_ADPCM_COEFF samples from previous frame
> * to calc prediction coefficients for each subband */
> @@ -153,10 +153,10 @@ static int encode_init(AVCodecContext *avctx)
> {
> DCAEncContext *c = avctx->priv_data;
> uint64_t layout = avctx->channel_layout;
> - int i, j, min_frame_bits;
> + int i, j, ret, min_frame_bits;
>
> - if (subband_bufer_alloc(c))
> - return AVERROR(ENOMEM);
> + if ((ret = subband_bufer_alloc(c)) < 0)
> + return ret;
>
> c->fullband_channels = c->channels = avctx->channels;
> c->lfe_channel = (avctx->channels == 3 || avctx->channels == 6);
> @@ -166,8 +166,8 @@ static int encode_init(AVCodecContext *avctx)
> c->worst_noise_ever = -2047;
> c->consumed_adpcm_bits = 0;
>
> - if (ff_dcaadpcm_init(&c->adpcm_ctx))
> - return AVERROR(ENOMEM);
> + if ((ret = ff_dcaadpcm_init(&c->adpcm_ctx)) < 0)
> + return ret;
>
> if (!layout) {
> av_log(avctx, AV_LOG_WARNING, "No channel layout specified. The "
LGTM.
@@ -129,7 +129,7 @@ static int subband_bufer_alloc(DCAEncContext *c)
(SUBBAND_SAMPLES + DCA_ADPCM_COEFFS),
sizeof(int32_t));
if (!bufer)
- return -1;
+ return AVERROR(ENOMEM);
/* we need a place for DCA_ADPCM_COEFF samples from previous frame
* to calc prediction coefficients for each subband */
@@ -153,10 +153,10 @@ static int encode_init(AVCodecContext *avctx)
{
DCAEncContext *c = avctx->priv_data;
uint64_t layout = avctx->channel_layout;
- int i, j, min_frame_bits;
+ int i, j, ret, min_frame_bits;
- if (subband_bufer_alloc(c))
- return AVERROR(ENOMEM);
+ if ((ret = subband_bufer_alloc(c)) < 0)
+ return ret;
c->fullband_channels = c->channels = avctx->channels;
c->lfe_channel = (avctx->channels == 3 || avctx->channels == 6);
@@ -166,8 +166,8 @@ static int encode_init(AVCodecContext *avctx)
c->worst_noise_ever = -2047;
c->consumed_adpcm_bits = 0;
- if (ff_dcaadpcm_init(&c->adpcm_ctx))
- return AVERROR(ENOMEM);
+ if ((ret = ff_dcaadpcm_init(&c->adpcm_ctx)) < 0)
+ return ret;
if (!layout) {
av_log(avctx, AV_LOG_WARNING, "No channel layout specified. The "