예제 #1
0
        public void Dispose()
        {
            lock (classLock)
            {
                try
                {
                    disposed = true;

                    // Unhook events
                    RtpEvents.ReceiverReport         -= new RtpEvents.ReceiverReportEventHandler(RtpReceiverReport);
                    RtpEvents.DuplicateCNameDetected -= new RtpEvents.DuplicateCNameDetectedEventHandler(DuplicateCNameDetected);

                    if (updateThread != null)
                    {
                        updateThread.Dispose();
                        updateThread = null;
                    }

                    if (rtpSession != null)
                    {
                        rtpSession.Dispose();
                        rtpSession = null;
                        rtpSender  = null;
                    }
                }
                catch (Exception e)
                {
                    eventLog.WriteEntry("Error disposing ConnectivityDetector. \n" + e.ToString(),
                                        EventLogEntryType.Error, 0);
                }
            }
        }
예제 #2
0
        private void InitializeNetwork()
        {
            RtpEvents.ReceiverReport         += new RtpEvents.ReceiverReportEventHandler(RtpReceiverReport);
            RtpEvents.DuplicateCNameDetected += new RtpEvents.DuplicateCNameDetectedEventHandler(DuplicateCNameDetected);

            // Create participant
            rtpParticipant = new RtpParticipant(cName, name);
            rtpParticipant.SetTool(true);

            // Create session with Participant and Rtp data
            rtpSession = new RtpSession(new IPEndPoint(IPAddress.Parse(ipAddress), port), rtpParticipant, true, true);

            // Create RtpSender
            rtpSender = rtpSession.CreateRtpSender(HostName, PayloadType.PipecleanerSignal, null, null);
        }
예제 #3
0
 private void LeaveRtpSession()
 {
     try
     {
         if (rtpSession != null)
         {
             // Clean up all outstanding objects owned by the RtpSession
             rtpSession.Dispose();
             rtpSession = null;
             rtpSender = null;
         }
     }
     catch (Exception err)
     {
         logger.Log(LogLevel.Error, err.Message + " " + err.Source + " " + err.StackTrace);
     }
 }
예제 #4
0
        // CF2 Create participant, join session
        // CF3 Retrieve RtpSender
        private void JoinRtpSession(string name)
        {
            try
            {
                Hashtable payloadPara = new Hashtable();
                payloadPara.Add("Width", Width);
                payloadPara.Add("Height", Height);
                payloadPara.Add("Quality", Quality);

                rtpSession = new RtpSession(ep, new RtpParticipant(name, name), true, true);
                rtpSender = rtpSession.CreateRtpSender(name, PayloadType.JPEG, null, payloadPara);
            }
            catch (Exception err)
            {
                logger.Log(LogLevel.Error, err.Message + " " + err.Source + " " + err.StackTrace);
            }
        }
예제 #5
0
 public void Add(uint ssrc, RtpSender rtpSender)
 {
     Dictionary.Add(ssrc, rtpSender);
 }
예제 #6
0
 public void Add(uint ssrc, RtpSender rtpSender)
 {
     Dictionary.Add(ssrc, rtpSender);
 }
예제 #7
0
        /// <summary>
        /// Finishes the creation of an RtpSender by adding it to local collections and announcing
        /// it to the remote sites via an Rtcp packet
        /// </summary>
        private void _CreateRtpSender(RtpSender rtpSender)
        {
            // Add it to the collection
            lock(rtpSenders)
            {
                rtpSenders.Add(rtpSender.SSRC, rtpSender);
            }

            // We would like to try and have the stream constructed at the remote sites before the 
            // Rtp data starts arriving so that none of it is missed.  To help with that, when an
            // RtpSender is constructed, it sets an Sdes private extension indicating its payload
            // type.  Here we force an Rtcp compound packet to be sent and give it a little time.
            rtcpSender.SendRtcpDataNow();
            Thread.Sleep(250);
        }
예제 #8
0
 private void LeaveRtpSession()
 {
     if (rtpSession != null)
     {
         // Clean up all outstanding objects owned by the RtpSession
         rtpSession.Dispose();
         rtpSession = null;
         rtpSender = null;
     }
 }
예제 #9
0
        // CF2 Create participant, join session
        // CF3 Retrieve RtpSender
        private void JoinRtpSession(string name)
        {
            try
            {
                Hashtable payloadPara = new Hashtable();
                payloadPara.Add("Width", ImgWidth);
                payloadPara.Add("Height", ImgHeight);
                payloadPara.Add("Quality", Quality);

                rtpSession = new RtpSession(ep, new RtpParticipant(name, name), true, true);
                rtpSender = rtpSession.CreateRtpSender(name, PayloadType.JPEG, null, payloadPara);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
                //MessageBox.Show("Please make sure that you are connceted with the network so " + ex.Message); 
            }
        }
예제 #10
0
        public void Dispose()
        {
            lock(classLock)
            {
                try
                {
                    disposed = true;

                    // Unhook events
                    RtpEvents.ReceiverReport            -= new RtpEvents.ReceiverReportEventHandler(RtpReceiverReport);
                    RtpEvents.DuplicateCNameDetected    -= new RtpEvents.DuplicateCNameDetectedEventHandler(DuplicateCNameDetected);

                    if(updateThread != null)
                    {
                        updateThread.Dispose();
                        updateThread = null;
                    }

                    if(rtpSession != null)
                    {
                        rtpSession.Dispose();
                        rtpSession = null;
                        rtpSender = null;
                    }
                }
                catch(Exception e)
                {
                    eventLog.WriteEntry("Error disposing ConnectivityDetector. \n" + e.ToString(),
                        EventLogEntryType.Error, 0);
                }
            }
        }
예제 #11
0
        private void InitializeNetwork()
        {
            RtpEvents.ReceiverReport            += new RtpEvents.ReceiverReportEventHandler(RtpReceiverReport);
            RtpEvents.DuplicateCNameDetected    += new RtpEvents.DuplicateCNameDetectedEventHandler(DuplicateCNameDetected);

            // Create participant
            rtpParticipant = new RtpParticipant(cName, name);
            rtpParticipant.SetTool(true);

            // Create session with Participant and Rtp data
            rtpSession = new RtpSession(new IPEndPoint(IPAddress.Parse(ipAddress), port), rtpParticipant, true, true);

            // Create RtpSender
            rtpSender = rtpSession.CreateRtpSender(HostName, PayloadType.PipecleanerSignal, null, null);
        }