Skip to content

Draft: Platform Audio#140

Draft
stephen-derosa wants to merge 3 commits into
livekit:mainfrom
stephen-derosa:sderosa/BOT-377-platform-audio
Draft

Draft: Platform Audio#140
stephen-derosa wants to merge 3 commits into
livekit:mainfrom
stephen-derosa:sderosa/BOT-377-platform-audio

Conversation

@stephen-derosa
Copy link
Copy Markdown
Collaborator

Overview

Implement PlatformAudio over ffi

@stephen-derosa stephen-derosa self-assigned this May 27, 2026
Copilot AI review requested due to automatic review settings May 27, 2026 18:01
@stephen-derosa stephen-derosa marked this pull request as draft May 27, 2026 18:01
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 / PlatformAudioSource API and FFI-backed implementation.
  • Add LocalAudioTrack::createLocalAudioTrack overload for PlatformAudioSource.
  • 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 thread AGENTS.md Outdated
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`).
Comment thread src/local_audio_track.cpp
msg->set_name(name);
msg->set_source_handle(source_handle);

const proto::FfiResponse resp = FfiClient::instance().sendRequest(req);
Comment thread src/platform_audio.cpp
Comment on lines +181 to +182
const auto& source = resp.new_audio_source().source();
FfiHandle handle(static_cast<uintptr_t>(source.handle().id()));
Comment thread src/platform_audio.cpp

#include <utility>

#include "audio_frame.pb.h"
@stephen-derosa stephen-derosa force-pushed the sderosa/BOT-377-platform-audio branch from 6a9b8a6 to b81c405 Compare May 27, 2026 19:19
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.

2 participants