[pulseaudio-discuss] [PATCH v2 4/8] core: move sink-inputs conditionally when update default_sink

Georg Chini georg at chini.tk
Wed Jul 10 20:03:47 UTC 2019


On 10.07.19 16:03, Tanu Kaskinen wrote:
> On Fri, 2019-07-05 at 10:57 +0200, Georg Chini wrote:
>> On 05.07.19 09:41, Tanu Kaskinen wrote:
>>> On Tue, 2019-07-02 at 09:08 +0200, Georg Chini wrote:
>>>> On 02.07.19 08:43, Tanu Kaskinen wrote:
>>>>> On Mon, 2019-07-01 at 08:03 +0200, Georg Chini wrote:
>>>>>> On 01.07.19 07:08, Tanu Kaskinen wrote:
>>>>>> When a new sink appears, pa_core_update_default_sink() is called. Since
>>>>>> PulseAudio 11.1, bluetooth and USB sinks have higher priority than the
>>>>>> internal sound card, so pa_core_update_default_sink() will switch to
>>>>>> the BT speakers in your example. The main benefit of module-switch-on-
>>>>>> connect was that it moved existing streams to the new sink, but after
>>>>>> this patch set that's handled by the core. Therefore there's much less
>>>>>> need for module-switch-on-connect.
>>>>>>
>>>> This is true, but only relevant if there is no configured default
>>>> sink. If the configured default sink is set, there will be no switch
>>>> to a newly appearing sink because the configured default sink
>>>> is prioritized over all other sinks. In this case you still need
>>>> module-switch-on-connect.
>>> My estimation is that this is very rarely a problem.
>> Mh, my estimation is, that this will be the normal case. At some
>> point the user will set a default sink manually, and from that point
>> on, automatic switching will no longer work. The configured default
>> sink is never unset once it is set.
> Yes, sure, but I tried to explain why this is rarely a problem. (In
> another thread you described a valid use case where this becomes a
> problem, but I don't think that's a "normal case".)
>
>>> If you have manually selected an external sound card as the default
>>> sink and you then plug in another external sound card, then you may or
>>> may not want to automatically switch to the new sound card. If you
>>> fiddle a lot with two external sound cards and you always want to use
>>> the last one plugged in, then module-switch-on-connect is still useful,
>>> but in this case it doesn't really matter that your old default device
>>> choice is forgotten, because PulseAudio will anyway prefer the
>>> remaining external sound card.
>> This topic is not about forgetting the last sink, but about switching
>> to a new sink at all. Once you manually set the default sink, it will
>> never switch automatically without module-switch-on-connect,
>> because the default sink selection process prefers the configured
>> default sink over all other sinks.
> You're assuming that we always want to switch to a newly plugged in
> device. Let's say that you have just one USB device, no other external
> devices. If you for some reason set the internal sound card as the
> default device, I think it's a good thing that we don't automatically
> switch to that USB device when it's plugged in again. Therefore I think
> it's a good thing that we don't load module-switch-on-connect by
> default.
>
> If you in this situation plug in another external device, it would
> probably make sense to switch to it, but I don't what the full policy
> would look like that would allow this without breaking anything. I
> believe it's a good compromise to stick to the current configured
> default sink until the user changes it or the device goes away.
>
You said you will write another mail tomorrow, so I skip most
of your comments, but while reading your mails I realized
what is really behind my dislike of the current switching logic:

I believe it is a bad idea to make switching to new sinks
dependent on the configured default sink. Switching to
new sinks is something a user should be able to turn on
and off separately. Behavior could be something like that:

If switching to new sinks is turned off and a new sink turns up,
we should never switch to it, even if it has higher priority and
even if the configured default sink is not set. The only exception
would be if the configured default sink is set and the sink that
turns up is the configured default sink.

If switching to new sinks is turned on, we always switch to a
new device. The configured default sink is the one we always
return to when the last added device is removed. This means
if two devices have been added, we would already go back to
the configured default when the second device is removed. If
no default is configured, we would use the highest priority sink
to return to.



More information about the pulseaudio-discuss mailing list