Commit d4211c47 authored by Paul B Mahol's avatar Paul B Mahol

alsdec: change channel sorting so it match reference implementation

Read channel source instead of channel target for channel sorting.
Signed-off-by: 's avatarPaul B Mahol <onemda@gmail.com>
parent 01405663
...@@ -356,12 +356,15 @@ static av_cold int read_specific_config(ALSDecContext *ctx) ...@@ -356,12 +356,15 @@ static av_cold int read_specific_config(ALSDecContext *ctx)
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
for (i = 0; i < avctx->channels; i++) { for (i = 0; i < avctx->channels; i++) {
sconf->chan_pos[i] = get_bits(&gb, chan_pos_bits); int idx;
if (sconf->chan_pos[i] >= avctx->channels) {
idx = get_bits(&gb, chan_pos_bits);
if (idx >= avctx->channels) {
av_log(avctx, AV_LOG_WARNING, "Invalid channel reordering.\n"); av_log(avctx, AV_LOG_WARNING, "Invalid channel reordering.\n");
sconf->chan_sort = 0; sconf->chan_sort = 0;
break; break;
} }
sconf->chan_pos[idx] = i;
} }
align_get_bits(&gb); align_get_bits(&gb);
......
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