private async void DoAutoStartActions(WebRTC.PeerConnection nativePeer) { // If a headset is active then do not capture local streams. if (XRDevice.isPresent) { return; } if (AutoStartCapture) { //nativePeer.LocalAudioFrameReady += LocalAudioFrameReady; // TODO - Currently AddLocalAudioTrackAsync() both open the capture device AND add an audio track } if (AutoAddTrack) { // Force again PreferredAudioCodec right before starting the local capture, // so that modifications to the property done after OnPeerInitialized() are // accounted for. nativePeer.PreferredAudioCodec = PreferredAudioCodec; //FrameQueue.Clear(); await nativePeer.AddLocalAudioTrackAsync(); AudioStreamStarted.Invoke(); } }