Skip to content

Commit 5cba950

Browse files
committed
keep references to node listeners
1 parent f84a41a commit 5cba950

File tree

1 file changed

+9
-13
lines changed

1 file changed

+9
-13
lines changed

Diff for: src/host/pipewire/conn.rs

+9-13
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ impl PWClient {
9696
#[derive(Default)]
9797
struct State {
9898
settings: Settings,
99-
nodes: Vec<Node>,
99+
nodes: Vec<ProxyItem>,
100100
}
101101

102102
#[derive(Default, Clone, Debug)]
@@ -125,7 +125,7 @@ fn pw_thread(
125125
pipewire::init();
126126
// let state = Rc::new(State::default());
127127
let state = Rc::new(RefCell::new(State::default()));
128-
let proxies = Rc::new(RefCell::new(HashMap::<u32, ProxyItem>::new()));
128+
let proxies = Rc::new(RefCell::new(HashMap::new()));
129129

130130
let mainloop = pipewire::MainLoop::new().expect("Failed to create PipeWire Mainloop");
131131

@@ -142,6 +142,7 @@ fn pw_thread(
142142
let state = state.clone();
143143
let main_sender = main_sender.clone();
144144
let core = core.clone();
145+
let proxies = proxies.clone();
145146

146147
move |msg| match msg {
147148
Message::Terminate => mainloop.quit(),
@@ -177,8 +178,8 @@ fn pw_thread(
177178

178179
let _listener = node
179180
.add_listener_local()
180-
.info(|f| {
181-
println!("{:?}", f);
181+
.info(|info| {
182+
// println!("{:?}", info);
182183
})
183184
.param(|a, b, c, d| {
184185
println!("{}, {}, {}, {}", a, b, c, d);
@@ -187,15 +188,10 @@ fn pw_thread(
187188

188189
println!("{:?}", node);
189190

190-
state.as_ref().borrow_mut().nodes.push(node);
191-
192-
// proxies.as_ref().borrow_mut().insert(
193-
// node.proxy.id(),
194-
// ProxyItem::Node {
195-
// _proxy: node,
196-
// _listener,
197-
// },
198-
// );
191+
state.as_ref().borrow_mut().nodes.push(ProxyItem::Node {
192+
_proxy: node,
193+
_listener,
194+
});
199195

200196
main_sender.send(MessageRepl::NodeInfo(NodeInfo { name }));
201197
}

0 commit comments

Comments
 (0)