mirror of
https://git.outfoxxed.me/quickshell/quickshell.git
synced 2026-02-23 03:33:57 +11:00
services/pipewire: cache route device volumes to initialize nodes
Nodes referencing a device can be bound later than the device is bound. If this happens, the node will not receive an initial route device volume change event. This change caches the last known route device volume and initializes the device with it if present.
This commit is contained in:
parent
fc704e6b5d
commit
a00ff03944
5 changed files with 28 additions and 1 deletions
|
|
@ -125,12 +125,22 @@ void PwDevice::addDeviceIndexPairs(const spa_pod* param) {
|
|||
// Insert into the main map as well, staging's purpose is to remove old entries.
|
||||
this->routeDeviceIndexes.insert(device, index);
|
||||
|
||||
// Used for initial node volume if the device is bound before the node
|
||||
// (e.g. multiple nodes pointing to the same device)
|
||||
this->routeDeviceVolumes.insert(device, volumeProps);
|
||||
|
||||
qCDebug(logDevice).nospace() << "Registered device/index pair for " << this
|
||||
<< ": [device: " << device << ", index: " << index << ']';
|
||||
|
||||
emit this->routeVolumesChanged(device, volumeProps);
|
||||
}
|
||||
|
||||
bool PwDevice::tryLoadVolumeProps(qint32 routeDevice, PwVolumeProps& volumeProps) {
|
||||
if (!this->routeDeviceVolumes.contains(routeDevice)) return false;
|
||||
volumeProps = this->routeDeviceVolumes.value(routeDevice);
|
||||
return true;
|
||||
}
|
||||
|
||||
void PwDevice::polled() {
|
||||
// It is far more likely that the list content has not come in yet than it having no entries,
|
||||
// and there isn't a way to check in the case that there *aren't* actually any entries.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue