/// <summary> /// Initializes a new instance of the <see cref="RtspListener"/> class from a TCP connection. /// </summary> /// <param name="connection">The connection.</param> public RtspListener(IRtspTransport connection) { // Contract.EndContractBlock(); _transport = connection ?? throw new ArgumentNullException("connection"); _stream = connection.GetStream(); }
/// <summary> /// Initializes a new instance of the <see cref="RtspListener"/> class from a TCP connection. /// </summary> /// <param name="connection">The connection.</param> public RtspListener(IRtspTransport connection) { if (connection == null) throw new ArgumentNullException("connection"); Contract.EndContractBlock(); _transport = connection; _stream = connection.GetStream(); }
protected virtual void Dispose(bool disposing) { if (disposing) { // Dispose "owned" elements only. _stream?.Dispose(); _stream = null; _transport = null; // Not owned } }
/// <summary> /// Initializes a new instance of the <see cref="RtspListener"/> class from a TCP connection. /// </summary> /// <param name="connection">The connection.</param> public RtspListener(IRtspTransport connection) { if (connection == null) { throw new ArgumentNullException(nameof(connection)); } Contract.EndContractBlock(); _transport = connection; _stream = connection.GetStream(); }
/// <summary> /// Initializes a new instance of the <see cref="RtspListener"/> class from a TCP connection. /// </summary> /// <param name="connection">The connection.</param> public RtspListener(IRtspTransport connection, Subject <string> rtspErrorSubject) { if (connection == null) { throw new ArgumentNullException("connection"); } Contract.EndContractBlock(); _transport = connection; _rtspErrorSubject = rtspErrorSubject; }
public void Init() { // Setup a mock _mockTransport = Substitute.For <IRtspTransport>(); _connected = true; _mockTransport.Connected.Returns(x => { return(_connected); }); _mockTransport.When(x => x.Close()).Do(x => { _connected = false; }); _mockTransport.When(x => x.Reconnect()).Do(x => { _connected = true; }); _receivedData = new List <RtspChunk>(); _receivedMessage = new List <RtspChunk>(); }
public void Init() { // Setup a mock _mockTransport = Substitute.For<IRtspTransport>(); _connected = true; _mockTransport.Connected.Returns(x => { return _connected; }); _mockTransport.When(x => x.Close()).Do(x => { _connected = false; }); _mockTransport.When(x => x.Reconnect()).Do(x => { _connected = true; }); _receivedData = new List<RtspChunk>(); _receivedMessage = new List<RtspChunk>(); }
/// <summary> /// Initializes a new instance of the <see cref="RtspListener"/> class from a TCP connection. /// </summary> /// <param name="connection">The connection.</param> public RtspListener(IRtspTransport connection, string logName, Guid sourceId, Guid connectionId) { if (connection == null) { throw new ArgumentNullException("connection"); } _sourceId = sourceId; ConnectionId = connectionId; _logger = NLog.LogManager.GetLogger(logName); Contract.EndContractBlock(); _transport = connection; _stream = connection.GetStream(); }