Skip to content

Commit 580af08

Browse files
fix(audio): potential UB
Signed-off-by: Maika Namuo <httpworldview@gmail.com>
1 parent 2922b81 commit 580af08

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

‎src/infra/pipewire/virtual_sink.rs‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -425,12 +425,13 @@ fn run_virtual_sink() -> Result<(), Box<dyn Error + Send + Sync>> {
425425
let mut params = [Pod::from_bytes(&format_bytes)
426426
.ok_or_else(|| io::Error::other("serialized PipeWire format pod was invalid"))?];
427427

428+
// With RT_PROCESS, `process` may run concurrently with
429+
// `param_changed`, but pipewire-rs gives both callbacks mutable
430+
// access to the same listener state.
428431
stream.connect(
429432
spa::utils::Direction::Input,
430433
None,
431-
pw::stream::StreamFlags::AUTOCONNECT
432-
| pw::stream::StreamFlags::MAP_BUFFERS
433-
| pw::stream::StreamFlags::RT_PROCESS,
434+
pw::stream::StreamFlags::AUTOCONNECT | pw::stream::StreamFlags::MAP_BUFFERS,
434435
&mut params,
435436
)?;
436437

0 commit comments

Comments
 (0)