Exemplo n.º 1
0
 public void TearDown()
 {
     if (Interlocked.CompareExchange(ref _initialisationState, 2, 1) == 1)
     {
         PeerConnectionFactoryInterop.TearDown(Handle);
     }
 }
Exemplo n.º 2
0
        public PeerConnection CreatePeerConnection(PeerConnectionObserver observer, PeerConnectionConfig config)
        {
            if (observer is null)
            {
                throw new ArgumentNullException(nameof(observer));
            }
            if (config is null)
            {
                throw new ArgumentNullException(nameof(config));
            }

            var interopIceServers = config.IceServers.Select(s => new PeerConnectionFactoryInterop.IceServerConfig
            {
                Username           = s.Username,
                Password           = s.Password,
                CommaSeperatedUrls = string.Join(';', s.Urls)
            }).ToArray();

            return(new PeerConnection(PeerConnectionFactoryInterop.CreatePeerConnection(
                                          Handle,
                                          interopIceServers,
                                          interopIceServers.Count(),
                                          observer.Native),
                                      observer,
                                      SignallingThread));
        }
Exemplo n.º 3
0
 public void Initialize()
 {
     if (Interlocked.CompareExchange(ref _initialisationState, 1, 0) >= 1)
     {
         throw new InvalidOperationException();
     }
     PeerConnectionFactoryInterop.Initialize(Handle);
     SignallingThread = new RtcThread(PeerConnectionFactoryInterop.GetSignallingThread(Handle));
 }
Exemplo n.º 4
0
 /// <summary>
 /// Create a video track that gets frame from provided source
 /// </summary>
 /// <param name="videoTrackName"></param>
 /// <param name="source"></param>
 /// <returns></returns>
 /// <remarks>This can be called on any thread</remarks>
 public VideoTrack CreateVideoTrack(string videoTrackName, PassiveVideoTrackSource source)
 {
     RequireInitialised();
     return(new VideoTrack(PeerConnectionFactoryInterop.CreateVideoTrack(Handle, source.Handle, videoTrackName)));
 }
 public PeerConnectionFactorySafeHandle()
     : base(PeerConnectionFactoryInterop.Create())
 {
 }
 protected override void ReleaseHandle(IntPtr handle) => PeerConnectionFactoryInterop.Destroy(handle);