feat(audio): runtime audio processing options and engine-wide state read-back#1107
Merged
Conversation
787a0a3 to
50de779
Compare
Introduce AudioProcessingMode and AudioProcessingOptions in track options, plus LocalAudioTrack.setAudioProcessingOptions() to apply per-component echo cancellation / noise suppression / auto gain control / high-pass filter modes at runtime. AudioCaptureOptions now carries these processing fields and serializes the per-component modes into its capture constraints. Updates are currently delegated to flutter_webrtc; a follow-up moves the implementation into this SDK's own native plugin.
Move setAudioProcessingOptions off flutter_webrtc's Dart API and onto
this SDK's own `livekit_client` method channel. The iOS/macOS and Android
plugins resolve the local track from flutter_webrtc's shared registry and
call the WebRTC AudioEngine setAudioProcessingOptions API directly,
returning {result, code, message}.
This removes the dependency on fork-only flutter_webrtc Dart symbols
(rtc.AudioProcessingOptions / rtc.AudioProcessingMode), so the SDK once
again analyzes cleanly against the published flutter_webrtc package.
LocalAudioTrack.setAudioProcessingOptions returns an
AudioProcessingApplyResult (code + message + isSuccess) for operational
outcomes — applied/stored, and the device-capability rejections
platform-unavailable / apply-failed (inspect isSuccess). It throws
AudioProcessingException only for malformed requests (invalid mode
combination, or a non-local track).
The native plugin handlers return {result, code, message}; the Dart side
maps the code into the result or the exception accordingly.
Surfaces the WebRTC-SDK v2 audio processing state on AudioManager: the audio processing module is owned by the native peer connection factory and shared engine-wide, so the snapshot reflects what is actually applied across the engine rather than any single track. Dart models follow the v2 contract per component: requested (caller intent, null when nothing was ever applied) -> software/platform resolved -> active, with effective as the merged verdict. The iOS and Android plugins read factory.audioProcessingState and serialize it over the method channel; Android reaches the factory through the flutter_webrtc getPeerConnectionFactory accessor.
50de779 to
01354e6
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.
What
Runtime control of audio processing (AEC / NS / AGC / HPF) for local audio tracks, plus an engine-wide diagnostic read-back, built on the WebRTC-SDK audio processing options API (webrtc-sdk/webrtc#247 + webrtc-sdk/webrtc#254).
API
Set —
AudioProcessingOptionswith per-component enabled flags and modes (automatic/platform/software), applied either at capture time viaAudioCaptureOptionsor at runtime:Caller bugs (invalid combination, remote track) throw
AudioProcessingException; legitimate outcomes return a typedAudioProcessingApplyResult(applied/stored/ rejections).Read — the audio processing module is owned by the native peer connection factory and shared engine-wide, so the snapshot lives on
AudioManager:Per component:
requested(nullable — null means nothing was ever applied),isSoftwareResolved/isSoftwareActive,isPlatformAvailable/isPlatformResolved/isPlatformActive, andeffectiveas the merged verdict. Same requested → resolved → active → effective vocabulary as the native SDKs.Commits
Bottom-up, each builds standalone:
chore(deps): WebRTC-SDK pin bumpAudioProcessingOptionsforLocalAudioTrackAudioManagerDependencies / not yet done
144.7559.08— will bump to144.7559.09(which carries the state v2 API from Audio processing state v2: factory-owned read-back, redesigned state API webrtc-sdk/webrtc#254) once published. The state read-back native code requires.09to compile.FlutterWebRTCPlugin.getPeerConnectionFactory()— feat(android): expose the peer connection factory to embedders flutter-webrtc/flutter-webrtc#2077..09artifacts.