/// <summary> /// Remove all frames captured before the given capture time. They will not be encoded. /// </summary> public void WipeBufferUntil(double AbandonTime) { lock (this) { lock (WaitingCaptures) { while (WaitingCaptures.DataAvailable(this)) { var ti = WaitingCaptures.Peek(this); if (ti != null && ti.Seconds < AbandonTime) { WaitingCaptures.Dequeue(this); } else { break; } } } } lock (WaitingFrames) { while (WaitingFrames.Count > 0 && WaitingFrames[0].Seconds < AbandonTime) { WaitingFrames.RemoveAt(0); } } GC.Collect(); }