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

RemoveSSRC() private method

Called to remove an ssrc/stream and have all the links cleaned up A stream can either be "associated" (meaning it is mapped to a participant) or not. Whether the stream is associated or not, it will be added to/removed from the "streams" and "ssrcToIPAddress" collections. If the stream is "associated" it will be added to/removed from the participant's streams collection and the "ssrcToParticipant" collection.
private RemoveSSRC ( uint ssrc ) : void
ssrc uint
return void
        private void RemoveSSRC(uint ssrc)
        {
            lock(participants)
            {
                RtpParticipant participant = ssrcToParticipant[ssrc];

                if(participant != null)
                {
                    if(ssrc == participant.SSRC)
                    {
                        RemoveParticipant(participant);
                    }
                    else
                    {
                        lock(streamsAndIPs)
                        {
                            RtpStream stream = streamsAndIPs[ssrc].stream;
                            stream.Dispose();

                            // Remove the stream from the associated collections
                            if(participant.SSRCs.Contains(ssrc))
                            {
                                // Mappings between ssrc and Participant
                                participant.RemoveSSRC(ssrc);
                                ssrcToParticipant.Remove(ssrc);

                                // Only raise the event for a stream that was associated as it might
                                // otherwise confuse clients who never received an AddRtpStreamEvent
                                RaiseRtpStreamRemovedEvent(stream);
                            }
                        }
                    }
                }

                // Remove ssrc/stream from the associated collections 
                lock(streamsAndIPs)
                {
                    streamsAndIPs.Remove(ssrc);
                }
            }
        }

Same methods

RtpSession::RemoveSSRC ( uint ssrc, IPAddress ip ) : void