[FFmpeg-devel] [PATCH 2/2] avcodec/ac3dec: export downmix info side data only when no downmix is done by the decoder
James Almer
jamrial at gmail.com
Fri Jan 13 00:23:26 EET 2023
Same as with Matrix Encoding, add a check to ensure the decoder is not
doing a downmix of its own.
Signed-off-by: James Almer <jamrial at gmail.com>
---
libavcodec/ac3dec.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/libavcodec/ac3dec.c b/libavcodec/ac3dec.c
index 7a84f3c85d..722a1028b7 100644
--- a/libavcodec/ac3dec.c
+++ b/libavcodec/ac3dec.c
@@ -1824,7 +1824,11 @@ skip:
return ret;
/* AVDownmixInfo */
- if ((downmix_info = av_downmix_info_update_side_data(frame))) {
+ if (s->channel_mode == (s->output_mode & ~AC3_OUTPUT_LFEON)) {
+ downmix_info = av_downmix_info_update_side_data(frame);
+ if (!downmix_info)
+ return AVERROR(ENOMEM);
+
switch (s->preferred_downmix) {
case AC3_DMIXMOD_LTRT:
downmix_info->preferred_downmix_type = AV_DOWNMIX_TYPE_LTRT;
@@ -1847,8 +1851,7 @@ skip:
downmix_info->lfe_mix_level = gain_levels_lfe[s->lfe_mix_level];
else
downmix_info->lfe_mix_level = 0.0; // -inf dB
- } else
- return AVERROR(ENOMEM);
+ }
*got_frame_ptr = 1;
--
2.39.0
More information about the ffmpeg-devel
mailing list