diff --git a/libavcodec/wmaprodec.c b/libavcodec/wmaprodec.c index a2ee9b0440..8e1675dc78 100644 --- a/libavcodec/wmaprodec.c +++ b/libavcodec/wmaprodec.c @@ -403,7 +403,7 @@ static av_cold int decode_init(WMAProDecodeCtx *s, AVCodecContext *avctx, int nu s->decode_flags = AV_RL16(edata_ptr+14); channel_mask = AV_RL32(edata_ptr+2); s->bits_per_sample = AV_RL16(edata_ptr); - s->nb_channels = avctx->ch_layout.nb_channels; + s->nb_channels = channel_mask ? av_popcount(channel_mask) : avctx->ch_layout.nb_channels; if (s->bits_per_sample > 32 || s->bits_per_sample < 1) { avpriv_request_sample(avctx, "bits per sample is %d", s->bits_per_sample);