Example #1
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);
        }
Example #2
0
 public void Add(string cName, RtpParticipant rtpParticipant)
 {
     Dictionary.Add(cName, rtpParticipant);
 }
Example #3
0
 public void Add(uint ssrc, RtpParticipant participant)
 {
     Dictionary.Add(ssrc, participant);
 }
Example #4
0
 public void Add(uint ssrc, RtpParticipant participant)
 {
     Dictionary.Add(ssrc, participant);
 }
Example #5
0
 public void Add(string cName, RtpParticipant rtpParticipant)
 {
     Dictionary.Add(cName, rtpParticipant);
 }
Example #6
0
        /// <summary>
        /// Removes a participant and does all the necessary cleanup of streams and associations
        /// </summary>
        /// <param name="participant"></param>
        private void RemoveParticipant(RtpParticipant participant)
        {
            lock(participants)
            {
                if(participants.Contains(participant.CName))
                {
                    foreach(uint ssrc in participant.SSRCs)
                    {
                        if(streamsAndIPs.GetStream(ssrc) != null)
                        {
                            RemoveSSRC(ssrc);
                        }

                        participant.RemoveSSRC(ssrc);
                        ssrcToParticipant.Remove(ssrc);
                    }

                    participants.Remove(participant.CName);
                    ssrcToParticipant.Remove(participant.SSRC);

                    RaiseParticipantRemovedEvent(participant);
                }
            }
        }
Example #7
0
        private void AddParticipant(uint ssrc, RtpParticipant participant)
        {
            lock(participants)
            {
                // Update collections
                participants.Add(participant.CName, participant);
                participant.SSRC = ssrc;
                ssrcToParticipant.Add(ssrc, participant);

                // Raise event
                RaiseParticipantAddedEvent(participant);
            }
        }
Example #8
0
        /// <summary>
        /// This constructor is the same as "RtpSession(IPEndPoint multicastEP, RtpParticipant participant, bool rtpTraffic, bool receiveData)",
        /// except that it is capable of using a Unicast-Multicast reflector.
        /// </summary>
        /// <param name="multicastEP"></param>
        /// <param name="participant"></param>
        /// <param name="rtpTraffic"></param>
        /// <param name="reflectorEPArg">The IP address and port number of the reflector</param>
        public RtpSession(IPEndPoint multicastEP, RtpParticipant participant, bool rtpTraffic, bool receiveData, IPEndPoint reflectorEP)
        {
            #region Parameter Validation

            if(multicastEP == null)
            {
                throw new ArgumentNullException("multicastEP");
            }

            // A null participant is a special state for diagnostic purposes
            // The rtpTraffic flag must be false in order to be consistent
            if(participant == null && rtpTraffic)
            {
                throw new ArgumentException("Incompatible arguments - participant(null), rtpTraffic(true)");
            }

            if(!receiveData && (participant != null || !rtpTraffic))
            {
                throw new ArgumentException("Incompatible arguemtns; you must specify a participant and"
                    + "intend to send RTP traffic if you are not receiving data.");
            }
            
            if (reflectorEP == null)
            {
                throw new ArgumentNullException("ReflectorEP not set properly");
            }

            #endregion Parameter Validation

            Utility.multicastIP = multicastEP.Address;

            // Use the reflector as a Unicast EndPoint
            this.multicastEP = reflectorEP;

            // Same as the "old" three argument constructor ...
            this.participant = participant;
            this.rtpTraffic = rtpTraffic;
            this.receiveData = receiveData;
                       
            // Initialize threads, perf counters, network, etc.
            Initialize();
        }
Example #9
0
        /// <summary>
        /// The RtpSession can be in 1 of 4 states:
        /// 
        /// 1. Sending/Receiving Rtp + Rtcp traffic - this is what most users want
        /// 2. Sending/Receiving Rtcp traffic - used mainly by diagnostic tools for discovery of 
        ///     people while also announcing the local user
        /// 3. Receiving Rtcp traffic only - a special diagnostic case used by Pipecleaner to 
        ///     discover if an Agent is already running.
        /// 4. Sending Rtp + Rtcp traffic - a rare case only used for sending test data or
        ///     for "playback" of data in a scenario where SSRC and CNAME conflicts aren't of
        ///     interest to the sender.  THIS SHOULD ONLY BE USED IN EXCEPTIONAL CASES.
        /// 
        /// -If no participant is provided (null), then RtpSession cannot send Rtp or Rtcp data (state 3)
        /// -Else a valid participant is provided and Rtcp traffic can be sent (states 1, 2, or 4)
        ///    -If rtpTraffic is true, then Rtp traffic is sent and/or received (state 1 or 4)
        ///       -If receiveData is true, then Rtp traffic is received as well as sent (state 1)
        ///       -Else Rtp and Rtcp traffic are not received (state 4)
        ///    -Else rtpTraffic is neither sent nor received (state 2)
        /// </summary>
        /// <remarks>
        /// Note that receiving Rtp data without sending Rtcp data is seen as a privacy concern and is not allowed.
        /// </remarks>
        /// <param name="multicastEP">Rtp endpoint, Rtcp endpoint will be derived from it</param>
        /// <param name="participant">Person joining the session</param>
        /// <param name="rtpTraffic">Flag indicating whether or not to monitor or allow sending of Rtp traffic</param>
        /// <param name="receiveData">Flag indicating whether or not to monitor any incoming data</param>
        public RtpSession(IPEndPoint multicastEP, RtpParticipant participant, bool rtpTraffic, bool receiveData)
        {
            #region Parameter Validation

            if(multicastEP == null)
            {
                throw new ArgumentNullException("multicastEP");
            }

            // A null participant is a special state for diagnostic purposes
            // The rtpTraffic flag must be false in order to be consistent
            if(participant == null && rtpTraffic)
            {
                throw new ArgumentException("Incompatible arguments - participant(null), rtpTraffic(true)");
            }

            if(!receiveData && (participant == null || !rtpTraffic))
            {
                throw new ArgumentException("Incompatible arguments; you must specify a participant and "
                    + "intend to send RTP traffic if you are not receiving data.  Sending Rtcp data only "
                    + "is not a valid use case.");
            }

            #endregion Parameter Validation

            Utility.multicastIP = multicastEP.Address;

            // Store parameters
            this.multicastEP = multicastEP;
            this.participant = participant;
            this.rtpTraffic = rtpTraffic;
            this.receiveData = receiveData;
            
            // Initialize threads, perf counters, network, etc.
            Initialize();
        }
Example #10
0
 private void RaiseParticipantTimeoutEvent(RtpParticipant participant)
 {
     object[] args = {this, new RtpEvents.RtpParticipantEventArgs(participant)};
     EventThrower.QueueUserWorkItem(new RtpEvents.RaiseEvent(RtpEvents.RaiseRtpParticipantTimeoutEvent), args);
 }
Example #11
0
 internal void RaiseParticipantRemovedEvent(RtpParticipant participant)
 {
     object[] args = {this, new RtpEvents.RtpParticipantEventArgs(participant)};
     EventThrower.QueueUserWorkItem(new RtpEvents.RaiseEvent(RtpEvents.RaiseRtpParticipantRemovedEvent), args);
 }
Example #12
0
 public void ParticipantData(RtpParticipant participant)
 {
     this.participant = participant;
 }
Example #13
0
 public RtpParticipantEventArgs(RtpParticipant participant)
 {
     RtpParticipant = participant;
 }
Example #14
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);
        }
Example #15
0
 public RtpParticipantEventArgs(RtpParticipant participant)
 {
     RtpParticipant = participant;
 }