aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2021-05-07 10:02:01 +0900
committerMichael Niedermayer <michael@niedermayer.cc>2021-06-18 20:53:56 +0200
commit0dc1c85644d82934e3ebe5153d40a99350dfa0fe (patch)
tree33b54a069f9ca36b29bfa67c5a23b32c4ce9ce06
parent5f0c0883c25f398ef23cfbbe82bdd13bb3e3c799 (diff)
downloadffmpeg-0dc1c85644d82934e3ebe5153d40a99350dfa0fe.tar.gz
avcodec/alsdec: Fix decoding error with mono audio files
highest_decoded_channel is modified to serve as meant. Reported-by: Noboru Harada <noboru@ieee.org> Regression since: a11aa5f3ed7ee4d2385a7b725d43f6070d790b4c Fixes: Sin48k16bit1ch.mp4 Reviewed-by: Thilo Borgmann <thilo.borgmann@mail.de> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> (cherry picked from commit f7987ce966aaad841d584988e00454c685bff36f) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavcodec/alsdec.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/libavcodec/alsdec.c b/libavcodec/alsdec.c
index a8c3433fa8..e736905a76 100644
--- a/libavcodec/alsdec.c
+++ b/libavcodec/alsdec.c
@@ -1632,7 +1632,7 @@ static int read_frame_data(ALSDecContext *ctx, unsigned int ra_frame)
AVCodecContext *avctx = ctx->avctx;
GetBitContext *gb = &ctx->gb;
unsigned int div_blocks[32]; ///< block sizes.
- unsigned int c;
+ int c;
unsigned int js_blocks[2];
uint32_t bs_info = 0;
int ret;
@@ -1810,14 +1810,17 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame_ptr,
else
ctx->cur_frame_length = sconf->frame_length;
- ctx->highest_decoded_channel = 0;
+ ctx->highest_decoded_channel = -1;
// decode the frame data
if ((invalid_frame = read_frame_data(ctx, ra_frame)) < 0)
av_log(ctx->avctx, AV_LOG_WARNING,
"Reading frame data failed. Skipping RA unit.\n");
- if (ctx->highest_decoded_channel == 0)
+ if (ctx->highest_decoded_channel == -1) {
+ av_log(ctx->avctx, AV_LOG_WARNING,
+ "No channel data decoded.\n");
return AVERROR_INVALIDDATA;
+ }
ctx->frame_id++;