Repository navigation
tecs-audio: a late buffer no longer ends the output stream - #12
Open
albanmgicquel wants to merge 1 commit into
Open
albanmgicquel wants to merge 1 commit into
albanmgicquel wants to merge 1 commit into
Conversation
cpal reports more than failures through a stream's error callback: on macOS an Xrun for every processor-overload notification (a callback that missed its deadline), a DeviceChanged when the default output reroutes and a RealtimeDenied when the thread is not promoted. The output and the capture took any of them as terminal, so one late buffer (a slow first callback of a debug build is enough) marked the stream failed for good: the callback rendered silence from then on, tecs.audio stopped every voice, and nothing played again until the mixer was made anew. Only the kinds that leave the stream dead now end it. Tests: the classification of each error kind.
This branch has not been deployed
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.
cpal's stream error callback reports more than failures. On macOS it reports an
Xrunfor every processor-overload notification (a callback that missed its deadline),DeviceChangedwhen the default output reroutes, andRealtimeDeniedwhen the thread isn't promoted.The output and capture streams treated every one of these as terminal. One late buffer, such as a slow first callback in a debug build, marked the stream failed for good: silence from then on, every voice stopped, until the mixer was made anew.
Now only the error kinds that leave the stream dead end it.
device::ends_the_streamclassifies them, and both output and capture use it:Xrun: the stream keeps running; at most one short gap.DeviceChanged: a stream on the default output is rerouted by CoreAudio's default-output unit (cpal'sDefaultOutputMonitor), so the sound follows the new device.RealtimeDenied: playback continues at normal priority.The fatal kinds (
DeviceNotAvailable,StreamInvalidated,HostUnavailable, ...) still end the stream as before. Reopening the output after one of those is left for a follow-up.Tests: each error kind's classification.
Checks: fmt, clippy -D warnings,
cargo test -p tecs-audio,nupp check --strict,nupp test(1017 passed). Independent of #8; based on main.