[pulseaudio-discuss] [PATCH 2/3] module-port-manager: Add new port manager module

David Henningsson david.henningsson at canonical.com
Tue Mar 10 17:12:53 PDT 2015



On 2015-03-10 20:42, Alexander E. Patrakov wrote:
> 10.03.2015 23:28, Alexander E. Patrakov wrote:
>> I have read the rest of the patch, and could not find anything
>> obviously wrong. But I have not tested it, either, so it is not an
>> "ack" yet. I intend to do some testing in the next hour and also
>> tomorrow.
>>
>
> OK, first log of meaningless-random-monkey testing on my desktop PC.
>
> I have two Intel HDA soundcards - one for analog + spdif, and one for
> HDMI, with three outputs. The Dell monitor is connected to HDMI 1, HDMI
> 2 is unused, and the LG TV is connected to HDMI 3. The Dell monitor is
> capable of accepting audio over HDMI, but I don't use this capability.
> The LG TV, obviously, can play sounds, and I use it sometimes. There is
> also a Logitech webcam.
>
> Initially, before killing the old copy of pulseaudio, the analog
> soundcard was using the Analog Stereo Duplex profile, my headphones were
> plugged in, and HDMI card was using Digital Stereo (HDMI 3) output
> (unplugged, because the LG TV was initially powered off).
>
> So, I killed pulseaudio, it got restarted and loaded the new module.
> Result: the profiles stayed the same.
>
> I started VLC and opened an audio file. It started playing from analog
> headphones. Then I turned the TV on, thus making its port available.
> Result: the profiles did not change, the audio continued from
> headphones, but pavucontrol noticed that HDMI3 is now plugged in.
>
> So far, the module lists all sink-related stuff as "(auto)".
>
> I unplugged the headphones, just to see what happens. Result: it changed
> the profile of the HDMI card to Digital Stereo (HDMI) output, but did
> not move VLC output there. For me, it's rather incomplete. Or rather,
> the module should have noticed that there is already a non-default
> profile selected from prehistoric times, and bump its port priority.
>
> I manually switched the profile to Digital Stereo (HDMI 3) output, then
> moved VLC output to the TV.
>
> Then I plugged my headphones back in. Result: nothing changed, and the
> log still lists all output-related entries as "(auto)".
>
> Moved to analog output. Read the description - oh, I am supposed to mark
> the sink as default for the module to notice.
>
> Marked the analog output as a fallback sink (but it was already). Turned
> the TV off. Still all "(auto)".
>
> Turned the TV on. Marked HDMI3 as fallback - yes, the module noticed and
> marked it as manual!
>
> Moved VLC there.
>
> Marked the analog sink as fallback, marked HDMI3 as fallback again. Result:
>
> D: [pulseaudio] module-port-manager.c: Current contents of port-manager
> list 'output':
> D: [pulseaudio] module-port-manager.c:     5900 (auto) Y:
> card:alsa_card.pci-0000_00_03.0+port:hdmi-output-0
> D: [pulseaudio] module-port-manager.c:     5800 (auto) N:
> card:alsa_card.pci-0000_00_03.0+port:hdmi-output-1
> D: [pulseaudio] module-port-manager.c:     9903 manual Y:
> card:alsa_card.pci-0000_00_03.0+port:hdmi-output-2
> D: [pulseaudio] module-port-manager.c:     9902 manual Y:
> card:alsa_card.pci-0000_00_1b.0+port:analog-output-lineout
> D: [pulseaudio] module-port-manager.c:        0 (auto) Y:
> card:alsa_card.pci-0000_00_1b.0+port:iec958-stereo-output
> D: [pulseaudio] module-port-manager.c:   The best one available is:
> card:alsa_card.pci-0000_00_03.0+port:hdmi-output-2
>
> Turned the TV off. Result:
>
> D: [pulseaudio] module-port-manager.c: Current contents of port-manager
> list 'output':
> D: [pulseaudio] module-port-manager.c:     5900 (auto) Y:
> card:alsa_card.pci-0000_00_03.0+port:hdmi-output-0
> D: [pulseaudio] module-port-manager.c:     5800 (auto) N:
> card:alsa_card.pci-0000_00_03.0+port:hdmi-output-1
> D: [pulseaudio] module-port-manager.c:     9903 manual N:
> card:alsa_card.pci-0000_00_03.0+port:hdmi-output-2
> D: [pulseaudio] module-port-manager.c:     9902 manual Y:
> card:alsa_card.pci-0000_00_1b.0+port:analog-output-lineout
> D: [pulseaudio] module-port-manager.c:        0 (auto) Y:
> card:alsa_card.pci-0000_00_1b.0+port:iec958-stereo-output
> D: [pulseaudio] module-port-manager.c:   The best one available is:
> card:alsa_card.pci-0000_00_1b.0+port:analog-output-lineout
>
> ...but VLC was still playing to the unavailable HDMI3 port.
>
> Same result with mpv - when switching the TV on and off, the module does
> not move existing streams from unavailable ports, and its only effect
> seems to be printing of the best output to the log. It does not route
> new streams from either mpv or from VLC to there - probably because I
> moved them in the past, and there is a saved module-stream-restore entry
> about that.
>
> So it may be a good idea to retest the new module without
> module-stream-restore. I will do that tomorrow.

First, thanks for review and testing!

So, I have mostly tested this together with unity-control-center, which 
does "interesting" things, including wiping the 
application-specific-routing database (gnome-control-center does the 
same, we share that code). You probably tested with pavucontrol or pactl?

But in short, it seems your main problem is that streams are not moved 
and yes, I can confirm that if you have an application specific entry in 
module-stream-restore, then that stream will not be routed by 
module-port-manager. This is behaviour taken from module-device-manager, 
and I think it makes sense - that said, maybe module-stream-restore 
should also become "port aware" or even use "rport"s somehow...

I also notice that you talk about analog headphones (which I assume 
belongs to the HDA Intel card, not USB headphones), but there is no such 
entry in the 'output' list, which seems strange. Even if unplugged, 
there should be an "N" entry for headphones in the debug log. Have you 
changed your paths in some way that you don't have a headphone path/port?

On my todo-list is also to test this with Bluetooth, which I haven't 
done yet.

Next up would probably be to remember profile per port instead of per 
card (and first figure out whether that's module-port-manager's or 
module-card-restore's business).

-- 
David Henningsson, Canonical Ltd.
https://launchpad.net/~diwic


More information about the pulseaudio-discuss mailing list