Beispiel #1
0
        /// <summary>
        /// Adds specified source to participant if participant doesn't contain the specified source.
        /// </summary>
        /// <param name="source">RTP source.</param>
        /// <exception cref="ArgumentNullException">Is raised when <b>source</b> is null reference.</exception>
        internal void EnsureSource(RTP_Source source)
        {
            if (source == null)
            {
                throw new ArgumentNullException("source");
            }

            if (!m_pSources.Contains(source))
            {
                m_pSources.Add(source);

                OnSourceAdded(source);

                source.Disposing += new EventHandler(delegate(object sender, EventArgs e){
                    if (m_pSources.Remove(source))
                    {
                        OnSourceRemoved(source);

                        // If last source removed, the participant is dead, so dispose participant.
                        if (m_pSources.Count == 0)
                        {
                            OnRemoved();
                            Dispose();
                        }
                    }
                });
            }
        }
Beispiel #2
0
        /// <summary>
        /// Default constructor.
        /// </summary>
        /// <param name="source">RTP source.</param>
        /// <exception cref="ArgumentNullException">Is raised when <b>source</b> is null reference.</exception>
        public RTP_SourceEventArgs(RTP_Source source)
        {
            if (source == null)
            {
                throw new ArgumentNullException("source");
            }

            m_pSource = source;
        }
Beispiel #3
0
        /// <summary>
        /// Raises <b>SourceRemoved</b> event.
        /// </summary>
        /// <param name="source">RTP source.</param>
        private void OnSourceRemoved(RTP_Source source)
        {
            if (source == null)
            {
                throw new ArgumentNullException("source");
            }

            if (this.SourceRemoved != null)
            {
                this.SourceRemoved(this, new RTP_SourceEventArgs(source));
            }
        }
Beispiel #4
0
        /// <summary>
        /// Default constructor.
        /// </summary>
        /// <param name="session">Owner RTP session.</param>
        /// <param name="ssrc">Onwer synchronization source.</param>
        /// <param name="packetSeqNo">RTP packet <b>SeqNo</b> value.</param>
        /// <exception cref="ArgumentNullException">Is riased when <b>session</b> or <b>ssrc</b> is null reference.</exception>
        internal RTP_ReceiveStream(RTP_Session session, RTP_Source ssrc, ushort packetSeqNo)
        {
            if (session == null)
            {
                throw new ArgumentNullException("session");
            }
            if (ssrc == null)
            {
                throw new ArgumentNullException("ssrc");
            }

            m_pSession = session;
            m_pSSRC    = ssrc;

            // RFC 3550 A.1.
            InitSeq(packetSeqNo);
            m_MaxSeqNo  = (ushort)(packetSeqNo - 1);
            m_Probation = MIN_SEQUENTIAL;
        }