The branch, master has been updated
via 530ca627a325a0f77859a6a7d8baa05395767d56 (commit)
from 0a4bd6cc239e2990746f194f50ef47e132deb888 (commit)
- Log -----------------------------------------------------------------
commit 530ca627a325a0f77859a6a7d8baa05395767d56
Author: James Almer <[email protected]>
AuthorDate: Mon Oct 27 11:13:20 2025 -0300
Commit: James Almer <[email protected]>
CommitDate: Tue Oct 28 13:08:02 2025 +0000
avcodec/mlpdec: don't depend on context channel layout when setting
substream masks
If avctx->ch_layout is unset (as it's allowed and even expeced by the
AV_CODEC_CAP_CHANNEL_CONF flag), the code setting substream masks will fail
for
stereo and mono layouts unless a downmix channel was requested.
Fix this by deriving the mask with coded values only.
Fixes issue #20764.
Signed-off-by: James Almer <[email protected]>
diff --git a/libavcodec/mlpdec.c b/libavcodec/mlpdec.c
index 688cf51d6c..580efc3cf4 100644
--- a/libavcodec/mlpdec.c
+++ b/libavcodec/mlpdec.c
@@ -319,8 +319,10 @@ static av_cold int mlp_decode_init(AVCodecContext *avctx)
av_channel_layout_uninit(&avctx->ch_layout);
avctx->ch_layout = (AVChannelLayout)AV_CHANNEL_LAYOUT_5POINT1;
}
- else
+ else {
av_log(avctx, AV_LOG_WARNING, "Invalid downmix layout\n");
+ av_channel_layout_uninit(&m->downmix_layout);
+ }
}
ff_thread_once(&init_static_once, init_static);
@@ -453,26 +455,22 @@ static int read_major_sync(MLPDecodeContext *m,
GetBitContext *gb)
}
m->substream[1].mask = mh.channel_layout_thd_stream1;
if (mh.channels_thd_stream1 == 2 &&
- mh.channels_thd_stream2 == 2 &&
- m->avctx->ch_layout.nb_channels == 2)
+ mh.channels_thd_stream2 == 2)
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 == 1 &&
mh.channels_thd_stream1 == 1 &&
- mh.channels_thd_stream2 == 1 &&
- m->avctx->ch_layout.nb_channels == 1)
+ mh.channels_thd_stream2 == 1)
m->substream[0].mask = AV_CH_LAYOUT_MONO;
if (mh.num_substreams > 2)
if (mh.channel_layout_thd_stream2)
m->substream[2].mask = mh.channel_layout_thd_stream2;
else
m->substream[2].mask = mh.channel_layout_thd_stream1;
- if (m->avctx->ch_layout.nb_channels > 2)
- if (mh.num_substreams > 2)
- m->substream[1].mask = mh.channel_layout_thd_stream1;
- else
- m->substream[mh.num_substreams > 1].mask =
mh.channel_layout_thd_stream2;
+ if (mh.num_substreams == 2 && (!m->downmix_layout.nb_channels ||
+ m->downmix_layout.nb_channels > 2))
+ m->substream[1].mask = mh.channel_layout_thd_stream2;
}
m->needs_reordering = mh.channel_arrangement >= 18 &&
mh.channel_arrangement <= 20;
-----------------------------------------------------------------------
Summary of changes:
libavcodec/mlpdec.c | 18 ++++++++----------
1 file changed, 8 insertions(+), 10 deletions(-)
hooks/post-receive
--
_______________________________________________
ffmpeg-cvslog mailing list -- [email protected]
To unsubscribe send an email to [email protected]