Exemplo n.º 1
0
 void RTSPClientStopped(IRtspClient sender, RtspClientStopReason reason)
 {
     if (reason != RtspClientStopReason.COMMAND)
     {
         List <Guid> connectionIds;
         _serverConnectionsDictionary.Remove(sender.VideoSourceId, out connectionIds);
         DeleteFailedRtspClient(sender.VideoSourceId);
         _rtspServer.ForceDisconnectPool(connectionIds);
     }
 }
Exemplo n.º 2
0
        private byte[] GetSdpByRtspClient(IRtspClient rtspClient, Guid connectionId)
        {
            _logger.Trace($"Waiting RTSP client ready for video source {rtspClient.VideoSourceId} connection {connectionId}");
            if (rtspClient.WaitReady())
            {
                _logger.Trace($"Waiting RTSP client ready SUCCESS for video source {rtspClient.VideoSourceId} connection {connectionId}");
                return(rtspClient.SdpData);
            }

            _logger.Error($"Waiting RTSP client ready FAILED for video source {rtspClient.VideoSourceId} connection {connectionId}");
            return(null);
        }
Exemplo n.º 3
0
 public RtspPlayer(
     IRtspClient rtspClient,
     IRtpClient rtpClient,
     IRtcpClient rtcpClient,
     IRtcpReceptionReportScheduler receptionReportScheduler)
 {
     _rtspClient = rtspClient;
     _rtpClient  = rtpClient;
     _rtcpClient = rtcpClient;
     _receptionReportScheduler = receptionReportScheduler;
     ReceiveRtpLoop();
     ReceiveRtcpLoop();
 }
Exemplo n.º 4
0
        protected void RTSPClientReceivedData(IRtspClient sender, int channel, byte[] data)
        {
            _testRtpDataEvent.Reset();

            lock (_sychSendToConnections)
            {
                List <Guid> connectionIds = _serverConnectionsDictionary.GetValueOrDefault(sender.VideoSourceId, new List <Guid>());
                int         index         = 0;
                while (index < connectionIds.Count)
                {
                    Guid connectionId;
                    try
                    {
                        connectionId = connectionIds[index];
                        index++;
                    }
                    catch
                    {
                        break;
                    }

                    ThreadPool.QueueUserWorkItem(delegate(object state){
                        if (channel == sender.VideoRtpChannel)
                        {
                            _rtspServer.SendRtpVideoData(connectionId, data);
                        }
                        if (channel == sender.AudioRtpChannel)
                        {
                            _rtspServer.SendRtpAudioData(connectionId, data);
                        }
                        if (channel == sender.VideoRtcpChannel)
                        {
                            _rtspServer.SendRtcpVideoData(connectionId, data);
                        }
                        if (channel == sender.AudioRtcpChannel)
                        {
                            _rtspServer.SendRtcpAudioData(connectionId, data);
                        }
                        _testRtpDataEvent.Set();
                    }, null);
                }
            }
        }
Exemplo n.º 5
0
        public void Create_WithVideoSourceOne_ClientVideoSourceIdIsCorrect()
        {
            IRtspClient rtspClient = _rtspClientFactory.Create(_videoSourcesFixtures.VideoSourceOne);

            Assert.True(rtspClient.VideoSourceId == _videoSourcesFixtures.VideoSourceOneId);
        }