diff options
author | Chris Robinson <[email protected]> | 2023-05-31 17:15:53 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2023-06-01 06:31:19 -0700 |
commit | b5323af956dab2c27153568ef82facda33fff25a (patch) | |
tree | da8a5459ba0dbe9c11b23796880fa0f0cbfce941 /alc/backends/pipewire.cpp | |
parent | 5f88fe54a06fda76cf16c2dec1d242cdb5e4a8ae (diff) |
Add a comment explaining the DeviceAdded logic for PipeWire
Diffstat (limited to 'alc/backends/pipewire.cpp')
-rw-r--r-- | alc/backends/pipewire.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/alc/backends/pipewire.cpp b/alc/backends/pipewire.cpp index 30dc7a87..fad64f01 100644 --- a/alc/backends/pipewire.cpp +++ b/alc/backends/pipewire.cpp @@ -924,9 +924,18 @@ void NodeProxy::infoCallback(const pw_node_info *info) noexcept DeviceNode &node = DeviceNode::Add(info->id); node.mSerial = serial_id; + /* This method is called both to notify about a new sink/source node, + * and update properties for the node. It's unclear what properties can + * change for an existing node without being removed first, so err on + * the side of caution: send a DeviceAdded event when the name differs, + * and send a DeviceRemoved event if it had a name that's being + * replaced. + * + * This is overkill if the name or devname can't change. + */ if(node.mName != name) { - if(gEventHandler.mInitDone.load(std::memory_order_relaxed)) + if(gEventHandler.initIsDone(std::memory_order_relaxed)) { if(!node.mName.empty()) { |