Closed jmickelin closed 1 month ago
Any progress on this? This issue depreciated the AUR package.
@jmickelin Thanks for investigating this and sorry for the late response. Here you refer to ports:
The problem seems to be that my computer's sound card only lists the ports in question when the corresponding profiles are active.
whereas further on you mention the sink list that doesn't get to be updated:
However, as shown by the logging I added to card.find_stream_port, the contents of self.sinks is never updated after switching profile!
Did I understand you correctly that in this second excerpt you refer to sink ports that are supposed to be re-read?
Besides, update_all_pa_items()
updates each and every PA object. So should the problem indeed lie in the port list, I'd prefer to use a more targeted method for the update.
On a side note, PulseAudio issues like this one are extremely hard to properly analyse because they depend on specific devices, PA modules in use, and even on the PA version.
@alsimoneau What do you mean with "depreciated the AUR package"? This issue doesn't seem to be package-specific, rather a device-specific one.
Here's the link to the AUR package: https://aur.archlinux.org/packages/indicator-sound-switcher
As you can see here, it's flagged as out-of-date because of this issue.
@alsimoneau The comment there states:
Need to change from legacy dependency 'libappindicator-gtk3' to 'libayatana-appindicator'; also revert a commit that introduced a regression: https://github.com/yktoo/indicator-sound-switcher/issues/132
Not sure we can call it a "regression", it's more of an incomplete fix.
As for the change "from legacy dependency 'libappindicator-gtk3' to 'libayatana-appindicator'", that doesn't seem to be correct as it Depends on gir1.2-ayatanaappindicator3-0.1 | gir1.2-appindicator3-0.1
.
UPDATE: I see that the AUR package has a few incorrect dependencies indeed; however it's been submitted by someone else so I can't maintain it.
I've (seemingly) resolved the issue by enforcing a stream update after a profile switch. However to be honest, the change doesn't sit right with me as it looks more like a workaround rather than a solution.
If we look closely to your logs, we can see that the streams and ports do get updated as a result of PulseAudio event handling. Here's an excerpt starting with an output item click:
DEBUG .activate_port(0, hdmi-output-0)
INFO # Card[0], port `hdmi-output-0` selected
DEBUG .find_stream_port(...)
DEBUG * card_port = hdmi-output-0, stream.ports = ['analog-output-speaker', 'analog-output-headphones']
DEBUG * stream: None
DEBUG * Switching card[0] to profile `output:hdmi-stereo+input:analog-stereo` with priority 38733
DEBUG .find_stream_port(...)
DEBUG * card_port = hdmi-output-0, stream.ports = ['analog-output-speaker', 'analog-output-headphones']
DEBUG * stream: None
ERROR Failed to map card[0], port `hdmi-output-0` to a stream
DEBUG .do_context_subscribe(facility: 7, kind: 16, index: 4294967295)
DEBUG * Activated sink: `alsa_output.pci-0000_00_1f.3.hdmi-stereo`
DEBUG * Activated source: `alsa_input.pci-0000_00_1f.3.analog-stereo`
DEBUG .do_context_subscribe(facility: 1, kind: 32, index: 333)
DEBUG .do_context_subscribe(facility: 0, kind: 32, index: 332)
DEBUG - Sink[332] removed: `alsa_output.pci-0000_00_1f.3.analog-stereo`
DEBUG .do_context_subscribe(facility: 0, kind: 16, index: 334)
DEBUG + Sink[334] added: `alsa_output.pci-0000_00_1f.3.hdmi-stereo`, card 0
DEBUG + Sink port added: `hdmi-output-0` (`HDMI / DisplayPort`); priority: 5900; available: Yes
DEBUG * Activated sink port `hdmi-output-0`
[...]
The problem is actually not so much in the (lack of) update, but rather that the app tries to find a stream/port immediately upon a profile switch; PulseAudio fires change events a short while later, and they get properly handled, resulting in registering a newly available port.
If I'm correct, the output will always be selected on a second click; and I can confirm it works that way for me indeed.
Hence the proper solution would be to wait until PA event handling is finished, and then to try remapping the streams. Will need to ponder a bit more over that...
I decided to go ahead and release this in 2.3.10. The issue seems too complicated to be properly resolved without update duplication: PulseAudio issues events asynchronously and there's basically no way to know how many events to expect or if a certain event is the last one.
Describe the bug
This seems to be a regression introduced by 5fb737c.
I can no longer switch output ports when the ports reside in different profiles. The error I get is as follows (I have added some extra debugging lines to showcase what happens):
To Reproduce Steps to reproduce the behavior:
Expected behavior Output should be switched correctly.
Desktop (please complete the following information):
Indicator log:
Here is the log. I have included some extra debug lines for context, as follows:
This produces the following:
Analysis The problem seems to be that my computer's sound card only lists the ports in question when the corresponding profiles are active. That is,
hdmi-output-0
is only active when a profile likeoutput:hdmi-stereo+input:analog-stereo
is active, and converselyanalog-output-speaker
andanalog-output-headphones
are only available whenoutput:analog-stereo+input:analog-stereo
is active.This already seems to be what was addressed by 5fb737c, with these lines:
However, as shown by the logging I added to
card.find_stream_port
, the contents ofself.sinks
is never updated after switching profile! This stale information of course causes the second lookup to fail, just like the first one did.It seems prudent to force a refresh of the Pulseaudio data from within
card_switch_profile
. I have confirmed that adding the following in that function resolves the issue: