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);
}
}
}
}