private void CheckForStaleStreams()
{
lock(streamsAndIPs)
{
// Streams are stored in a hashtable, you can't remove an item in a foreach loop
// So make a copy of the streams to iterate on, but delete from the hashtable
foreach(IPStreamPair ipsp in new ArrayList(streamsAndIPs.Values))
{
if (ipsp.stream != null && ipsp.stream.Stale++ >= RtcpMissedIntervalsTimeout)
{
RemoveSSRC(ipsp.stream.SSRC);
}
}
}
}