Screen share 14 follow-ups: list_applications reach, recompute cost, sink loss, list thread leak #225

Open
opened 2026-11-12 07:19:59 +00:00 by charles · 0 comments
Owner

Deferred from the reviews of PR #198 (Screen share 14, Linux stream audio over PipeWire). None of these block the merge. Seen on commit 2e75321.

  1. Task 21 cannot reach list_applications (review 1 finding 1, re-review finding 2). It is an inherent method of PipeWireAudioCapturer, and default_backends() returns Box<dyn StreamAudioCapturer>. To fill the "Audio sources" submenu, Task 21 has to build a concrete PipeWireAudioCapturer itself on Linux, or the trait gets a method for it.
  2. Recompute cost (review 1 finding 2). SessionState::recompute runs on every registry global, ports included. For unknown PIDs, SelfIdentity::matches walks up to 64 /proc/<pid>/stat reads. That is O(globals × nodes × depth) on the PipeWire thread before the initial sync, and it eats into the 2 s READY_TIMEOUT. Fix: cache ancestry per PID, or defer recompute until after the first done.
  3. The target PID set is fixed at start (review 1 finding 3). AppMatch::Pid is expanded once, at start or set_rule, so children the app spawns later (browser audio processes) are not routed. The fork behaves the same way, so this is not a regression.
  4. Sink loss is silent (review 1 finding 4). If the private sink is removed or the capture stream errors, frames just stop and the trait has no way to report it. Task 21 could treat a long gap as "stream audio lost", or the trait could gain an end signal.
  5. Per-buffer allocation (review 1 finding 5). process allocates a Vec<f32> per buffer. It runs on the session's non-RT thread, so the real-time rule is not broken, but the allocation can be avoided.
  6. Thread leak in list_applications (re-review finding 3). After the 2 s timeout, the fluxer-pipewire-list thread keeps waiting in mainloop.run() if the daemon is wedged. That leaks at most one thread per call.
  7. libwebrtc ABI coupling (re-review finding 1). pipewire_audio/mod.rs declares _ZN6webrtc18InitializePipeWireEv itself. Moving the extern into src/desktop/rtc.rs as pub(crate) fn initialize_pipewire() -> bool would keep every libwebrtc coupling in one place.
Deferred from the reviews of PR #198 (Screen share 14, Linux stream audio over PipeWire). None of these block the merge. Seen on commit 2e75321. 1. **Task 21 cannot reach `list_applications` (review 1 finding 1, re-review finding 2).** It is an inherent method of `PipeWireAudioCapturer`, and `default_backends()` returns `Box<dyn StreamAudioCapturer>`. To fill the "Audio sources" submenu, Task 21 has to build a concrete `PipeWireAudioCapturer` itself on Linux, or the trait gets a method for it. 2. **Recompute cost (review 1 finding 2).** `SessionState::recompute` runs on every registry global, ports included. For unknown PIDs, `SelfIdentity::matches` walks up to 64 `/proc/<pid>/stat` reads. That is O(globals × nodes × depth) on the PipeWire thread before the initial sync, and it eats into the 2 s `READY_TIMEOUT`. Fix: cache ancestry per PID, or defer recompute until after the first `done`. 3. **The target PID set is fixed at start (review 1 finding 3).** `AppMatch::Pid` is expanded once, at `start` or `set_rule`, so children the app spawns later (browser audio processes) are not routed. The fork behaves the same way, so this is not a regression. 4. **Sink loss is silent (review 1 finding 4).** If the private sink is removed or the capture stream errors, frames just stop and the trait has no way to report it. Task 21 could treat a long gap as "stream audio lost", or the trait could gain an end signal. 5. **Per-buffer allocation (review 1 finding 5).** `process` allocates a `Vec<f32>` per buffer. It runs on the session's non-RT thread, so the real-time rule is not broken, but the allocation can be avoided. 6. **Thread leak in `list_applications` (re-review finding 3).** After the 2 s timeout, the `fluxer-pipewire-list` thread keeps waiting in `mainloop.run()` if the daemon is wedged. That leaks at most one thread per call. 7. **libwebrtc ABI coupling (re-review finding 1).** `pipewire_audio/mod.rs` declares `_ZN6webrtc18InitializePipeWireEv` itself. Moving the extern into `src/desktop/rtc.rs` as `pub(crate) fn initialize_pipewire() -> bool` would keep every libwebrtc coupling in one place.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
charles/fluxer-native#225
No description provided.