[pulseaudio-discuss] [PATCH] switch-on-port-available: check and change default sink or source

Georg Chini georg at chini.tk
Sat Apr 29 13:34:52 UTC 2017

On 29.04.2017 15:04, Tanu Kaskinen wrote:
> On Fri, 2017-04-28 at 12:21 +0800, Hui Wang wrote:
>> Hello Tanu,
>> Could you please take a look at this patch, you are the maintainer and
>> recently contributed couple of commits to
>> module-switch-on-port-available.c. :-)
> Well, I'm trying to concentrate on preparing for the release, so I
> don't do patch reviews much at the moment. Now that I read the commit
> message, I have some comments, though.
>> On 04/27/2017 11:20 AM, Hui Wang wrote:
>>> Suppose your machine has two sound cards as below:
>>> Card#0(HDA INTEL HDMI)-> Sink#0(hdmi-stereo)->hdmi-output(priority: 5900)
>>> Card#1(HDA INTEL PCH)->Sink#1(analog-stereo)->headphones(priority: 9000)
>>> If neither hdmi cable nor headphone plug into the machine, the default
>>> sink will randomly be Sink#0 or Sink#1, let us assume it is Sink#1,
>>> then users plug hdmi cable into the machine, the port hdmi-output will
>>> change to the state PA_AVAILABLE_YES, so the Sink#0 has a port with
>>> state YES, while the Sink#1 still has a port with state NO, in this
>>> situation it is reasonable to change the default_sink to Sink#0, but
>>> current code can't do that.
> This problem should be fixed by these two patches:
> https://patchwork.freedesktop.org/patch/139179/
> https://patchwork.freedesktop.org/patch/139178/
> The patches have been reviewed, but I haven't yet pushed them. I'm not
> sure if they'll be in the next release or not (I need to ask Georg and
> Arun if they want to grant a freeze exception for these patches).
>>> Let us suppose another situation, both hdmi cable and headphone are
>>> plugged into the machine, and the Sink#0 is the default sink, if users
>>> unplug the hdmi cable, the port hdmi-output is changed to NO while
>>> the port headphone is still kept YES, in this situation it is
>>> reasonable to switch the default_sink to Sink#1, but current code
>>> can't do that.
> This should be fixed too by those two patches mentioned above.
Hi Tanu,

Didn't you want to change them a bit? I remember we talked about
it on IRC and I convinced you to give more weight to the users choice.
(I believe we agreed that module-switch-on-connect can be seen as a
temporary override and that the fallback default sink should always
be the users choice. Additionally the users choice should be saved by
module-default-device-restore, not the current default sink.)

Or did you want to do that in a separate patch?

BTW, i did only review the first of the two patches so far, but I took
a look at the second right now and it seems OK to me.

If you think these changes are important and should go into 11.0
I would probably not resist, it still seems better than what we have

More information about the pulseaudio-discuss mailing list