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

            m_pSource = null;

            OnDisposed();

            Disposed = null;
            Closed   = null;
        }
        /// <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, Workaround.Definitions.MaxStreamLineLength);
        }
        /// <summary>
        /// Cleans up any resources being used.
        /// </summary>
        private void Dispose()
        {
            if (m_IsDisposed)
            {
                return;
            }
            m_IsDisposed = true;

            m_pSource = null;

            OnDisposed();

            Disposed = null;
            Closed = null;
        }
        /// <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 += delegate
                                    {
                                        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;
        }
        /// <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, Workaround.Definitions.MaxStreamLineLength);
        }