public Task GetTransceivers_NoTransceiver_ReturnsEmptyList()
 {
     return(_signallingThread.ExecuteAsync(delegate
     {
         using (var peerConnectionObserver = new PeerConnectionObserver())
             using (var peerConnection = _peerConnectionFactory.CreatePeerConnection(peerConnectionObserver, _config))
             {
                 Assert.Equal(0, peerConnection.GetTransceivers().Count);
             }
     }));
 }
Пример #2
0
        public PeerConnectionAdapter(
            PeerConnectionFactory peerConnectionFactory,
            VideoRouter videoRouter,
            IRoom room,
            IRemoteDevice device,
            IReadOnlyList <string> stunUrls)
        {
            if (peerConnectionFactory is null)
            {
                throw new ArgumentNullException(nameof(peerConnectionFactory));
            }
            if (stunUrls is null)
            {
                throw new ArgumentNullException(nameof(stunUrls));
            }
            Room         = room ?? throw new ArgumentNullException(nameof(room));
            Device       = device ?? throw new ArgumentNullException(nameof(device));
            _videoRouter = videoRouter
                           ?? throw new ArgumentNullException(nameof(videoRouter));
            var iceServerInfo = new PeerConnectionConfig.IceServerInfo();

            foreach (var url in stunUrls)
            {
                iceServerInfo.Urls.Add(url);
            }
            var config = new PeerConnectionConfig();

            config.IceServers.Add(iceServerInfo);
            _peerConnectionObserverImpl = new PeerConnectionObserver();
            _peerConnectionObserverImpl.IceCandidateAdded   += IceCandidateAdded;
            _peerConnectionObserverImpl.RenegotiationNeeded += RenegotationNeeded;
            _peerConnectionImpl = peerConnectionFactory.CreatePeerConnection(_peerConnectionObserverImpl, config);
        }
Пример #3
0
        private void CreatePeerConnectionInternal()
        {
            var rtcConfig = new PeerConnection.RTCConfiguration(new List <PeerConnection.IceServer>())
            {
                TcpCandidatePolicy       = PeerConnection.TcpCandidatePolicy.Disabled,
                BundlePolicy             = PeerConnection.BundlePolicy.Maxbundle,
                RtcpMuxPolicy            = PeerConnection.RtcpMuxPolicy.Require,
                ContinualGatheringPolicy = PeerConnection.ContinualGatheringPolicy.GatherContinually,
                KeyType        = PeerConnection.KeyType.Ecdsa,
                EnableDtlsSrtp = new Java.Lang.Boolean(true),
                SdpSemantics   = PeerConnection.SdpSemantics.UnifiedPlan
            };

            _peerConnection = _factory.CreatePeerConnection(rtcConfig, this);

            var mediaStreamLabels = new List <string> {
                "ARDAMS"
            };

            _peerConnection.AddTrack(CreateVideoTrack(_videoCapturer), mediaStreamLabels);
            _peerConnection.AddTrack(CreateAudioTrack(), mediaStreamLabels);
        }
Пример #4
0
        public void onIceServers(IList <PeerConnection.IceServer> iceServers)
        {
            factory = new PeerConnectionFactory();
            pc      = factory.CreatePeerConnection(iceServers, appRtcClient.pcConstraints(), pcObserver);

            // Uncomment to get ALL WebRTC tracing and SENSITIVE libjingle logging.
            // NOTE: this _must_ happen while |factory| is alive!
            // Logging.enableTracing(
            //     "logcat:",
            //     EnumSet.of(Logging.TraceLevel.TRACE_ALL),
            //     Logging.Severity.LS_SENSITIVE);

            {
                PeerConnection finalPC = pc;
                //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
                //ORIGINAL LINE: final Runnable repeatedStatsLogger = new Runnable()
                IRunnable repeatedStatsLogger = new RunnableAnonymousInnerClassHelper(this, finalPC);
                vsv.PostDelayed(repeatedStatsLogger, 10000);
            }

            {
                logAndToast("Creating local video source...");
                MediaStream lMS = factory.CreateLocalMediaStream("ARDAMS");
                if (appRtcClient.videoConstraints() != null)
                {
                    VideoCapturer capturer = VideoCapturer;
                    videoSource = factory.CreateVideoSource(capturer, appRtcClient.videoConstraints());
                    VideoTrack videoTrack = factory.CreateVideoTrack("ARDAMSv0", videoSource);
                    videoTrack.AddRenderer(new VideoRenderer(new VideoCallbacks(this, vsv, VideoStreamsView.Endpoint.LOCAL)));
                    lMS.AddTrack(videoTrack);
                }
                lMS.AddTrack(factory.CreateAudioTrack("ARDAMSa0"));
                pc.AddStream(lMS, new MediaConstraints());
            }
            logAndToast("Waiting for ICE candidates...");
        }