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 <dbassey@redhat.com>
This commit is contained in:
Dorinda Bassey 2025-10-03 10:10:45 +02:00 committed by Stefano Garzarella
parent 9224f99c9b
commit 0c8c287ad0
2 changed files with 11 additions and 11 deletions

View File

@ -31,7 +31,7 @@ vmm-sys-util = "0.14"
# Make alsa and pipewire backends available only on gnu
[target.'cfg(target_env = "gnu")'.dependencies]
alsa = { version = "0.10", optional = true }
pw = { package = "pipewire", version = "0.8", optional = true }
pw = { package = "pipewire", version = "0.9.2", optional = true }
[dev-dependencies]
rstest = "0.26.1"

View File

@ -11,8 +11,8 @@ use std::{
use log::debug;
use pw::{
context::Context, core::Core, properties::properties, spa, sys::PW_ID_CORE,
thread_loop::ThreadLoop,
context::ContextRc, core::CoreRc, properties::properties, spa, sys::PW_ID_CORE,
thread_loop::ThreadLoopRc,
};
use spa::{
param::{
@ -87,11 +87,11 @@ unsafe impl Sync for PwBackend {}
#[allow(clippy::non_send_fields_in_send_ty)]
pub struct PwBackend {
pub stream_params: Arc<RwLock<Vec<Stream>>>,
thread_loop: ThreadLoop,
pub core: Core,
thread_loop: ThreadLoopRc,
pub core: CoreRc,
#[allow(dead_code)]
context: Context,
pub stream_hash: RwLock<HashMap<u32, pw::stream::Stream>>,
context: ContextRc,
pub stream_hash: RwLock<HashMap<u32, pw::stream::StreamRc>>,
pub stream_listener: RwLock<HashMap<u32, pw::stream::StreamListener<i32>>>,
}
@ -101,13 +101,13 @@ impl PwBackend {
// SAFETY: safe as the thread loop cannot access objects associated
// with the loop while the lock is held
let thread_loop = unsafe { ThreadLoop::new(Some("Pipewire thread loop"), None).unwrap() };
let thread_loop = unsafe { ThreadLoopRc::new(Some("Pipewire thread loop"), None).unwrap() };
let lock_guard = thread_loop.lock();
let context = Context::new(&thread_loop).map_err(PwError::CreateContext)?;
let context = ContextRc::new(&thread_loop, None).map_err(PwError::CreateContext)?;
thread_loop.start();
let core = context.connect(None).map_err(PwError::ConnectToCore)?;
let core = context.connect_rc(None).map_err(PwError::ConnectToCore)?;
// Create new reference for the variable so that it can be moved into the
// closure.
@ -356,7 +356,7 @@ impl AudioBackend for PwBackend {
*pw::keys::MEDIA_CATEGORY => media_category,
};
let stream = pw::stream::Stream::new(&self.core, stream_name, props)
let stream = pw::stream::StreamRc::new(self.core.clone(), stream_name, props)
.expect("could not create new stream");
let streams = self.stream_params.clone();