diff mbox series

[FFmpeg-devel,1/2] avcodec/mlpdec: fix decoding single stereo stream in TrueHD

Message ID 20210918172105.5369-1-onemda@gmail.com
State Accepted
Commit 57f0b36367d4e5ccd4d2da7f69c3cac45b6236ee
Headers show
Series [FFmpeg-devel,1/2] avcodec/mlpdec: fix decoding single stereo stream in TrueHD | 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 Sept. 18, 2021, 5:21 p.m. UTC
Signed-off-by: Paul B Mahol <onemda@gmail.com>
---
 libavcodec/mlpdec.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/libavcodec/mlpdec.c b/libavcodec/mlpdec.c
index bee47b6cc6..68c270ef52 100644
--- a/libavcodec/mlpdec.c
+++ b/libavcodec/mlpdec.c
@@ -408,6 +408,8 @@  static int read_major_sync(MLPDecodeContext *m, GetBitContext *gb)
                         mh.stream_type);
             return AVERROR_PATCHWELCOME;
         }
+        if (mh.channel_modifier_thd_stream0 == THD_CH_MODIFIER_STEREO)
+            m->substream[0].mask = AV_CH_LAYOUT_STEREO;
         if ((substr = (mh.num_substreams > 1)))
             m->substream[0].mask = AV_CH_LAYOUT_STEREO;
         if (mh.num_substreams > 2)
@@ -415,7 +417,7 @@  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[substr].mask = mh.channel_layout_thd_stream1;
+        m->substream[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");