Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
* [FFmpeg-devel] [PATCH] avfilter/buffersrc: fix overriding unknown channel layouts with negotiated one
@ 2024-03-23 15:26 Marton Balint
  2024-03-29 22:01 ` Marton Balint
  0 siblings, 1 reply; 4+ messages in thread
From: Marton Balint @ 2024-03-23 15:26 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: Marton Balint

Fixes ffplay playback of unknown layouts, when SDL directly supports the audio
format, such as:

ffplay -f lavfi anullsrc=cl=2C,aformat=s16

Without the patch, "Channel layout change is not supported" errors are
generated because buffersrc (unknown 2 channel) and buffersink (stereo)
negotiated a stereo layout, but the stereo layout was never stored in the
BufferSourceContext.

This fixes a regression of 7251f909721a570726775acf61b2b9c28a950c76, but this
is more of a regression of the avfilter channel layout conversion
(1f96db959c1235bb7079d354e09914a0a2608f62).

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 ddcd403785..fcae4f8e69 100644
--- a/libavfilter/buffersrc.c
+++ b/libavfilter/buffersrc.c
@@ -507,7 +507,7 @@ static int config_props(AVFilterLink *link)
         }
         break;
     case AVMEDIA_TYPE_AUDIO:
-        if (!c->ch_layout.nb_channels) {
+        if (!c->ch_layout.nb_channels || c->ch_layout.order == AV_CHANNEL_ORDER_UNSPEC) {
             int ret = av_channel_layout_copy(&c->ch_layout, &link->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".

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [FFmpeg-devel] [PATCH] avfilter/buffersrc: fix overriding unknown channel layouts with negotiated one
  2024-03-23 15:26 [FFmpeg-devel] [PATCH] avfilter/buffersrc: fix overriding unknown channel layouts with negotiated one Marton Balint
@ 2024-03-29 22:01 ` Marton Balint
  2024-03-30 21:30   ` James Almer
  0 siblings, 1 reply; 4+ messages in thread
From: Marton Balint @ 2024-03-29 22:01 UTC (permalink / raw)
  To: FFmpeg development discussions and patches



On Sat, 23 Mar 2024, Marton Balint wrote:

> Fixes ffplay playback of unknown layouts, when SDL directly supports the audio
> format, such as:
>
> ffplay -f lavfi anullsrc=cl=2C,aformat=s16
>
> Without the patch, "Channel layout change is not supported" errors are
> generated because buffersrc (unknown 2 channel) and buffersink (stereo)
> negotiated a stereo layout, but the stereo layout was never stored in the
> BufferSourceContext.
>
> This fixes a regression of 7251f909721a570726775acf61b2b9c28a950c76, but this
> is more of a regression of the avfilter channel layout conversion
> (1f96db959c1235bb7079d354e09914a0a2608f62).
>
> 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 ddcd403785..fcae4f8e69 100644
> --- a/libavfilter/buffersrc.c
> +++ b/libavfilter/buffersrc.c
> @@ -507,7 +507,7 @@ static int config_props(AVFilterLink *link)
>         }
>         break;
>     case AVMEDIA_TYPE_AUDIO:
> -        if (!c->ch_layout.nb_channels) {
> +        if (!c->ch_layout.nb_channels || c->ch_layout.order == AV_CHANNEL_ORDER_UNSPEC) {
>             int ret = av_channel_layout_copy(&c->ch_layout, &link->ch_layout);
>             if (ret < 0)
>                 return ret;

Will apply and backport.

Regards,
Marton
_______________________________________________
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".

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [FFmpeg-devel] [PATCH] avfilter/buffersrc: fix overriding unknown channel layouts with negotiated one
  2024-03-29 22:01 ` Marton Balint
@ 2024-03-30 21:30   ` James Almer
  2024-04-06  9:13     ` Marton Balint
  0 siblings, 1 reply; 4+ messages in thread
From: James Almer @ 2024-03-30 21:30 UTC (permalink / raw)
  To: ffmpeg-devel

On 3/29/2024 7:01 PM, Marton Balint wrote:
> 
> 
> On Sat, 23 Mar 2024, Marton Balint wrote:
> 
>> Fixes ffplay playback of unknown layouts, when SDL directly supports 
>> the audio
>> format, such as:
>>
>> ffplay -f lavfi anullsrc=cl=2C,aformat=s16
>>
>> Without the patch, "Channel layout change is not supported" errors are
>> generated because buffersrc (unknown 2 channel) and buffersink (stereo)
>> negotiated a stereo layout, but the stereo layout was never stored in the
>> BufferSourceContext.
>>
>> This fixes a regression of 7251f909721a570726775acf61b2b9c28a950c76, 
>> but this
>> is more of a regression of the avfilter channel layout conversion
>> (1f96db959c1235bb7079d354e09914a0a2608f62).
>>
>> 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 ddcd403785..fcae4f8e69 100644
>> --- a/libavfilter/buffersrc.c
>> +++ b/libavfilter/buffersrc.c
>> @@ -507,7 +507,7 @@ static int config_props(AVFilterLink *link)
>>         }
>>         break;
>>     case AVMEDIA_TYPE_AUDIO:
>> -        if (!c->ch_layout.nb_channels) {
>> +        if (!c->ch_layout.nb_channels || c->ch_layout.order == 
>> AV_CHANNEL_ORDER_UNSPEC) {
>>             int ret = av_channel_layout_copy(&c->ch_layout, 
>> &link->ch_layout);

Why is this the only field in the function where BufferSourceContext is 
the destination and the link is the source?

>>             if (ret < 0)
>>                 return ret;
> 
> Will apply and backport.
> 
> Regards,
> Marton
> _______________________________________________
> 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".
_______________________________________________
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".

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [FFmpeg-devel] [PATCH] avfilter/buffersrc: fix overriding unknown channel layouts with negotiated one
  2024-03-30 21:30   ` James Almer
@ 2024-04-06  9:13     ` Marton Balint
  0 siblings, 0 replies; 4+ messages in thread
From: Marton Balint @ 2024-04-06  9:13 UTC (permalink / raw)
  To: FFmpeg development discussions and patches



On Sat, 30 Mar 2024, James Almer wrote:

> On 3/29/2024 7:01 PM, Marton Balint wrote:
>>
>>
>>  On Sat, 23 Mar 2024, Marton Balint wrote:
>>
>>>  Fixes ffplay playback of unknown layouts, when SDL directly supports the
>>>  audio
>>>  format, such as:
>>>
>>>  ffplay -f lavfi anullsrc=cl=2C,aformat=s16
>>>
>>>  Without the patch, "Channel layout change is not supported" errors are
>>>  generated because buffersrc (unknown 2 channel) and buffersink (stereo)
>>>  negotiated a stereo layout, but the stereo layout was never stored in the
>>>  BufferSourceContext.
>>>
>>>  This fixes a regression of 7251f909721a570726775acf61b2b9c28a950c76, but
>>>  this
>>>  is more of a regression of the avfilter channel layout conversion
>>>  (1f96db959c1235bb7079d354e09914a0a2608f62).
>>>
>>>  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 ddcd403785..fcae4f8e69 100644
>>>  --- a/libavfilter/buffersrc.c
>>>  +++ b/libavfilter/buffersrc.c
>>>  @@ -507,7 +507,7 @@ static int config_props(AVFilterLink *link)
>>>          }
>>>          break;
>>>      case AVMEDIA_TYPE_AUDIO:
>>>  -        if (!c->ch_layout.nb_channels) {
>>>  +        if (!c->ch_layout.nb_channels || c->ch_layout.order ==
>>>  AV_CHANNEL_ORDER_UNSPEC) {
>>>              int ret = av_channel_layout_copy(&c->ch_layout,
>>>  &link->ch_layout);
>
> Why is this the only field in the function where BufferSourceContext is the 
> destination and the link is the source?

I guess the reason for that is that those link parameters are not 
negotiated, so they has to be set. Storing the negotiated layout on the 
context has a different purpose and is originated from 01649c79c87.

Regards,
Marton
_______________________________________________
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".

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-04-06  9:13 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-23 15:26 [FFmpeg-devel] [PATCH] avfilter/buffersrc: fix overriding unknown channel layouts with negotiated one Marton Balint
2024-03-29 22:01 ` Marton Balint
2024-03-30 21:30   ` James Almer
2024-04-06  9:13     ` Marton Balint

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