public PeerConnectionFactoryNative(Context context)
        {
            _context = context;

            EglBaseContext = EglBaseHelper.Create().EglBaseContext;

            _factory     = CreateNativeFactory(context, EglBaseContext);
            NativeObject = _factory;
        }
        private static PeerConnectionFactory CreateNativeFactory(Context context, IEglBaseContext eglBaseContext)
        {
            var adm = CreateJavaAudioDevice(context);

            var encoderFactory = new DefaultVideoEncoderFactory(eglBaseContext, true, true);
            var decoderFactory = new DefaultVideoDecoderFactory(eglBaseContext);
            var factory        = PeerConnectionFactory.InvokeBuilder()
                                 .SetAudioDeviceModule(adm)
                                 .SetVideoEncoderFactory(encoderFactory)
                                 .SetVideoDecoderFactory(decoderFactory)
                                 .CreatePeerConnectionFactory();

            adm.Release();

            return(factory);
        }
 // Disconnect from remote resources, dispose of local resources, and exit.
 private void disconnectAndExit()
 {
     lock (quit[0])
     {
         if (quit[0] == Boolean.True)
         {
             return;
         }
         quit[0] = Boolean.True;
         if (pc != null)
         {
             pc.Dispose();
             pc = null;
         }
         if (appRtcClient != null)
         {
             appRtcClient.sendMessage("{\"type\": \"bye\"}");
             appRtcClient.disconnect();
             appRtcClient = null;
         }
         if (videoSource != null)
         {
             videoSource.Dispose();
             videoSource = null;
         }
         if (factory != null)
         {
             factory.Dispose();
             factory = null;
         }
         Finish();
     }
 }
        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...");
        }
Ejemplo n.º 5
0
 public void ShutdownInternalTracer()
 {
     PeerConnectionFactory.ShutdownInternalTracer();
 }
Ejemplo n.º 6
0
 public void StopInternalTracingCapture()
 {
     PeerConnectionFactory.StopInternalTracingCapture();
 }