Пример #1
0
        /// <summary>
        /// Gets or creates new participant if participant does not exist.
        /// </summary>
        /// <param name="cname">Participant canonical name.</param>
        /// <returns>Returns specified participant.</returns>
        internal RTP_Participant_Remote GetOrCreateParticipant(string cname)
        {
            if (cname == null)
            {
                throw new ArgumentNullException("cname");
            }
            if (cname == string.Empty)
            {
                throw new ArgumentException("Argument 'cname' value must be specified.");
            }

            lock (m_pParticipants)
            {
                RTP_Participant_Remote participant = null;
                if (!m_pParticipants.TryGetValue(cname, out participant))
                {
                    participant          = new RTP_Participant_Remote(cname);
                    participant.Removed += delegate { m_pParticipants.Remove(participant.CNAME); };
                    m_pParticipants.Add(cname, participant);

                    OnNewParticipant(participant);
                }

                return(participant);
            }
        }
Пример #2
0
 /// <summary>
 /// Raises <b>NewParticipant</b> event.
 /// </summary>
 /// <param name="participant">New participant.</param>
 private void OnNewParticipant(RTP_Participant_Remote participant)
 {
     if (NewParticipant != null)
     {
         NewParticipant(this, new RTP_ParticipantEventArgs(participant));
     }
 }
        /// <summary>
        /// Default constructor.
        /// </summary>
        /// <param name="participant">RTP participant.</param>
        /// <exception cref="ArgumentNullException">Is raised when <b>participant</b> is null reference.</exception>
        public RTP_ParticipantEventArgs(RTP_Participant_Remote participant)
        {
            if (participant == null)
            {
                throw new ArgumentNullException("participant");
            }

            m_pParticipant = participant;
        }
Пример #4
0
        /// <summary>
        /// Sets source owner participant.
        /// </summary>
        /// <param name="participant">RTP participant.</param>
        /// <exception cref="ArgumentNullException">Is raised when <b>participant</b> is null reference.</exception>
        internal void SetParticipant(RTP_Participant_Remote participant)
        {
            if (participant == null)
            {
                throw new ArgumentNullException("participant");
            }

            m_pParticipant = participant;
        }
        /// <summary>
        /// Default constructor.
        /// </summary>
        /// <param name="participant">RTP participant.</param>
        /// <exception cref="ArgumentNullException">Is raised when <b>participant</b> is null reference.</exception>
        public RTP_ParticipantEventArgs(RTP_Participant_Remote participant)
        {
            if (participant == null)
            {
                throw new ArgumentNullException("participant");
            }

            m_pParticipant = participant;
        }
Пример #6
0
        /// <summary>
        /// Cleans up any resources being used.
        /// </summary>
        internal override void Dispose()
        {
            m_pParticipant = null;
            if (m_pStream != null)
            {
                m_pStream.Dispose();
            }

            ApplicationPacket = null;

            base.Dispose();
        }
Пример #7
0
        /// <summary>
        /// Cleans up any resources being used.
        /// </summary>
        internal void Dispose()
        {
            if (m_IsDisposed)
            {
                return;
            }
            m_IsDisposed = true;

            m_pSession     = null;
            m_pParticipant = null;

            Closed         = null;
            Timeout        = null;
            SenderReport   = null;
            PacketReceived = null;
        }
Пример #8
0
        /// <summary>
        /// Cleans up any resources being used.
        /// </summary>
        internal void Dispose()
        {
            if (m_IsDisposed)
            {
                return;
            }
            m_IsDisposed = true;

            m_pSession = null;
            m_pParticipant = null;

            Closed = null;
            Timeout = null;
            SenderReport = null;
            PacketReceived = null;
        }
Пример #9
0
        /// <summary>
        /// Sets source owner participant.
        /// </summary>
        /// <param name="participant">RTP participant.</param>
        /// <exception cref="ArgumentNullException">Is raised when <b>participant</b> is null reference.</exception>
        internal void SetParticipant(RTP_Participant_Remote participant)
        {
            if (participant == null)
            {
                throw new ArgumentNullException("participant");
            }

            m_pParticipant = participant;
        }
Пример #10
0
        /// <summary>
        /// Cleans up any resources being used.
        /// </summary>
        internal override void Dispose()
        {
            m_pParticipant = null;
            if (m_pStream != null)
            {
                m_pStream.Dispose();
            }

            ApplicationPacket = null;

            base.Dispose();
        }
        /// <summary>
        /// Gets or creates new participant if participant does not exist.
        /// </summary>
        /// <param name="cname">Participant canonical name.</param>
        /// <returns>Returns specified participant.</returns>
        internal RTP_Participant_Remote GetOrCreateParticipant(string cname)
        {
            if (cname == null)
            {
                throw new ArgumentNullException("cname");
            }
            if (cname == string.Empty)
            {
                throw new ArgumentException("Argument 'cname' value must be specified.");
            }

            lock (m_pParticipants)
            {
                RTP_Participant_Remote participant = null;
                if (!m_pParticipants.TryGetValue(cname, out participant))
                {
                    participant = new RTP_Participant_Remote(cname);
                    participant.Removed += delegate { m_pParticipants.Remove(participant.CNAME); };
                    m_pParticipants.Add(cname, participant);

                    OnNewParticipant(participant);
                }

                return participant;
            }
        }
 /// <summary>
 /// Raises <b>NewParticipant</b> event.
 /// </summary>
 /// <param name="participant">New participant.</param>
 private void OnNewParticipant(RTP_Participant_Remote participant)
 {
     if (NewParticipant != null)
     {
         NewParticipant(this, new RTP_ParticipantEventArgs(participant));
     }
 }