/// <summary>
        /// Creates new RTP session.
        /// </summary>
        /// <param name="localEP">Local RTP end point.</param>
        /// <param name="clock">RTP media clock.</param>
        /// <returns>Returns created session.</returns>
        /// <exception cref="ObjectDisposedException">Is raised when this class is Disposed and this method is accessed.</exception>
        /// <exception cref="ArgumentNullException">Is raised when <b>localEP</b> or <b>clock</b> is null reference.</exception>
        public RTP_Session CreateSession(RTP_Address localEP, RTP_Clock clock)
        {
            if (m_IsDisposed)
            {
                throw new ObjectDisposedException(this.GetType().Name);
            }
            if (localEP == null)
            {
                throw new ArgumentNullException("localEP");
            }
            if (clock == null)
            {
                throw new ArgumentNullException("clock");
            }

            RTP_Session session = new RTP_Session(this, localEP, clock);

            session.Disposed += new EventHandler(delegate(object s, EventArgs e) {
                m_pSessions.Remove((RTP_Session)s);
            });
            m_pSessions.Add(session);

            OnSessionCreated(session);

            return(session);
        }
示例#2
0
        /// <summary>
        /// Default constructor.
        /// </summary>
        /// <param name="session">Owner RTP multimedia session.</param>
        /// <param name="localEP">Local RTP end point.</param>
        /// <param name="clock">RTP media clock.</param>
        /// <exception cref="ArgumentNullException">Is raised when <b>localEP</b>, <b>localEP</b> or <b>clock</b> is null reference.</exception>
        internal RTP_Session(RTP_MultimediaSession session,RTP_Address localEP,RTP_Clock clock)
        {
            if(session == null){
                throw new ArgumentNullException("session");
            }
            if(localEP == null){
                throw new ArgumentNullException("localEP");
            }
            if(clock == null){
                throw new ArgumentNullException("clock");
            }

            m_pSession  = session;
            m_pLocalEP  = localEP;
            m_pRtpClock = clock;

            m_pLocalSources = new List<RTP_Source_Local>();
            m_pTargets = new List<RTP_Address>();
            m_pMembers = new Dictionary<uint,RTP_Source>();
            m_pSenders = new Dictionary<uint,RTP_Source>();
            m_pConflictingEPs = new Dictionary<string,DateTime>();
            m_pPayloads = new KeyValueCollection<int,Codec>();
            
            m_pUdpDataReceivers = new List<UDP_DataReceiver>();
            m_pRtpSocket = new Socket(localEP.IP.AddressFamily,SocketType.Dgram,ProtocolType.Udp);
            m_pRtpSocket.Bind(localEP.RtpEP);
            m_pRtcpSocket = new Socket(localEP.IP.AddressFamily,SocketType.Dgram,ProtocolType.Udp);
            m_pRtcpSocket.Bind(localEP.RtcpEP);
                        
            m_pRtcpTimer = new TimerEx();
            m_pRtcpTimer.Elapsed += new System.Timers.ElapsedEventHandler(delegate(object sender,System.Timers.ElapsedEventArgs e){
                SendRtcp();
            });
            m_pRtcpTimer.AutoReset = false;
        }
        /// <summary>
        /// Creates new RTP session.
        /// </summary>
        /// <param name="localEP">Local RTP end point.</param>
        /// <param name="clock">RTP media clock.</param>
        /// <returns>Returns created session.</returns>
        /// <exception cref="ObjectDisposedException">Is raised when this class is Disposed and this method is accessed.</exception>
        /// <exception cref="ArgumentNullException">Is raised when <b>localEP</b> or <b>clock</b> is null reference.</exception>
        public RTP_Session CreateSession(RTP_Address localEP,RTP_Clock clock)
        {
            if(m_IsDisposed){
                throw new ObjectDisposedException(this.GetType().Name);
            }
            if(localEP == null){
                throw new ArgumentNullException("localEP");
            }
            if(clock == null){
                throw new ArgumentNullException("clock");
            }

            RTP_Session session = new RTP_Session(this,localEP,clock);
            session.Disposed += new EventHandler(delegate(object s,EventArgs e){
                m_pSessions.Remove((RTP_Session)s);
            });
            m_pSessions.Add(session);

            OnSessionCreated(session);

            return session;
        }