Skip to content

Commit 0c8c287

Browse files
Dorinda Basseystefano-garzarella
authored andcommitted
chore(vhost-device-sound): bump pipewire to 0.9.2
migrate to pipewire-rs 0.9.2 rc API introduced in 0.9.x Signed-off-by: Dorinda Bassey <[email protected]>
1 parent 9224f99 commit 0c8c287

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

vhost-device-sound/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ vmm-sys-util = "0.14"
3131
# Make alsa and pipewire backends available only on gnu
3232
[target.'cfg(target_env = "gnu")'.dependencies]
3333
alsa = { version = "0.10", optional = true }
34-
pw = { package = "pipewire", version = "0.8", optional = true }
34+
pw = { package = "pipewire", version = "0.9.2", optional = true }
3535

3636
[dev-dependencies]
3737
rstest = "0.26.1"

vhost-device-sound/src/audio_backends/pipewire.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ use std::{
1111

1212
use log::debug;
1313
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,
1616
};
1717
use spa::{
1818
param::{
@@ -87,11 +87,11 @@ unsafe impl Sync for PwBackend {}
8787
#[allow(clippy::non_send_fields_in_send_ty)]
8888
pub struct PwBackend {
8989
pub stream_params: Arc<RwLock<Vec<Stream>>>,
90-
thread_loop: ThreadLoop,
91-
pub core: Core,
90+
thread_loop: ThreadLoopRc,
91+
pub core: CoreRc,
9292
#[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>>,
9595
pub stream_listener: RwLock<HashMap<u32, pw::stream::StreamListener<i32>>>,
9696
}
9797

@@ -101,13 +101,13 @@ impl PwBackend {
101101

102102
// SAFETY: safe as the thread loop cannot access objects associated
103103
// 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() };
105105

106106
let lock_guard = thread_loop.lock();
107107

108-
let context = Context::new(&thread_loop).map_err(PwError::CreateContext)?;
108+
let context = ContextRc::new(&thread_loop, None).map_err(PwError::CreateContext)?;
109109
thread_loop.start();
110-
let core = context.connect(None).map_err(PwError::ConnectToCore)?;
110+
let core = context.connect_rc(None).map_err(PwError::ConnectToCore)?;
111111

112112
// Create new reference for the variable so that it can be moved into the
113113
// closure.
@@ -356,7 +356,7 @@ impl AudioBackend for PwBackend {
356356
*pw::keys::MEDIA_CATEGORY => media_category,
357357
};
358358

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)
360360
.expect("could not create new stream");
361361

362362
let streams = self.stream_params.clone();

0 commit comments

Comments
 (0)