@@ -11,8 +11,8 @@ use std::{
11
11
12
12
use log:: debug;
13
13
use pw:: {
14
- context:: Context , core:: Core , properties:: properties, spa, sys:: PW_ID_CORE ,
15
- thread_loop:: ThreadLoop ,
14
+ context:: ContextRc , core:: CoreRc , properties:: properties, spa, sys:: PW_ID_CORE ,
15
+ thread_loop:: ThreadLoopRc ,
16
16
} ;
17
17
use spa:: {
18
18
param:: {
@@ -87,11 +87,11 @@ unsafe impl Sync for PwBackend {}
87
87
#[ allow( clippy:: non_send_fields_in_send_ty) ]
88
88
pub struct PwBackend {
89
89
pub stream_params : Arc < RwLock < Vec < Stream > > > ,
90
- thread_loop : ThreadLoop ,
91
- pub core : Core ,
90
+ thread_loop : ThreadLoopRc ,
91
+ pub core : CoreRc ,
92
92
#[ allow( dead_code) ]
93
- context : Context ,
94
- pub stream_hash : RwLock < HashMap < u32 , pw:: stream:: Stream > > ,
93
+ context : ContextRc ,
94
+ pub stream_hash : RwLock < HashMap < u32 , pw:: stream:: StreamRc > > ,
95
95
pub stream_listener : RwLock < HashMap < u32 , pw:: stream:: StreamListener < i32 > > > ,
96
96
}
97
97
@@ -101,13 +101,13 @@ impl PwBackend {
101
101
102
102
// SAFETY: safe as the thread loop cannot access objects associated
103
103
// with the loop while the lock is held
104
- let thread_loop = unsafe { ThreadLoop :: new ( Some ( "Pipewire thread loop" ) , None ) . unwrap ( ) } ;
104
+ let thread_loop = unsafe { ThreadLoopRc :: new ( Some ( "Pipewire thread loop" ) , None ) . unwrap ( ) } ;
105
105
106
106
let lock_guard = thread_loop. lock ( ) ;
107
107
108
- let context = Context :: new ( & thread_loop) . map_err ( PwError :: CreateContext ) ?;
108
+ let context = ContextRc :: new ( & thread_loop, None ) . map_err ( PwError :: CreateContext ) ?;
109
109
thread_loop. start ( ) ;
110
- let core = context. connect ( None ) . map_err ( PwError :: ConnectToCore ) ?;
110
+ let core = context. connect_rc ( None ) . map_err ( PwError :: ConnectToCore ) ?;
111
111
112
112
// Create new reference for the variable so that it can be moved into the
113
113
// closure.
@@ -356,7 +356,7 @@ impl AudioBackend for PwBackend {
356
356
* pw:: keys:: MEDIA_CATEGORY => media_category,
357
357
} ;
358
358
359
- let stream = pw:: stream:: Stream :: new ( & self . core , stream_name, props)
359
+ let stream = pw:: stream:: StreamRc :: new ( self . core . clone ( ) , stream_name, props)
360
360
. expect ( "could not create new stream" ) ;
361
361
362
362
let streams = self . stream_params . clone ( ) ;
0 commit comments