public PeerConnection(PeerConnectionOptions options) { Name = options.Name ?? $"PC#{Interlocked.Increment(ref g_LastId)}"; _nativePtr = Native.CreatePeerConnection( options.TurnServers.ToArray(), options.TurnServers.Count, options.StunServers.ToArray(), options.StunServers.Count, options.UserName, options.PassWord, options.CanReceiveAudio, options.CanReceiveVideo, options.IsDtlsSrtpEnabled); Native.Check(_nativePtr != IntPtr.Zero); RegisterCallback(out _localDataChannelReadyDelegate, Native.RegisterOnLocalDataChannelReady, RaiseLocalDataChannelReady); RegisterCallback(out _dataAvailableDelegate, Native.RegisterOnDataFromDataChannelReady, RaiseDataAvailable); RegisterCallback(out _failureMessageDelegate, Native.RegisterOnFailure, RaiseFailureMessage); RegisterCallback(out _audioBusReadyDelegate, Native.RegisterOnAudioBusReady, RaiseAudioBusReady); RegisterCallback(out _localVideoFrameDelegate, Native.RegisterLocalVideoFrameReady, RaiseLocalVideoFrameReady); RegisterCallback(out _remoteVideoFrameDelegate, Native.RegisterRemoteVideoFrameReceived, RaiseRemoteVideoFrameReady); RegisterCallback(out _localSdpReadyToSendDelegate, Native.RegisterOnLocalSdpReadyToSend, RaiseLocalSdpReadyToSend); RegisterCallback(out _iceCandidateReadyToSendDelegate, Native.RegisterOnIceCandidateReadyToSend, RaiseIceCandidateReadyToSend); RegisterCallback(out _signalingStateChangedCallback, Native.RegisterSignalingStateChanged, RaiseSignalingStateChange); RegisterCallback(out _connectionStateChangedCallback, Native.RegisterConnectionStateChanged, RaiseConnectionStateChange); RegisterCallback(out _videoFrameProcessedCallback, Native.RegisterVideoFrameProcessed, RaiseVideoFrameProcessedDelegate); RegisterCallback(out _remoteTrackChangedCallback, Native.RegisterRemoteTrackChanged, RaiseRemoteTrackChanged); }
public ObservablePeerConnection(PeerConnectionOptions options) : base(options) { _disposables.Add(_localSessionDescriptionStream); _disposables.Add(_localIceCandidateStream); _disposables.Add(_receivedDataStream); _disposables.Add(_receivedVideoStream); _disposables.Add(_localVideoFrameProcessedStream); _disposables.Add(_remoteTrackChangeStream); }
public ObservablePeerConnection(PeerConnectionOptions options) : base(options) { }