Example #1
0
        /// <summary>
        /// Cleans up any resources being used.
        /// </summary>
        private void Dispose()
        {
            if(m_IsDisposed){
                return;
            }
            m_IsDisposed = true;

            m_pSource = null;
                        
            OnDisposed();

            this.Disposed = null;
            this.Closed = null;
        }
Example #2
0
        /// <summary>
        /// Default constructor.
        /// </summary>
        /// <param name="source">Owner RTP source.</param>
        /// <exception cref="ArgumentNullException">Is raised when <b>source</b> is null reference.</exception>
        internal RTP_SendStream(RTP_Source_Local source)
        {
            if(source == null){
                throw new ArgumentNullException("source");
            }

            m_pSource = source;

            /* RFC 3550 4.
                The initial value of the sequence number SHOULD be random (unpredictable) to make known-plaintext 
                attacks on encryption more difficult.
            */
            m_SeqNo = new Random().Next(1,32000);
        }
Example #3
0
        /// <summary>
        /// Cleans up any resources being used.
        /// </summary>
        private void Dispose()
        {
            if (m_IsDisposed)
            {
                return;
            }
            m_IsDisposed = true;

            m_pSource = null;

            OnDisposed();

            this.Disposed = null;
            this.Closed   = null;
        }
Example #4
0
        /// <summary>
        /// Default constructor.
        /// </summary>
        /// <param name="source">Owner RTP source.</param>
        /// <exception cref="ArgumentNullException">Is raised when <b>source</b> is null reference.</exception>
        internal RTP_SendStream(RTP_Source_Local source)
        {
            if (source == null)
            {
                throw new ArgumentNullException("source");
            }

            m_pSource = source;

            /* RFC 3550 4.
             *  The initial value of the sequence number SHOULD be random (unpredictable) to make known-plaintext
             *  attacks on encryption more difficult.
             */
            m_SeqNo = new Random().Next(1, 32000);
        }
Example #5
0
        /// <summary>
        /// Creates local source.
        /// </summary>
        /// <returns>Returns new local source.</returns>
        internal RTP_Source_Local CreateLocalSource()
        {
            uint ssrc = RTP_Utils.GenerateSSRC();
            // Ensure that any member don't have such SSRC.
            while(m_pMembers.ContainsKey(ssrc)){
                ssrc = RTP_Utils.GenerateSSRC();
            }

            RTP_Source_Local source = new RTP_Source_Local(this,ssrc,m_pLocalEP.RtcpEP,m_pLocalEP.RtpEP);
            source.Disposing += new EventHandler(delegate(object s,EventArgs e){
                m_pSenders.Remove(source.SSRC);
                m_pMembers.Remove(source.SSRC);    
                m_pLocalSources.Remove(source);
            });
            m_pLocalSources.Add(source);
            m_pSession.LocalParticipant.EnsureSource(source);

            return source;
        }