Commit f7987ce9 authored by Michael Niedermayer's avatar Michael Niedermayer

avcodec/alsdec: Fix decoding error with mono audio files

highest_decoded_channel is modified to serve as meant.
Reported-by: 's avatarNoboru Harada <noboru@ieee.org>

Regression since: a11aa5f3
Fixes: Sin48k16bit1ch.mp4
Reviewed-by: 's avatarThilo Borgmann <thilo.borgmann@mail.de>
Signed-off-by: 's avatarMichael Niedermayer <michael@niedermayer.cc>
parent ab04feda
...@@ -1632,7 +1632,7 @@ static int read_frame_data(ALSDecContext *ctx, unsigned int ra_frame) ...@@ -1632,7 +1632,7 @@ static int read_frame_data(ALSDecContext *ctx, unsigned int ra_frame)
AVCodecContext *avctx = ctx->avctx; AVCodecContext *avctx = ctx->avctx;
GetBitContext *gb = &ctx->gb; GetBitContext *gb = &ctx->gb;
unsigned int div_blocks[32]; ///< block sizes. unsigned int div_blocks[32]; ///< block sizes.
unsigned int c; int c;
unsigned int js_blocks[2]; unsigned int js_blocks[2];
uint32_t bs_info = 0; uint32_t bs_info = 0;
int ret; int ret;
...@@ -1810,14 +1810,17 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame_ptr, ...@@ -1810,14 +1810,17 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame_ptr,
else else
ctx->cur_frame_length = sconf->frame_length; ctx->cur_frame_length = sconf->frame_length;
ctx->highest_decoded_channel = 0; ctx->highest_decoded_channel = -1;
// decode the frame data // decode the frame data
if ((invalid_frame = read_frame_data(ctx, ra_frame)) < 0) if ((invalid_frame = read_frame_data(ctx, ra_frame)) < 0)
av_log(ctx->avctx, AV_LOG_WARNING, av_log(ctx->avctx, AV_LOG_WARNING,
"Reading frame data failed. Skipping RA unit.\n"); "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; return AVERROR_INVALIDDATA;
}
ctx->frame_id++; ctx->frame_id++;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment