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

AddOrUpdateStream() private method

Called to create a stream via Rtcp and have all the "links" created CXP always stores the Participant ssrc/SdesData first in the SdesPacket. So a participant should always exist before the stream is created in this code. AddStream is called by the RtcpListener thread via ProcessSdesPacket
private AddOrUpdateStream ( uint ssrc, SdesData sdes ) : void
ssrc uint
sdes SdesData
return void
        private void AddOrUpdateStream(uint ssrc, SdesData sdes)
        {
            lock(participants)
            {
                lock(streamsAndIPs)
                {
                    RtpParticipant participant = participants[sdes.CName];
                    if(participants[sdes.CName] == null)
                    {
                        Debug.Assert(false);
                        throw new InvalidOperationException(Strings.CantCreateAStreamNoParticipant);
                    }

                    IPStreamPair ipsp = streamsAndIPs[ssrc];
                    Debug.Assert(ipsp != null);

                    if(ipsp.stream == null)
                    {
                        ipsp.stream = RtpStream.CreateStream(rtpListener, ssrc, sdes);

                        ssrcToParticipant[ssrc] = participant;
                        participant.AddSSRC(ssrc);

                        RaiseRtpStreamAddedEvent(ipsp.stream);
                    }
                    else // Update
                    {
                        ipsp.stream.Stale = 0;
                        ipsp.stream.Properties.UpdateData(sdes);
                    }
                }
            }
        }