fix(audio): smooth playback-rate transitions across native outputs - #82
Open
mom0ka27 wants to merge 2 commits into
Open
fix(audio): smooth playback-rate transitions across native outputs#82mom0ka27 wants to merge 2 commits into
mom0ka27 wants to merge 2 commits into
Conversation
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.
Summary
Root Cause
iOS AudioQueue pre-fills three 20ms output buffers. The previous 80ms bridge could not reliably cover both the queued output and SoundTouch warm-up after a rate change, causing a short audio starvation and visible hitch.
Android and OpenHarmony use SPSC callback queues. Clearing or rewriting those queues during playback would race the realtime consumer. The new path instead stops draining decoded frames into a full callback queue, allowing existing worker-channel backpressure to preserve a bounded old-rate bridge safely.
Validation
cargo test -p erika --lib audio::tests::output_queue_high_water_bounds_rate_transition_latency -- --exactcargo test -p erika --lib audio::tests::ring_buffer_rate_change_keeps_a_full_prefill_bridge -- --exactcargo test -p erika --lib core::tests::buffering_audio_recovery_requires_low_water_mark -- --exactaarch64-apple-iosReleasestaticlibbuild passed.