diff mbox series

[FFmpeg-devel] avfilter/buffersrc: never override channel count in av_buffersrc_add_frame_flags

Message ID 20240331183655.4592-1-cus@passwd.hu
State Accepted
Commit 4721b9f15fc8487d718cce918f51db5b7734a942
Headers show
Series [FFmpeg-devel] avfilter/buffersrc: never override channel count in av_buffersrc_add_frame_flags | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 success Make fate finished
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Marton Balint March 31, 2024, 6:36 p.m. UTC
Overriding unknown layouts with the negotiated layout is OK, but the number of
channels should match with what was negotiated.

Signed-off-by: Marton Balint <cus@passwd.hu>
---
 libavfilter/buffersrc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Marton Balint April 6, 2024, 9:14 a.m. UTC | #1
On Sun, 31 Mar 2024, Marton Balint wrote:

> Overriding unknown layouts with the negotiated layout is OK, but the number of
> channels should match with what was negotiated.

Will apply.

Regards,
Marton

>
> Signed-off-by: Marton Balint <cus@passwd.hu>
> ---
> libavfilter/buffersrc.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/libavfilter/buffersrc.c b/libavfilter/buffersrc.c
> index 130751775a..3ea3ca92c9 100644
> --- a/libavfilter/buffersrc.c
> +++ b/libavfilter/buffersrc.c
> @@ -215,7 +215,7 @@ int attribute_align_arg av_buffersrc_add_frame_flags(AVFilterContext *ctx, AVFra
>             break;
>         case AVMEDIA_TYPE_AUDIO:
>             /* For layouts unknown on input but known on link after negotiation. */
> -            if (frame->ch_layout.order == AV_CHANNEL_ORDER_UNSPEC) {
> +            if (frame->ch_layout.order == AV_CHANNEL_ORDER_UNSPEC && frame->ch_layout.nb_channels == s->ch_layout.nb_channels) {
>                 ret = av_channel_layout_copy(&frame->ch_layout, &s->ch_layout);
>                 if (ret < 0)
>                     return ret;
> -- 
> 2.35.3
>
> _______________________________________________
> 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".
>
diff mbox series

Patch

diff --git a/libavfilter/buffersrc.c b/libavfilter/buffersrc.c
index 130751775a..3ea3ca92c9 100644
--- a/libavfilter/buffersrc.c
+++ b/libavfilter/buffersrc.c
@@ -215,7 +215,7 @@  int attribute_align_arg av_buffersrc_add_frame_flags(AVFilterContext *ctx, AVFra
             break;
         case AVMEDIA_TYPE_AUDIO:
             /* For layouts unknown on input but known on link after negotiation. */
-            if (frame->ch_layout.order == AV_CHANNEL_ORDER_UNSPEC) {
+            if (frame->ch_layout.order == AV_CHANNEL_ORDER_UNSPEC && frame->ch_layout.nb_channels == s->ch_layout.nb_channels) {
                 ret = av_channel_layout_copy(&frame->ch_layout, &s->ch_layout);
                 if (ret < 0)
                     return ret;