fix(pipewire): fix volume control for devices without route definitions#570
Open
Rival wants to merge 1 commit intoquickshell-mirror:masterfrom
Open
fix(pipewire): fix volume control for devices without route definitions#570Rival wants to merge 1 commit intoquickshell-mirror:masterfrom
Rival wants to merge 1 commit intoquickshell-mirror:masterfrom
Conversation
Fix multiple issues that prevented volume control from working for certain audio devices (particularly headphones) where the ALSA/Pipewire device has no route definitions. Backend fixes: - Fix division by zero in PwNodeBoundAudio::averageVolume() - returns 0.0f when mVolumes vector is empty instead of causing NaN/Infinity - Fix null pointer dereferences in PwVolumeProps::parseSpaPod() by adding null checks for volumesProp, channelsProp, and muteProp before access - Add PwDevice::hasRouteDevice() method to check if a routeDevice exists - Modify PwNode::shouldUseDevice() to check hasRouteDevice() - this prevents nodes from attempting to use device control when the device has no route definitions, forcing fallback to node-level SPA param control - Add forward declaration for PwVolumeProps in device.hpp to avoid circular dependency (device.hpp includes node.hpp which includes device.hpp) Root cause: Devices like the Sennheiser GSX 1000 (id=56) have routeDevice=0 but no route definitions in routeDeviceIndexes. The original code would skip node-level volume updates in favor of device updates that never came, resulting in no volume events being emitted. Fix: Nodes now use node-level control when hasRouteDevice() returns false, ensuring volume events are properly emitted via SPA_PROP_Props. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Member
|
These changes look good, however the device/route management has been somewhat hard to get right in the past. Please make sure volumes persist after a reboot if they do when using pulse tools, as this is the biggest one. |
Author
|
@outfoxxed Confirmed - rebooted and volumes persisted correctly on both devices, matching the values set before reboot. It seems changes go through the same PipeWire route/device volume mechanisms that wpctl/pactl use, so persistence works as expected. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix multiple issues that prevented volume control from working for certain audio devices (particularly headphones) where the ALSA/Pipewire device has no route definitions.
Backend fixes:
Root cause: Devices like the Sennheiser GSX 1000 (id=56) have routeDevice=0 but no route definitions in routeDeviceIndexes. The original code would skip node-level volume updates in favor of device updates that never came, resulting in no volume events being emitted.
Fix: Nodes now use node-level control when hasRouteDevice() returns false, ensuring volume events are properly emitted via SPA_PROP_Props.