diff options
author | Olivier CrĂȘte <olivier.crete@collabora.com> | 2021-08-24 09:43:42 -0400 |
---|---|---|
committer | James Almer <jamrial@gmail.com> | 2021-09-21 23:20:29 -0300 |
commit | 6f24f503efbf8800267c574d8578aa18476172e3 (patch) | |
tree | 37d7f48faae7b65d85ccabafcd74c2ca59863a93 /libavcodec | |
parent | df288deb9bf5e4c85b6447dbfe5f2af92cb62943 (diff) | |
download | ffmpeg-6f24f503efbf8800267c574d8578aa18476172e3.tar.gz |
avcodec/wma: Return specific error code
This way, the calling function can just forward it instead of
making it up.
Signed-off-by: Olivier CrĂȘte <olivier.crete@collabora.com>
(cherry picked from commit 521388edb7d3c176b444bbc3a42723cbafab2d55)
Diffstat (limited to 'libavcodec')
-rw-r--r-- | libavcodec/wma.c | 4 | ||||
-rw-r--r-- | libavcodec/wmaprodec.c | 13 |
2 files changed, 10 insertions, 7 deletions
diff --git a/libavcodec/wma.c b/libavcodec/wma.c index cfa5fa3355..a979a112bd 100644 --- a/libavcodec/wma.c +++ b/libavcodec/wma.c @@ -457,7 +457,7 @@ int ff_wma_run_level_decode(AVCodecContext *avctx, GetBitContext *gb, if (get_bits1(gb)) { av_log(avctx, AV_LOG_ERROR, "broken escape sequence\n"); - return -1; + return AVERROR_INVALIDDATA; } else offset += get_bits(gb, frame_len_bits) + 4; } else @@ -475,7 +475,7 @@ int ff_wma_run_level_decode(AVCodecContext *avctx, GetBitContext *gb, offset, num_coefs ); - return -1; + return AVERROR_INVALIDDATA; } return 0; diff --git a/libavcodec/wmaprodec.c b/libavcodec/wmaprodec.c index 8024ce1611..7c3044b0b0 100644 --- a/libavcodec/wmaprodec.c +++ b/libavcodec/wmaprodec.c @@ -985,13 +985,16 @@ static int decode_coeffs(WMAProDecodeCtx *s, int c) /** decode run level coded coefficients */ if (cur_coeff < s->subframe_len) { + int ret; + memset(&ci->coeffs[cur_coeff], 0, sizeof(*ci->coeffs) * (s->subframe_len - cur_coeff)); - if (ff_wma_run_level_decode(s->avctx, &s->gb, vlc, - level, run, 1, ci->coeffs, - cur_coeff, s->subframe_len, - s->subframe_len, s->esc_len, 0)) - return AVERROR_INVALIDDATA; + ret = ff_wma_run_level_decode(s->avctx, &s->gb, vlc, + level, run, 1, ci->coeffs, + cur_coeff, s->subframe_len, + s->subframe_len, s->esc_len, 0); + if (ret < 0) + return ret; } return 0; |