/// <summary> /// the streams gone away...stop recording /// </summary> /// <param name="SSRC">what's gone</param> private void OnRtpStreamRemoved(object sender, RtpEvents.RtpStreamEventArgs ea) { if (this.rtpSession != sender) { return; } RtpStream stream = ea.RtpStream; Trace.WriteLine("Rtp stream ended: " + stream.Properties.CName + ", " + stream.Properties.Name); // Stop listening to the stream. StreamRecorder sm = (StreamRecorder)streams[stream.SSRC]; perfCounter.RemoveInstanceForCollection(sm); sm.StopListening(); streams.Remove(stream.SSRC); // Set the countdown timer if the venue is empty if (streams.Count == 0) { this.stopTimer = new Timer(new TimerCallback(StopRecordingCallee), null, Constants.StopAfterVenueEmptySec * 1000, Timeout.Infinite); } }
/// <summary> /// the streams gone away...stop recording /// </summary> /// <param name="SSRC">what's gone</param> private void OnRtpStreamRemoved(object sender, RtpEvents.RtpStreamEventArgs ea) { if (this.rtpSession != sender) { return; } RtpStream stream = ea.RtpStream; eventLog.WriteEntry(string.Format(CultureInfo.CurrentCulture, "Rtp stream ended: {0}, {1}", stream.Properties.CName, stream.Properties.Name), EventLogEntryType.Information, ArchiveServiceEventLog.ID.Information); // Stop listening to the stream. StreamRecorder sm = (StreamRecorder)streams[stream.SSRC]; perfCounter.RemoveInstanceForCollection(sm); sm.StopListening(); streams.Remove(stream.SSRC); // Set the countdown timer if the venue is empty if (streams.Count == 0) { this.stopTimer = new Timer(new TimerCallback(StopRecordingCallee), null, Constants.StopAfterVenueEmptySec * 1000, Timeout.Infinite); } }
public void StopListening() { if (rtpStream != null) { rtpStream.FrameReceived -= new RtpStream.FrameReceivedEventHandler(FrameReceived); this.rtpStream = null; } int curIndex = curBufIndex; if (buffers != null) { do { BufferRecorder buf = buffers[curBufIndex]; perfCounter.RemoveInstanceForCollection(buf); buf.Dispose(); curBufIndex = (curBufIndex + 1) % bufferCount; }while (curBufIndex != curIndex); this.buffers = null; } }