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); } }
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); }
public RtspPlayer( IRtspClient rtspClient, IRtpClient rtpClient, IRtcpClient rtcpClient, IRtcpReceptionReportScheduler receptionReportScheduler) { _rtspClient = rtspClient; _rtpClient = rtpClient; _rtcpClient = rtcpClient; _receptionReportScheduler = receptionReportScheduler; ReceiveRtpLoop(); ReceiveRtcpLoop(); }
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); } } }
public void Create_WithVideoSourceOne_ClientVideoSourceIdIsCorrect() { IRtspClient rtspClient = _rtspClientFactory.Create(_videoSourcesFixtures.VideoSourceOne); Assert.True(rtspClient.VideoSourceId == _videoSourcesFixtures.VideoSourceOneId); }