Example #1
0
        public void OnPeerFactoryCreated(IPeerConnectionFactory factory)
        {
            var androidFactory = (IPeerConnectionFactoryAndroid)factory.NativeObject;

            PipScreenRenderer.Init(androidFactory.EglBaseContext, null);
            FullScreenRenderer.Init(androidFactory.EglBaseContext, null);
        }
Example #2
0
 public PeerConnectionNative(PeerConnection peerConnection, RTCConfiguration configuration,
                             IPeerConnectionFactory peerConnectionFactory) : base(peerConnection)
 {
     _peerConnection       = peerConnection;
     Configuration         = configuration;
     PeerConnectionFactory = peerConnectionFactory;
 }
 public PeerConnectionNative(RTCPeerConnection peerConnection, Abstraction.RTCConfiguration configuration,
                             IPeerConnectionFactory factory, IRTCPeerConnectionDelegate peerConnectionDelegate) : base(peerConnection)
 {
     _peerConnection         = peerConnection;
     _peerConnectionDelegate = peerConnectionDelegate;
     Configuration           = configuration;
     PeerConnectionFactory   = factory;
 }
 public IVideoCapturer CreateVideoCapturer(IPeerConnectionFactory factory, IVideoSource videoSource)
 {
     if (!isSimulator)
     {
         return(factory.CreateCameraCapturer(videoSource, true));
     }
     fileCapturerController = new FileCapturerController(videoSource);
     return(fileCapturerController);
 }
Example #5
0
        private void CloseInternal()
        {
            if (_factory != null && _parameters.AecDump)
            {
                _factory.StopAecDump();
            }

            _logger.Debug(TAG, "Closing peer connection.");
            if (_rtcEventLog != null)
            {
                // RtcEventLog should stop before the peer connection is disposed.
                _rtcEventLog.Stop();
                _rtcEventLog = null;
            }

            _logger.Debug(TAG, "Closing audio source.");
            if (_audioSource != null)
            {
                _audioSource.Dispose();
                _audioSource = null;
            }

            _logger.Debug(TAG, "Stopping capturer.");
            if (_videoCapturer != null)
            {
                _videoCapturer.StopCapture();
                _videoCapturer.Dispose();
                _videoCapturerStopped = true;
                _videoCapturer        = null;
            }

            _logger.Debug(TAG, "Closing video source.");
            if (_videoSource != null)
            {
                _videoSource.Dispose();
                _videoSource = null;
            }

            _localRenderer  = null;
            _remoteRenderer = null;
            _logger.Debug(TAG, "Closing peer connection factory.");
            if (_factory != null)
            {
                _factory.Dispose();
                _factory = null;
            }

            _logger.Debug(TAG, "Closing peer connection done.");
            _peerConnectionEvents.OnPeerConnectionClosed();
            PeerConnectionFactory.StopInternalTracingCapture();
            PeerConnectionFactory.ShutdownInternalTracer();

            _executor.Release();
        }
Example #6
0
        /// <summary>
        /// This function should only be called once.
        /// </summary>
        public void CreatePeerConnectionFactory()
        {
            if (_factory != null)
            {
                throw new InvalidOperationException("PeerConnectionFactory has already been constructed");
            }

            _executor.Execute(() =>
            {
                _factory = new PeerConnectionFactory();
                _peerConnectionEvents.OnPeerFactoryCreated(_factory);
            });
        }
 public ServerPeerFactory(ILogger <ServerPeerFactory> logger,
                          ILoggerFactory loggerFactory,
                          IEventBus eventBus,
                          IEnumerable <IServerPeerConnectionGuard> serverPeerConnectionGuards,
                          IOptions <ForgeServerSettings> settings,
                          IPeerConnectionFactory peerConnectionFactory
                          )
 {
     this.logger        = logger;
     this.loggerFactory = loggerFactory;
     this.eventBus      = eventBus;
     this.serverPeerConnectionGuards = serverPeerConnectionGuards;
     this.peerConnectionFactory      = peerConnectionFactory;
     this.settings = settings?.Value ?? throw new ArgumentNullException(nameof(settings));
 }
Example #8
0
        public ServerPeer(ILogger <ServerPeer> logger,
                          IEventBus eventBus,
                          IPEndPoint localEndPoint,
                          IPEndPoint remoteEndPoint,
                          IEnumerable <IServerPeerConnectionGuard> serverPeerConnectionGuards,
                          IPeerConnectionFactory peerConnectionFactory)
        {
            this.logger   = logger;
            this.eventBus = eventBus;
            this.serverPeerConnectionGuards = serverPeerConnectionGuards;
            this.peerConnectionFactory      = peerConnectionFactory;
            this.LocalEndPoint  = localEndPoint.EnsureIPv6();
            this.RemoteEndPoint = remoteEndPoint.EnsureIPv6();

            this.connectedPeers = new Dictionary <string, IPeerConnection>();

            this.listenerCancellation = new CancellationTokenSource();

            this.tcpListener = new ForgeTcpListener(this.LocalEndPoint);

            this.onPeerDisconnectedSubscription = this.eventBus.Subscribe <PeerDisconnected>(this.OnPeerDisconnected);
        }
 public IVideoCapturer CreateVideoCapturer(IPeerConnectionFactory factory, IVideoSource videoSource)
 {
     return(Events.CreateVideoCapturer(factory, videoSource));
 }
 public void OnPeerFactoryCreated(IPeerConnectionFactory factory)
 {
     Executor.Execute(() => { Events.OnPeerFactoryCreated(factory); });
 }
Example #11
0
 public WebRTC.Interfaces.IVideoCapturer CreateVideoCapturer(IPeerConnectionFactory factory, IVideoSource videoSource) =>
 factory.CreateCameraCapturer(videoSource, true);
 public PeerConnectionFactory(IVideoEncoderFactory encoderFactory = null, IVideoDecoderFactory decoderFactory = null)
 {
     _peerConnectionFactory = NativeFactory.CreatePeerConnectionFactory();
 }
 public PeerConnectionFactory()
 {
     _peerConnectionFactory = NativeFactory.CreatePeerConnectionFactory();
 }
Example #14
0
 public PeerConnectionNative(RTCPeerConnection peerConnection, Abstraction.RTCConfiguration configuration, IPeerConnectionFactory factory)
 {
     _peerConnection       = peerConnection;
     Configuration         = configuration;
     PeerConnectionFactory = factory;
 }
 public PlatformPeerConnection(RTCPeerConnection peerConnection, Core.RTCConfiguration configuration, IPeerConnectionFactory peerConnectionFactory)
 {
     _peerConnection       = peerConnection;
     Configuration         = configuration;
     PeerConnectionFactory = peerConnectionFactory;
 }
 public void OnPeerFactoryCreated(IPeerConnectionFactory peerConnectionFactory)
 {
 }