diff mbox series

[FFmpeg-devel] avcodec/mlpdec: cover case when >2 channels are in single substream

Message ID 20211111085007.263745-1-onemda@gmail.com
State Accepted
Commit 946493eb3e072b499909f606625480c928834a44
Headers show
Series [FFmpeg-devel] avcodec/mlpdec: cover case when >2 channels are in single substream | expand

Checks

Context Check Description
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished
andriy/make_ppc success Make finished
andriy/make_fate_ppc success Make fate finished

Commit Message

Paul B Mahol Nov. 11, 2021, 8:50 a.m. UTC
Previously it was assumed that all >2 channels streams have >1 substreams.

Signed-off-by: Paul B Mahol <onemda@gmail.com>
---
 libavcodec/mlpdec.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/libavcodec/mlpdec.c b/libavcodec/mlpdec.c
index 68c270ef52..780ed5b7b6 100644
--- a/libavcodec/mlpdec.c
+++ b/libavcodec/mlpdec.c
@@ -417,7 +417,8 @@  static int read_major_sync(MLPDecodeContext *m, GetBitContext *gb)
                 m->substream[2].mask = mh.channel_layout_thd_stream2;
             else
                 m->substream[2].mask = mh.channel_layout_thd_stream1;
-        m->substream[1].mask = mh.channel_layout_thd_stream1;
+        if (m->avctx->channels > 2)
+            m->substream[mh.num_substreams > 1].mask = mh.channel_layout_thd_stream1;
 
         if (m->avctx->channels<=2 && m->substream[substr].mask == AV_CH_LAYOUT_MONO && m->max_decoded_substream == 1) {
             av_log(m->avctx, AV_LOG_DEBUG, "Mono stream with 2 substreams, ignoring 2nd\n");