Audio capture latency reduction#125
Merged
Merged
Conversation
This is no longer needed after additional buffering was removed in audio source
No longer used by audio source in favor of creating NativeArray directly
This reverts commit c34992a.
bcherry
approved these changes
May 28, 2025
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.
This PR aims to solve the outstanding audio capture latency issue. Recently, #122 fixed an issue related to video capture that was causing broader performance impacts, leading to high audio latency over time when both video and audio were enabled. Currently, audio samples are read using
OnAudioFilterRead, enqueued, and then dequeued and captured via FFI on a dedicated thread. Based on the code history, it seems this might have been introduced as a fix for audio delay. With the issue from #122 fixed, this PR evaluates the performance of capturing directly fromOnAudioFilterReadwith no additional queuing on the Unity side; my initial testing on iOS and macOS shows this works well, delivering noticibly lower audio latency that does not increase over time.I would like to discuss potential impacts of this change and test across more platforms. Also, it is worth noting since the last discussion about this in #62, the
queue_size_msoption has been added by livekit/rust-sdks#425 but has not been adopted yet.Related PRs and discussion in chronological order:
enable_queueoption removed, replaced byqueue_size_ms