Skip to content

feat: device-pulled remote audio playout - #14

Merged
tiredIsa merged 1 commit into
native-v2from
feat/device-pulled-playout
Oct 12, 2026
Merged

tiredIsa merged 1 commit into
native-v2from
feat/device-pulled-playout

Conversation

@tiredIsa

@tiredIsa tiredIsa commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

Lets an application clock remote audio from its own output device (syrnike13-app issue #164).

  • livekit::setExternalAudioPlayout(bool) — stops/resumes the synthetic device's 10 ms timer pulls.
  • livekit::pullAudioPlayout() — one synchronous 10 ms NeedMorePlayData on the caller's thread; remote track sinks (FreshAudioStream) complete before it returns.
  • C ABI: livekit_ffi_set_external_audio_playout, livekit_ffi_pull_audio_playout.

Default behaviour is unchanged.

Verification (local, Windows):

  • cargo test -p libwebrtc --lib external_playout_delivers_remote_frames_before_return: 100 immediate reads on the caller thread, 0 queue drops, timer resumes after disabling.
  • cargo test -p livekit --lib rtc_engine::lk_runtime::tests: one shared factory/ADM per process.
  • ctest -R AudioSourceTest: 8 passed.
  • App call bench with this SDK: playout latency 33→22 ms idle, 72→22 ms under CPU load and while viewing a screen share; 0 dropped/discontinuous frames.

🤖 Generated with Claude Code


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.

Applications that render remote audio themselves can now clock WebRTC from
their output device instead of the synthetic device's 10 ms timer:

- livekit::setExternalAudioPlayout(true) stops the internal timer pulls.
- livekit::pullAudioPlayout() performs one 10 ms NeedMorePlayData on the
  caller's thread; remote track sinks (FreshAudioStream) complete before it
  returns, so the application reads the new frame immediately.

One clock removes the drift and queue contention between the SDK timer and
the device (dropped frames, extra 20 ms of priming). Default behaviour is
unchanged; disabling external mode resumes the timer.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@tiredIsa
tiredIsa merged commit f9e9908 into native-v2 Oct 12, 2026
2 of 3 checks passed
@coderabbitai

coderabbitai Bot commented Oct 12, 2026

Copy link
Copy Markdown

Review in Change Stack →

Note

Currently processing new changes in this PR. This may take a few minutes, please wait...

⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 9dc3fb17-5a37-420c-89b2-31115cbea84c

📥 Commits

Reviewing files that changed from the base of the PR and between d86197b and 8bd7c54.


📒 Files selected for processing (4)
  • docs/fresh-audio-stream.md
  • include/livekit/livekit.h
  • patches/client-sdk-rust/0001-native-v2-runtime.patch
  • src/livekit.cpp

 _______________________________________________________________________________________________________________________________________________________________
< English is just a programming language. Write documents as you would write code: honor the DRY principle, use metadata, MVC, automatic generation, and so on. >
 ---------------------------------------------------------------------------------------------------------------------------------------------------------------
  \
   \   \
        \ /\
        ( )
      .( o ).
✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR

🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant