From: James Almer <jamrial@gmail.com>
To: ffmpeg-devel@ffmpeg.org
Subject: Re: [FFmpeg-devel] [PATCH] libavcodec/mlpdec: add missing correction to ch_layout when downmixing
Date: Sun, 26 Nov 2023 10:19:36 -0300
Message-ID: <a04efdd8-23e7-493a-ae3d-263546e76e59@gmail.com> (raw)
In-Reply-To: <20231126050100.1686194-1-geoff@hostfission.com>
On 11/26/2023 2:01 AM, Geoffrey McRae via ffmpeg-devel wrote:
> This fixes corrupted audio for applications relying on ch_layout when
> codec downmixing is active.
>
> Signed-off-by: Geoffrey McRae <geoff@hostfission.com>
> ---
> libavcodec/mlpdec.c | 17 +++++++++++++++++
> 1 file changed, 17 insertions(+)
>
> diff --git a/libavcodec/mlpdec.c b/libavcodec/mlpdec.c
> index f1524b95a6..18e0f47864 100644
> --- a/libavcodec/mlpdec.c
> +++ b/libavcodec/mlpdec.c
> @@ -306,6 +306,23 @@ FF_DISABLE_DEPRECATION_WARNINGS
> }
> FF_ENABLE_DEPRECATION_WARNINGS
> #endif
> +
> + if (m->downmix_layout.nb_channels) {
> + if (!av_channel_layout_compare(&m->downmix_layout, &(AVChannelLayout)AV_CHANNEL_LAYOUT_STEREO) ||
> + !av_channel_layout_compare(&m->downmix_layout, &(AVChannelLayout)AV_CHANNEL_LAYOUT_STEREO_DOWNMIX)) {
> + av_channel_layout_uninit(&avctx->ch_layout);
> + avctx->ch_layout = (AVChannelLayout)AV_CHANNEL_LAYOUT_STEREO;
> + } else if (!av_channel_layout_compare(&m->downmix_layout, &(AVChannelLayout)AV_CHANNEL_LAYOUT_5POINT0)) {
> + av_channel_layout_uninit(&avctx->ch_layout);
> + avctx->ch_layout = (AVChannelLayout)AV_CHANNEL_LAYOUT_5POINT0;
> + } else if (!av_channel_layout_compare(&m->downmix_layout, &(AVChannelLayout)AV_CHANNEL_LAYOUT_5POINT1)) {
> + av_channel_layout_uninit(&avctx->ch_layout);
> + avctx->ch_layout = (AVChannelLayout)AV_CHANNEL_LAYOUT_5POINT1;
> + }
> + else
> + av_log(avctx, AV_LOG_WARNING, "Invalid downmix layout\n");
> + }
> +
> ff_thread_once(&init_static_once, init_static);
>
> return 0;
Applied, thanks.
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
prev parent reply other threads:[~2023-11-26 13:19 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-26 5:01 Geoffrey McRae via ffmpeg-devel
2023-11-26 13:19 ` James Almer [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=a04efdd8-23e7-493a-ae3d-263546e76e59@gmail.com \
--to=jamrial@gmail.com \
--cc=ffmpeg-devel@ffmpeg.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
This inbox may be cloned and mirrored by anyone:
git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
ffmpegdev@gitmailbox.com
public-inbox-index ffmpegdev
Example config snippet for mirrors.
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git