feat(realtime): rename feature, make default, and report RT denials#1187
Open
roderickvd wants to merge 19 commits intomasterfrom
Open
feat(realtime): rename feature, make default, and report RT denials#1187roderickvd wants to merge 19 commits intomasterfrom
roderickvd wants to merge 19 commits intomasterfrom
Conversation
- Rename the `audio_thread_priority` feature to `realtime` and make it default. - Gate AAudio PERFORMANCE_MODE_LOW_LATENCY and PipeWire RT_PROCESS. - Rename ErrorKind::RealtimeUnavailable to RealtimeDenied. - Add RealtimeDenied error reporting to AAudio, PipeWire and JACK. - Fix AAudio error_callback not being forwarded to the caller.
51b53ff to
603251b
Compare
0d5b90d to
7d7581e
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 22 out of 22 changed files in this pull request and generated 3 comments.
Comments suppressed due to low confidence (1)
src/host/wasapi/stream.rs:446
push_commandunconditionally unwrapsSetEvent(self.pending_scheduled_event). Sincepending_scheduled_eventis now closed on the worker thread inRunContext::drop, there is a race wheresend()can succeed while the worker is exiting, butSetEventcan fail (invalid handle) and panic the caller. Please handleSetEventfailure without panicking (and/or avoid closing the handle until it can no longer be signaled).
fn push_command(&self, command: Command) -> Result<(), SendError<Command>> {
self.commands.send(command)?;
unsafe {
Threading::SetEvent(self.pending_scheduled_event).unwrap();
}
Ok(())
Comment on lines
+402
to
+407
| emit_error( | ||
| &error_callback, | ||
| Error::with_message( | ||
| ErrorKind::Other, | ||
| format!("PipeWire: failed to bind metadata object; device change notifications may be incomplete: {e}"), | ||
| ), |
Comment on lines
+779
to
+784
| emit_error( | ||
| &error_callback, | ||
| Error::with_message( | ||
| ErrorKind::Other, | ||
| format!("PipeWire: could not acquire registry; device change notifications will be unavailable: {e}"), | ||
| ), |
Comment on lines
+511
to
+516
| emit_error( | ||
| &error_callback, | ||
| Error::with_message( | ||
| ErrorKind::Other, | ||
| format!("PipeWire: could not acquire registry; device change notifications will be unavailable: {e}"), | ||
| ), |
knz
added a commit
to knz/cpal
that referenced
this pull request
May 6, 2026
The previous fix queued `DeletePlaybackStream` from `Stream::drop` but returned immediately. Because the delete is processed asynchronously on the reactor and the play_all driver thread only exits *after* the reactor wakes it, a process that exits shortly after dropping the Stream can race the worker threads — the delete may never reach the server, leaving exactly the leak this PR set out to fix. Store the spawned threads' JoinHandles on `Stream` and join them in `Drop` after signalling cancellation. Skip handles whose thread id matches the current thread, since the user's error_callback runs on those workers and may itself drop the Stream; joining ourselves would deadlock. Mirrors the pattern roderickvd is introducing for PipeWire in RustAudio#1187.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
audio_thread_priorityfeature torealtime-dbusand make it default.PERFORMANCE_MODE_LOW_LATENCYand PipeWireRT_PROCESS.ErrorKind::RealtimeUnavailabletoRealtimeDenied.error_callbacknot being forwarded to the caller.