Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Wrong stream handling with multiple sinks/sources per device #119

Closed
token47 opened this issue May 5, 2022 · 6 comments
Closed

Wrong stream handling with multiple sinks/sources per device #119

token47 opened this issue May 5, 2022 · 6 comments

Comments

@token47
Copy link

token47 commented May 5, 2022

I have been a happy user of Indicator Sound Switcher for years in Ubuntu Focal LTS (20.04). Today I migrated all my configs to a new laptop on Ubuntu Jammy LTS (22.04). It was a complete new install, including new config (I started with old config but deleted it and started over after I started debugging this problem).

On the menu I see two devices, my USB one and my onboard one. The USB one has one mic and one speaker. The onboard has two outputs, one internal speakers and one for HDMI audio out to the monitor speakers, and one microphone.

When I start the application, the USB is selected for both input and output. I cannot select any other. They are on the menu, I click them, but nothing happens. If I insist I can eventually see the bullet changing to the other one (takes a lot of tries) but immediately goes back to the USB output (the same for the input selection). Nothing happens to the audio, always going to the USB even during that quick moment.

If I open pulseaudio volume control and click to change fallback to other devices, it works normally, including audio following the selection in real time. Volume buttons also follow the selection correctly. It seems everything is as expected on the pulseaudio side.

Interestingly, even when I change audio to HDMI using pulseaudio volume control, on the ISS menu it still points to the USB device. If I then click HDMI output on the menu (audio is already on HDMI) it immediately goes back to USB device, and I can see on pa volume control it changing back to the USB as a fallback.

This might have something to do with the change to pipewire, maybe?

Please let me know what kinds of tests I can do and what debug/logs to check or post here.

Thank you!

@token47
Copy link
Author

token47 commented May 5, 2022

For reference, here is my current config:

$ cat ./.config/indicator-sound-switcher.json
{
    "devices": {
        "alsa_card.pci-0000_00_1f.3-platform-skl_hda_dsp_generic": {
            "ports": {
                "[Out] HDMI3": {},
                "[Out] HDMI2": {},
                "[Out] HDMI1": {
                    "name": "LG Monitor",
                    "shortcut": "Launch5"
                },
                "[Out] Speaker": {
                    "name": "Speaker"
                },
                "[Out] Headphones": {
                    "name": "Headphone"
                },
                "[In] Mic2": {
                    "name": "Headphone Mic"
                },
                "[In] Mic1": {
                    "name": "Mic"
                }
            },
            "name": "Laptop"
        },
        "alsa_card.usb-Burr-Brown_from_TI_USB_Audio_CODEC-00": {
            "ports": {
                "analog-input": {
                    "name": "Headphone Mic"
                },
                "analog-output": {
                    "name": "Headphone",
                    "shortcut": "Launch8"
                }
            },
            "name": "Xenyx"
        }
    }
}

@token47
Copy link
Author

token47 commented May 5, 2022

I just found the -vv command line option. In the log below you can see:

  1. Started the application. USB device was selected when I opened the menu.
  2. Click on "LG Monitor" (only once), saw the bullet change to it for a few seconds and go back to USB device.
  3. Stop the capture.
$ indicator-sound-switcher -vv
INFO     Starting indicator application
INFO     Loaded configuration file /home/andre/.config/indicator-sound-switcher.json
DEBUG    KeyboardManager.bind_keys()
DEBUG      - Bound keyboard shortcut `Launch5` to `[('alsa_card.pci-0000_00_1f.3-platform-skl_hda_dsp_generic', '[Out] HDMI1')]`
DEBUG      - Bound keyboard shortcut `Launch8` to `[('alsa_card.usb-Burr-Brown_from_TI_USB_Audio_CODEC-00', 'analog-output')]`
DEBUG    .menu_append_item(): appending item `Inputs`
DEBUG    .menu_append_item(): appending separator
DEBUG    .menu_append_item(): appending item `Outputs`
DEBUG    .menu_append_item(): appending separator
DEBUG    .menu_append_item(): appending item `_Refresh`
DEBUG    .menu_append_item(): appending item `_Preferences…`
DEBUG    .menu_append_item(): appending item `_About`
DEBUG    .menu_append_item(): appending item `_Quit`
DEBUG    Trying to connect to PulseAudio daemon, attempt #1
INFO     Context connected
DEBUG      + Card[0] added: `alsa_card.pci-0000_00_1f.3-platform-skl_hda_dsp_generic`, driver: `module-alsa-card.c`
DEBUG        + Card profile added: `HiFi` (`Play HiFi quality Music`), 4 sinks, 2 sources, priority: 40768 -- Active
DEBUG        + Card profile added: `off` (`Off`), 0 sinks, 0 sources, priority: 0
DEBUG        + Card port added: `[Out] HDMI3` (`HDMI / DisplayPort 3 Output`); priority: 700; direction: 1; available: No
DEBUG          . Supported profile: `HiFi`
DEBUG        + Card port added: `[Out] HDMI2` (`HDMI / DisplayPort 2 Output`); priority: 600; direction: 1; available: No
DEBUG          . Supported profile: `HiFi`
DEBUG        + Card port added: `[Out] HDMI1` (`HDMI / DisplayPort 1 Output`); priority: 500; direction: 1; available: Yes
DEBUG          . Supported profile: `HiFi`
DEBUG        + Card port added: `[Out] Speaker` (`Speaker`); priority: 100; direction: 1; available: Yes
DEBUG          . Supported profile: `HiFi`
DEBUG        + Card port added: `[Out] Headphones` (`Headphones`); priority: 200; direction: 1; available: No
DEBUG          . Supported profile: `HiFi`
DEBUG        + Card port added: `[In] Mic2` (`Headphones Stereo Microphone`); priority: 200; direction: 2; available: No
DEBUG          . Supported profile: `HiFi`
DEBUG        + Card port added: `[In] Mic1` (`Digital Microphone`); priority: 100; direction: 2; available: Yes
DEBUG          . Supported profile: `HiFi`
DEBUG    .menu_insert_ordered_item(): inserting item `    Laptop ‣ HDMI / DisplayPort 3 Output` at index 3 (hidden)
DEBUG    .menu_insert_ordered_item(): inserting item `    Laptop ‣ HDMI / DisplayPort 2 Output` at index 3 (hidden)
DEBUG    .menu_insert_ordered_item(): inserting item `    Laptop ‣ LG Monitor` at index 5
DEBUG    .menu_insert_ordered_item(): inserting item `    Laptop ‣ Speaker` at index 6
DEBUG    .menu_insert_ordered_item(): inserting item `    Laptop ‣ Headphone` at index 5 (hidden)
DEBUG    .menu_insert_ordered_item(): inserting item `    Laptop ‣ Headphone Mic` at index 1 (hidden)
DEBUG    .menu_insert_ordered_item(): inserting item `    Laptop ‣ Mic` at index 2
DEBUG      + Card[1] added: `alsa_card.usb-Burr-Brown_from_TI_USB_Audio_CODEC-00`, driver: `module-alsa-card.c`
DEBUG        + Card profile added: `input:analog-stereo-input` (`Analog Stereo Input`), 0 sinks, 1 sources, priority: 54
DEBUG        + Card profile added: `input:analog-mono` (`Analog Mono Input`), 0 sinks, 1 sources, priority: 3
DEBUG        + Card profile added: `input:analog-mono-left` (`Analog Mono (Left) Input`), 0 sinks, 1 sources, priority: 32
DEBUG        + Card profile added: `input:analog-mono-right` (`Analog Mono (Right) Input`), 0 sinks, 1 sources, priority: 31
DEBUG        + Card profile added: `output:analog-stereo-output` (`Analog Stereo Output`), 1 sinks, 0 sources, priority: 5000
DEBUG        + Card profile added: `output:analog-stereo-output+input:analog-stereo-input` (`Analog Stereo Output + Analog Stereo Input`), 1 sinks, 1 sources, priority: 5054 -- Active
DEBUG        + Card profile added: `output:analog-stereo-output+input:analog-mono` (`Analog Stereo Output + Analog Mono Input`), 1 sinks, 1 sources, priority: 5003
DEBUG        + Card profile added: `output:analog-stereo-output+input:analog-mono-left` (`Analog Stereo Output + Analog Mono (Left) Input`), 1 sinks, 1 sources, priority: 5032
DEBUG        + Card profile added: `output:analog-stereo-output+input:analog-mono-right` (`Analog Stereo Output + Analog Mono (Right) Input`), 1 sinks, 1 sources, priority: 5031
DEBUG        + Card profile added: `off` (`Off`), 0 sinks, 0 sources, priority: 0
DEBUG        + Card port added: `analog-input` (`Analog Input`); priority: 10000; direction: 2; available: Yes
DEBUG          . Supported profile: `input:analog-stereo-input`
DEBUG          . Supported profile: `input:analog-mono`
DEBUG          . Supported profile: `input:analog-mono-left`
DEBUG          . Supported profile: `input:analog-mono-right`
DEBUG          . Supported profile: `output:analog-stereo-output+input:analog-stereo-input`
DEBUG          . Supported profile: `output:analog-stereo-output+input:analog-mono`
DEBUG          . Supported profile: `output:analog-stereo-output+input:analog-mono-left`
DEBUG          . Supported profile: `output:analog-stereo-output+input:analog-mono-right`
DEBUG        + Card port added: `analog-output` (`Analog Output`); priority: 9900; direction: 1; available: Yes
DEBUG          . Supported profile: `output:analog-stereo-output`
DEBUG          . Supported profile: `output:analog-stereo-output+input:analog-stereo-input`
DEBUG          . Supported profile: `output:analog-stereo-output+input:analog-mono`
DEBUG          . Supported profile: `output:analog-stereo-output+input:analog-mono-left`
DEBUG          . Supported profile: `output:analog-stereo-output+input:analog-mono-right`
DEBUG    .menu_insert_ordered_item(): inserting item `    Xenyx ‣ Headphone Mic` at index 3
DEBUG    .menu_insert_ordered_item(): inserting item `    Xenyx ‣ Headphone` at index 11
DEBUG      + Source[4] added: `alsa_input.pci-0000_00_1f.3-platform-skl_hda_dsp_generic.HiFi__hw_sofhdadsp__source`, card 0
DEBUG        + Source port added: `[In] Mic2` (`Headphones Stereo Microphone`); priority: 200; available: No
DEBUG        * Activated source port `[In] Mic2`
DEBUG      + Source[5] added: `alsa_input.pci-0000_00_1f.3-platform-skl_hda_dsp_generic.HiFi__hw_sofhdadsp_6__source`, card 0
DEBUG        + Source port added: `[In] Mic1` (`Digital Microphone`); priority: 100; available: Yes
DEBUG        * Activated source port `[In] Mic1`
DEBUG      + Source[7] added: `alsa_input.usb-Burr-Brown_from_TI_USB_Audio_CODEC-00.analog-stereo-input`, card 1
DEBUG        + Source port added: `analog-input` (`Analog Input`); priority: 10000; available: Yes
DEBUG        * Activated source port `analog-input`
DEBUG      + Sink[0] added: `alsa_output.pci-0000_00_1f.3-platform-skl_hda_dsp_generic.HiFi__hw_sofhdadsp_5__sink`, card 0
DEBUG        + Sink port added: `[Out] HDMI3` (`HDMI / DisplayPort 3 Output`); priority: 700; available: No
DEBUG        * Activated sink port `[Out] HDMI3`
DEBUG      + Sink[1] added: `alsa_output.pci-0000_00_1f.3-platform-skl_hda_dsp_generic.HiFi__hw_sofhdadsp_4__sink`, card 0
DEBUG        + Sink port added: `[Out] HDMI2` (`HDMI / DisplayPort 2 Output`); priority: 600; available: No
DEBUG        * Activated sink port `[Out] HDMI2`
DEBUG      + Sink[2] added: `alsa_output.pci-0000_00_1f.3-platform-skl_hda_dsp_generic.HiFi__hw_sofhdadsp_3__sink`, card 0
DEBUG        + Sink port added: `[Out] HDMI1` (`HDMI / DisplayPort 1 Output`); priority: 500; available: Yes
DEBUG        * Activated sink port `[Out] HDMI1`
DEBUG      + Sink[3] added: `alsa_output.pci-0000_00_1f.3-platform-skl_hda_dsp_generic.HiFi__hw_sofhdadsp__sink`, card 0
DEBUG        + Sink port added: `[Out] Speaker` (`Speaker`); priority: 100; available: Yes
DEBUG        + Sink port added: `[Out] Headphones` (`Headphones`); priority: 200; available: No
DEBUG        * Activated sink port `[Out] Speaker`
DEBUG      + Sink[4] added: `alsa_output.usb-Burr-Brown_from_TI_USB_Audio_CODEC-00.analog-stereo-output`, card 1
DEBUG        + Sink port added: `analog-output` (`Analog Output`); priority: 9900; available: Yes
DEBUG        * Activated sink port `analog-output`
DEBUG      + Sink input[55] added: `Spotify` -> sink 0
DEBUG    * Activated sink: `alsa_output.usb-Burr-Brown_from_TI_USB_Audio_CODEC-00.analog-stereo-output`
DEBUG    * Activated source: `alsa_input.usb-Burr-Brown_from_TI_USB_Audio_CODEC-00.analog-stereo-input`
INFO     # Card[0], port `[Out] HDMI1` selected
DEBUG    * Switching card[0] to profile `HiFi` with priority 40768
DEBUG    .do_context_subscribe(facility: 2, kind: 16, index: 55)
DEBUG    .do_context_subscribe(facility: 0, kind: 16, index: 0)
DEBUG      * Sink[0] updated: `alsa_output.pci-0000_00_1f.3-platform-skl_hda_dsp_generic.HiFi__hw_sofhdadsp_5__sink`, card 0
DEBUG        * Activated sink port `[Out] HDMI3`
DEBUG    .do_context_subscribe(facility: 0, kind: 16, index: 0)
DEBUG      * Sink[0] updated: `alsa_output.pci-0000_00_1f.3-platform-skl_hda_dsp_generic.HiFi__hw_sofhdadsp_5__sink`, card 0
DEBUG        * Activated sink port `[Out] HDMI3`
DEBUG    .do_context_subscribe(facility: 2, kind: 16, index: 55)

@token47
Copy link
Author

token47 commented May 5, 2022

I just noticed on the log above: I select "LG Monitor" which corresponds to HDMI1 and it tried to activate HDMI3, which is "offline" now (unplugged) and it makes total sense that it fails and selection go back to the last working one (the USB output) -- actually on the pulseaudio side it just works, it selects HDMI3 and sound goes nowhere, but on the ISS side the bullet goes back to USB device.

I confirmed this visually: I click on "LG Monitor" in the ISS menu and I immediately see "HDMI3" being selected in the spotify output at the pulseaudio volume control.

Clicking on Laptop->Speakers also tries to select HDMI3 instead of internal speakers.

@token47
Copy link
Author

token47 commented May 9, 2022

I think this issue is the same as #107

@token47
Copy link
Author

token47 commented May 9, 2022

Just FYI I tested with gnome extension "Sound Input & Output Device Chooser" [1] and it works as expected.

[1] - https://extensions.gnome.org/extension/906/sound-output-device-chooser/

@yktoo yktoo changed the title Erratic behavior in Ubuntu Jammy Wrong stream handling with multiple sinks/sources per device May 13, 2022
@yktoo
Copy link
Owner

yktoo commented May 13, 2022

Duplicate of #107.

# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

No branches or pull requests

2 participants