From aae2d78f24104905efe02b44caa579bc5993c3e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Maria=C5=84ski?= Date: Thu, 10 Mar 2022 00:51:44 +0100 Subject: [PATCH] keep references to node listeners --- src/host/pipewire/conn.rs | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/src/host/pipewire/conn.rs b/src/host/pipewire/conn.rs index 75b218dee..2586dec2a 100644 --- a/src/host/pipewire/conn.rs +++ b/src/host/pipewire/conn.rs @@ -96,7 +96,7 @@ impl PWClient { #[derive(Default)] struct State { settings: Settings, - nodes: Vec, + nodes: Vec, } #[derive(Default, Clone, Debug)] @@ -125,7 +125,7 @@ fn pw_thread( pipewire::init(); // let state = Rc::new(State::default()); let state = Rc::new(RefCell::new(State::default())); - let proxies = Rc::new(RefCell::new(HashMap::::new())); + let proxies = Rc::new(RefCell::new(HashMap::new())); let mainloop = pipewire::MainLoop::new().expect("Failed to create PipeWire Mainloop"); @@ -142,6 +142,7 @@ fn pw_thread( let state = state.clone(); let main_sender = main_sender.clone(); let core = core.clone(); + let proxies = proxies.clone(); move |msg| match msg { Message::Terminate => mainloop.quit(), @@ -177,8 +178,8 @@ fn pw_thread( let _listener = node .add_listener_local() - .info(|f| { - println!("{:?}", f); + .info(|info| { + // println!("{:?}", info); }) .param(|a, b, c, d| { println!("{}, {}, {}, {}", a, b, c, d); @@ -187,15 +188,10 @@ fn pw_thread( println!("{:?}", node); - state.as_ref().borrow_mut().nodes.push(node); - - // proxies.as_ref().borrow_mut().insert( - // node.proxy.id(), - // ProxyItem::Node { - // _proxy: node, - // _listener, - // }, - // ); + state.as_ref().borrow_mut().nodes.push(ProxyItem::Node { + _proxy: node, + _listener, + }); main_sender.send(MessageRepl::NodeInfo(NodeInfo { name })); }