[PATCH] move streams when the default sink or source changes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 06.04.2017 22:34, Tanu Kaskinen wrote:
> On Thu, 2017-04-06 at 11:52 +0200, Georg Chini wrote:
>> On 25.10.2016 15:02, Tanu Kaskinen wrote:
>>> This adds a new "use_default_sink" field to pa_sink_input. If
>>> use_default_sink is set, the stream will be automatically moved when the
>>> default sink changes. Usually if the user changes the default sink, the
>>> user also wants to move existing streams there. If a stream is manually
>>> routed, use_default_sink isn't set, so automatic moving doesn't happen
>>> in that case.
>>>
>>> pa_sink_input_move_to() and other move functions take use_default_sink
>>> as a parameter so that every call site is forced to make a conscious
>>> decision whether the stream should stick to the move target or not.
>>>
>>> There are FIXME items added for some corner cases, because it's not
>>> currently possible to properly remember and prioritize the various
>>> automatic routing decisions that modules do. The different routing
>>> modules tend to step on each other's toes, and this new
>>> "use_default_sink" feature adds to the problem.
>>>
>>> The same changes are made for source outputs too.
>>>
>>> BugLink: https://bugs.freedesktop.org/show_bug.cgi?id=93006
>>> ---
>>>
>> I don't understand why you need that flag at all. Why not simply
>> take all streams that are on the old default sink and move them
>> to the new default sink?
> If you manually move a stream to a different sink (let's call that sink
> S), that stream isn't any more routed to the default sink. If S at some
> point becomes the default sink, do you really want to forget the manual
> routing choice? With your suggestion the manually-moved stream would
> move if some other sink becomes the default later.

Yes, I would think it is OK to "forget" the manual routing in that case.
Also consider the case where you move a stream manually to the
default sink. If the default sink changes later, this stream would not
be moved to the new default.

>
>> It's really weired that streams that are currently not on the default
>> sink should jump to the new default sink if the default changes.
>>   From a user perspective I would not expect that (and personally
>> would not want to have it that way).
> Can you give a concrete example where the code should be changed?
> Looking at the patch, I can identify these cases that enable "use
> default device" for streams that previously might not have been routed
> to the default device:
>
> When changing profiles, module-alsa-card moves streams from the old
> devices to the new devices. "Use default device" is enabled for those
> streams. As a comment says, "we don't have any particular reason to
> make the streams stick to the device we're moving them to". I
> acknowledge that the chosen approach isn't ideal, but I think it's
> better than disabling "use default device". The real fix would involve
> improving the routing system so that module-alsa-card wouldn't have to
> care about moving the streams at all.

Let's assume that a profile change causes a stream to be moved to
the new sink S which is not your default. Apart from S you have your
default sink D. Now if D changes, why should that have any impact on
a stream playing on sink S? What is actually the advantage of setting
use_default_sink in the case of a profile switch?

>
> module-allow-passthrough enables "use default device" when restoring
> the old routing. This isn't ideal, and there's a FIXME comment. Again,
> just disabling "use default device" wouldn't be an improvement in this
> case, the routing system needs some bigger changes to deal with this
> properly.

You say not setting the flag would be no improvement. What is the
improvement when you set the flag? I have to say that I cannot really
see it.

>
> module-rescue-streams enables "use default device" for rescued streams.
> It should ideally pick the default device anyway as the "evacuation"
> target, but there's the problem that if the removed sink is the current
> default, it's not yet known at the time of stream evacuation which sink
> will become the new default, and the current code for selecting the
> evacuation sink probably doesn't always pick the "right" sink. Fixing
> this problem shouldn't be very difficult. Would you prefer me to fix
> module-rescue-streams before applying this patch (assuming that you
> agree with the general idea of this patch at all)?
>
Module-rescue-stream just need not do anything if the default sink
goes away. Rescuing the streams could then be done when the new
default sink is elected. All streams that still have the old sink (or no 
sink
at all) can then be moved to the new default.



[Index of Archives]     [Linux Audio Users]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux