Beispiel #1
0
        private void _Run(
            RTCConfiguration?conf           = null,
            bool?hardwareEncoder            = null,
            ISignaling signaling            = null,
            SignalingHandlerBase[] handlers = null
            )
        {
            RTCConfiguration _conf =
                conf.GetValueOrDefault(new RTCConfiguration {
                iceServers = iceServers
            });

            if (hardwareEncoder != null)
            {
                hardwareEncoderSupport = hardwareEncoder.Value;
            }
            var encoderType = hardwareEncoderSupport ? EncoderType.Hardware : EncoderType.Software;

            if (signaling != null)
            {
                signalingType = signaling.GetType().FullName;

                //todo:: This property is not needed by FurioosSignaling.
                urlSignaling = signaling.Url;
                interval     = signaling.Interval;
            }
            ISignaling _signaling = signaling ?? CreateSignaling(
                signalingType, urlSignaling, interval, SynchronizationContext.Current);
            RenderStreamingDependencies dependencies = new RenderStreamingDependencies
            {
                config              = _conf,
                encoderType         = encoderType,
                signaling           = _signaling,
                startCoroutine      = StartCoroutine,
                resentOfferInterval = interval,
            };
            var _handlers = (handlers ?? this.handlers.AsEnumerable()).Where(_ => _ != null);

            if (_handlers.Count() == 0)
            {
                throw new InvalidOperationException("Handler list is empty.");
            }

            m_instance = new RenderStreamingInternal(ref dependencies);
            m_provider = new SignalingEventProvider(m_instance);

            foreach (var handler in _handlers)
            {
                handler.SetHandler(m_instance);
                m_provider.Subscribe(handler);
            }
            m_running = true;
        }
Beispiel #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="conf"></param>
        /// <param name="hardwareEncoder"></param>
        /// <param name="signaling"></param>
        /// <param name="handlers"></param>
        public void Run(
            RTCConfiguration?conf           = null,
            bool?hardwareEncoder            = null,
            ISignaling signaling            = null,
            SignalingHandlerBase[] handlers = null
            )
        {
            RTCConfiguration _conf =
                conf.GetValueOrDefault(new RTCConfiguration {
                iceServers = iceServers
            });

            if (hardwareEncoder != null)
            {
                hardwareEncoderSupport = hardwareEncoder.Value;
            }
            var encoderType = hardwareEncoderSupport ? EncoderType.Hardware : EncoderType.Software;

            if (signaling != null)
            {
                signalingType = signaling.GetType().FullName;

                //todo:: This property is not needed by FurioosSignaling.
                urlSignaling = signaling.Url;
                interval     = signaling.Interval;
            }
            ISignaling _signaling = signaling ?? CreateSignaling(
                signalingType, urlSignaling, interval, SynchronizationContext.Current);
            RenderStreamingDependencies dependencies = new RenderStreamingDependencies
            {
                config              = _conf,
                encoderType         = encoderType,
                signaling           = _signaling,
                startCoroutine      = StartCoroutine,
                resentOfferInterval = interval,
            };

            m_instance = new RenderStreamingInternal(ref dependencies);
            m_provider = new SignalingEventProvider(m_instance);

            SignalingHandlerBase[] _handlers = handlers ?? this.handlers.ToArray();

            foreach (var source in _handlers)
            {
                source.SetHandler(m_instance);
                m_provider.Subscribe(source);
            }
            m_running = true;
        }