You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(audio): add AudioProcessingOptions and adopt webrtc-sdk state v2 contract
Introduce AudioProcessingOptions and wire it through AudioCaptureOptions,
AudioManager, and LocalAudioTrack.
The audio processing state read-back moved from PeerConnection to the
factory upstream, so the per-publisher source registry is gone:
AudioManager reads the factory-owned engine-wide state directly. State
types follow the v2 vocabulary (requested -> resolved -> active ->
effective) with collapsed booleans, and the device-level BuiltIn* types
are renamed Platform*. ADM voice-processing calls target the renamed
isPlatformVoiceProcessingAllowed accessors. Docs/audio.md updated to match.
This restarts the internal `AVAudioEngine`to apply the change. It can cause a short audio glitch, so it is recommended to set it once before connecting to a Room. Disabling voice processing also disables muted speaker detection.
59
+
This restarts the internal `AVAudioEngine`when an Apple VPIO path is active. It is recommended to set it once before connecting to a Room. Runtime `AudioProcessingOptions` with `automatic` mode will fall back to WebRTC software processing while platform voice processing is disallowed.
60
60
61
-
If your app requires toggling voice processing at run-time, it is recommended to use:
61
+
For per-track or per-capture software processing, use `AudioProcessingOptions` with `.software` modes. The lower-level bypass API remains available when you need to directly control Apple VPIO:
Set it back to `false` to re-enable processing. This uses `AVAudioEngine`'s [isVoiceProcessingBypassed](https://developer.apple.com/documentation/avfaudio/avaudioinputnode/isvoiceprocessingbypassed) and works seamlessly at run-time.
67
+
Set it back to `false` to re-enable the Apple path. This uses `AVAudioEngine`'s [isVoiceProcessingBypassed](https://developer.apple.com/documentation/avfaudio/avaudioinputnode/isvoiceprocessingbypassed). Runtime `AudioProcessingOptions` can overwrite this Apple-specific state when capture starts or options are reapplied.
/// The main flag that determines whether to enable Voice-Processing I/O of the internal AVAudioEngine. Toggling this requires restarting the AudioEngine.
324
-
/// Setting this to `false` prevents any voice-processing-related initialization, and muted talker detection will not work.
325
-
/// Typically, it is recommended to keep this set to `true` and toggle ``isVoiceProcessingBypassed`` when possible.
326
-
/// Defaults to `true`.
323
+
/// Whether Apple's platform voice processing is allowed.
324
+
///
325
+
/// Defaults to `true`. When set to `false`, runtime ``AudioProcessingOptions``
326
+
/// treat Apple Voice Processing I/O as unavailable. `automatic` mode falls
327
+
/// back to WebRTC software processing and `platform` mode is rejected.
328
+
///
329
+
/// Use ``AudioProcessingOptions`` with `.software` modes for per-track or
330
+
/// per-capture software voice processing. Use this policy when the app must
331
+
/// guarantee Apple Voice Processing I/O is not used.
/// Enables manual rendering (no-device) mode of AVAudioEngine.
363
385
/// In this mode, you can provide audio buffers by calling `AudioManager.shared.mixer.capture(appAudio:)` continuously.
364
386
/// Remote audio will not play out automatically. Get remote mixed audio buffers with `AudioManager.shared.add(localAudioRenderer:)` or individual tracks with ``RemoteAudioTrack/add(audioRenderer:)``.
@@ -383,22 +405,31 @@ public class AudioManager: Loggable {
383
405
/// which keeps recording initialized and pre-warms voice processing.
384
406
///
385
407
/// - Parameter enabled: Pass `true` to enable always-prepared recording, or `false` to disable it.
408
+
/// - Parameter audioProcessingOptions: Optional voice-processing options used when prewarming mic input.
386
409
/// - Note: If `audioSession.isAutomaticConfigurationEnabled` is `true`, the session category is configured to `.playAndRecord`.
387
410
/// - Note: Microphone permission is required. iOS may prompt if not already granted.
388
411
/// - Note: This persists across ``Room`` lifecycles and connections until disabled.
389
412
/// - Throws: An error if the underlying audio device module fails to apply the setting.
0 commit comments