Draft: Platform Audio#140
Draft
stephen-derosa wants to merge 3 commits into
Draft
Conversation
There was a problem hiding this comment.
Pull request overview
This PR introduces a new PlatformAudio API to expose WebRTC platform audio (ADM-backed capture/playout with voice processing) through the C++ SDK’s FFI layer, and wires it into LocalAudioTrack creation, with docs and unit coverage.
Changes:
- Add public
PlatformAudio/PlatformAudioSourceAPI and FFI-backed implementation. - Add
LocalAudioTrack::createLocalAudioTrackoverload forPlatformAudioSource. - Add README documentation and new unit tests for platform audio behavior.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| src/tests/unit/test_platform_audio.cpp | Adds unit tests covering default options, device info fields, and creating a track from a platform source. |
| src/platform_audio.cpp | Implements PlatformAudio and PlatformAudioSource over synchronous FFI requests. |
| src/local_audio_track.cpp | Adds shared helper for track creation and an overload accepting PlatformAudioSource. |
| README.md | Documents recommended usage of PlatformAudio vs AudioSource, with a C++ example. |
| include/livekit/platform_audio.h | Adds the public PlatformAudio API surface, options, device info, and error type with Doxygen docs. |
| include/livekit/local_audio_track.h | Adds forward declaration + new overload and expands/updates Doxygen docs. |
| include/livekit/livekit.h | Exposes platform_audio.h from the umbrella header. |
| CMakeLists.txt | Adds src/platform_audio.cpp to the shared library build. |
| AGENTS.md | Updates threading-model docs and adds PlatformAudio to the thread-safety table. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+43
to
+45
| **FFI callback thread** — The Rust FFI layer calls `LivekitFfiCallback` from a Rust-managed thread (typically a Tokio runtime thread). This single entry point deserializes the `FfiEvent` and calls `FfiClient::PushEvent`, which: | ||
| 1. Completes any pending async `std::promise` matched by `async_id`. | ||
| 2. Invokes all registered `FfiClient` listeners (including `Room::onEvent`). | ||
| 2. Invokes all registered `FfiClient` listeners (including `Room::OnEvent`). |
| msg->set_name(name); | ||
| msg->set_source_handle(source_handle); | ||
|
|
||
| const proto::FfiResponse resp = FfiClient::instance().sendRequest(req); |
Comment on lines
+181
to
+182
| const auto& source = resp.new_audio_source().source(); | ||
| FfiHandle handle(static_cast<uintptr_t>(source.handle().id())); |
|
|
||
| #include <utility> | ||
|
|
||
| #include "audio_frame.pb.h" |
6a9b8a6 to
b81c405
Compare
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.
Overview
Implement PlatformAudio over ffi