private void handleRtpStreamRemoved(object sender, MSR.LST.Net.Rtp.RtpEvents.RtpStreamEventArgs ea) { if (this.streams.Contains(ea.RtpStream)) { this.streams.Remove(ea.RtpStream); } ea.RtpStream.FrameReceived -= new MSR.LST.Net.Rtp.RtpStream.FrameReceivedEventHandler(this.handleFrameReceived); }
private void HandleStreamRemoved(object sender, MSR.LST.Net.Rtp.RtpEvents.RtpStreamEventArgs args) { using (Synchronizer.Lock(this.m_Sender.m_Classroom.SyncRoot)) { using (Synchronizer.Lock(this)) { // Do not check (or care) whether the RTPMessageSender has been disposed, // because we will get lots of RtpStreamRemoved events when the RtpSession is closed. RtpStream stream = args.RtpStream; RTPMessageReceiver receiver = ((RTPMessageReceiver)this.m_Receivers[stream]); if (receiver != null) { receiver.Dispose(); this.m_Receivers.Remove(stream); } // Discard all pending Nacks so the NackManager doesn't keep nacking them forever. this.m_Sender.NackManager.Discard(stream.SSRC, Range.UNIVERSE); // If this was the last stream for the participant, unregister the ParticipantModel // and remove it from the classroom. string cname = stream.Properties.CName; RtpParticipant client = this.m_Sender.m_RtpSession.Participants[cname]; if (client == null || client.SSRCs.Count <= 0) { ParticipantModel participant = ((ParticipantModel)this.m_Participants[cname]); if (participant != null) { // Remove the participant from the classroom. if (this.m_Sender.m_Classroom.Participants.Contains(participant)) { this.m_Sender.m_Classroom.Participants.Remove(participant); } } // Remove the participant from the table. this.m_Participants.Remove(cname); } } } }
private void handleRtpStreamAdded(object sender, MSR.LST.Net.Rtp.RtpEvents.RtpStreamEventArgs ea) { this.streams.Add(ea.RtpStream); ea.RtpStream.FrameReceived += new MSR.LST.Net.Rtp.RtpStream.FrameReceivedEventHandler(this.handleFrameReceived); }