Skip to content

Bug: ActiveRoute event handler unconditionally overrides default sink on volume change #2001

@Gabriel-Ramirez

Description

@Gabriel-Ramirez

Description
On certain hardware (like the Huawei Matebook D15), the audio applet incorrectly selects the output device on startup. Additionally, if the user manually selects the correct output, dragging the volume slider causes the selection to instantly revert to the wrong device.

Root Cause Analysis
The issue lies within the ActiveRoute event handler in the Model::pipewire_update() function of the cosmic-settings-sound-subscription crate.

There are two primary flaws:

Inaccurate Node Selection: When a device has multiple output ports (e.g., HDMI and Speakers on the same card), the handler iterates through device_ids and picks the first node belonging to that device, instead of specifically matching the route.device (the card_profile_device field).

Unconditional State Override: The ActiveRoute event fires on every property update, including volume and mute changes. Currently, the handler does not distinguish between a "port switch" and a "volume update." Consequently, every volume change triggers a full re-selection of the default sink based on the flawed logic mentioned above.

Proposed Fix
In the Event::ActiveRoute handler:

Implement a guard: Check if the current active node's card_profile_device already matches route.device. If it does, treat it as a property update (volume/mute) and return early without re-selecting the sink.

Precise Matching: Use route.device to find the exact node via card_profile_devices instead of selecting the first available node for the device.

Environment
OS: Pop!_OS 24.04 LTS (COSMIC)

Hardware: Huawei BOHB-WAX9 (CometLake-U GT2)

Kernel: 6.18.7-76061807-generic

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions