Beispiel #1
0
        /// <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();
        }
Beispiel #2
0
        /// <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();
        }
Beispiel #3
0
 protected virtual void Dispose(bool disposing)
 {
     if (disposing)
     {
         // Dispose "owned" elements only.
         _stream?.Dispose();
         _stream    = null;
         _transport = null;  // Not owned
     }
 }
Beispiel #4
0
        /// <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();
        }
Beispiel #5
0
        /// <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>();
        }
Beispiel #8
0
        /// <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();
        }