NewTOAPIA.Net.Rtp.RtpSession.AddOrUpdateParticipant C# (CSharp) Method

AddOrUpdateParticipant() private method

AddOrUpdateParticipant is called by the RtpSession ctor for adding the local participant and by ProcessSdesPacket when an SDES packet arrives on the RtcpListener thread If the participant does not exist in the session, we add them If the participant does exist in the session, we make sure there is no CName conflict
private AddOrUpdateParticipant ( uint ssrc, SdesData sdes, IPAddress ip ) : void
ssrc uint Unique identifier of the stream
sdes SdesData CName, Name, Email, etc from which to create the Participant
ip System.Net.IPAddress Originating IP address of the ssrc and SdesData
return void
        private void AddOrUpdateParticipant(uint ssrc, SdesData sdes, IPAddress ip)
        {
            lock(participants)
            {
                string cName = sdes.CName;
                RtpParticipant participant = null;
                if (participants.ContainsKey(cName))
                    participant = participants[cName];

                // Participant does not exist
                if(null == participant)
                {
                    // Create a new participant
                    AddParticipant(ssrc, new RtpParticipant(sdes, ip));
                }
                else // Participant exists
                {
                    CheckForCNameConflict(cName, new IPAddress[]{participant.IPAddress, ip});
                    
                    participant.Stale = 0;
                    participant.UpdateData(sdes);
                }
            }
        }