diff --git a/src/pipewire/pipewirecontroller.cpp b/src/pipewire/pipewirecontroller.cpp index 5098dd6..e4d0977 100644 --- a/src/pipewire/pipewirecontroller.cpp +++ b/src/pipewire/pipewirecontroller.cpp @@ -104,6 +104,7 @@ bool PipeWireController::createVirtualDevice(const QString &name, { PW_KEY_MEDIA_CLASS, mediaClass }, { PW_KEY_AUDIO_CHANNELS, channelsBytes.constData() }, { PW_KEY_AUDIO_RATE, rateBytes.constData() }, + { "object.linger", "true" }, { PW_KEY_APP_NAME, "Potato-Manager" } }; @@ -572,30 +573,21 @@ bool PipeWireController::destroyVirtualNode(uint32_t nodeId) return false; } - bool destroyed = false; lock(); + for (auto it = m_virtualDevices.begin(); it != m_virtualDevices.end(); ) { struct pw_proxy *proxy = *it; if (proxy && pw_proxy_get_bound_id(proxy) == nodeId) { - pw_proxy_destroy(proxy); it = m_virtualDevices.erase(it); - destroyed = true; } else { ++it; } } - - if (!destroyed) { - auto *proxy = static_cast( - pw_registry_bind(m_registry, nodeId, PW_TYPE_INTERFACE_Node, PW_VERSION_NODE, 0)); - if (proxy) { - pw_proxy_destroy(proxy); - destroyed = true; - } - } + + const int result = pw_registry_destroy(m_registry, nodeId); unlock(); - return destroyed; + return result == 0; } float PipeWireController::nodeMeterPeak(uint32_t nodeId) const