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

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

 



On Wed, 2017-05-03 at 11:23 +0800, Hui Wang wrote:
> Today I tested the latest master branch (already including your two 
> patches), seems it did not fix the problem. Below is my testing detail:
> 
> Install ubuntu 16.04 on my laptop.
> clone the latest pulseaudio source code, checkout master branch
> build the source code: ./autogen.sh;make
> kill the existing pulseaudio and run the latest pulseaudio: pulseaudio 
> --kill && ./src/pulseaudio -vvvnF ./src/default.pa -p $(pwd)/src
> 
> On this machine, we have sound cards, sinks and ports like 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)

No speaker port at all on the PCH card?

> with the new pulseaudio, I can only see one sink (analog-stereo)
> through pactl list sinks at the beginning.
> 
> After I plug the HDMI cable (headphone is not plugged), I can see two
> sinks via pactl list sinks, but the default sink is still the analog-
> stereo, here I expect the default sink is hdmi-stereo since the
> headphone is not plugged yet.

That's what I'd expect too. Is the headphone port marked as unavailable
as it should?

> Then I plug the headphone, and I select the hdmi (hdmi is also
> plugged in) as the default sink, after a while I unplug the hdmi
> cable, here I expect the default sink is back to analog-stereo since
> headphone is still plugged, but the default sink did not switch to
> analog-stereo. BTW after I unplug the hdmi cable, I can still see two
> sinks.

The default sink is set in pa_core_update_default_sink() in
src/pulsecore/core.c. That function uses the compare_sinks() function,
and the first thing compare_sinks() does is to check if one of the
compared sinks has an unavailable port active. Can you figure out what
goes wrong? Is pa_core_update_default_sink() not called when you plug
in or unplug things, or does pa_core_update_default_sink() really
choose a sink whose active port is unavailable?

-- 
Tanu

https://www.patreon.com/tanuk


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

  Powered by Linux