/// <summary> /// /// </summary> public override void Dispose() { if (this.disposed) { return; } if (self != IntPtr.Zero && !WebRTC.Context.IsNull) { if (_audioCapturer != null) { // Unity API must be called from main thread. _audioCapturer.onAudioRead -= SetData; WebRTC.DestroyOnMainThread(_audioCapturer); } if (_streamRenderer != null) { _streamRenderer?.Dispose(); _streamRenderer = null; } _trackSource?.Dispose(); _trackSource = null; } base.Dispose(); }
/// <summary> /// /// </summary> public override void Dispose() { if (this.disposed) { return; } if (self != IntPtr.Zero && !WebRTC.Context.IsNull) { if (_audioSourceRead != null) { // Unity API must be called from main thread. _audioSourceRead.onAudioRead -= SetData; WebRTC.DestroyOnMainThread(_audioSourceRead); } _streamRenderer?.Dispose(); _source?.Dispose(); WebRTC.Context.AudioTrackUnregisterAudioReceiveCallback(self); } base.Dispose(); }