Esempio n. 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();
        }
Esempio n. 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();
        }
Esempio n. 3
0
 protected virtual void Dispose(bool disposing)
 {
     if (disposing)
     {
         // Dispose "owned" elements only.
         _stream?.Dispose();
         _stream    = null;
         _transport = null;  // Not owned
     }
 }
Esempio n. 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();
        }
Esempio n. 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>();
        }
Esempio n. 7
0
        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>();
        }
Esempio n. 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();
        }