/// <summary> /// we have a new stream - start recording /// </summary> /// <param name="SSRC">what's arrived</param> private void OnNewRtpStream(object sender, RtpEvents.RtpStreamEventArgs ea) { if (this.rtpSession != sender) { return; } RtpStream stream = ea.RtpStream; if (streams.ContainsKey(stream.SSRC)) { return; } Trace.WriteLine("New stream found: " + stream.Properties.CName + ", " + stream.Properties.Name); if (participants[stream.Properties.CName] != null) { ParticipantWrapper participant = (ParticipantWrapper)participants[stream.Properties.CName]; StreamRecorder sm = new StreamRecorder(participant.participantID, stream, perfCounter); streams[stream.SSRC] = sm; perfCounter.AddInstanceForCollection(sm); // Make sure we don't stop recording now if (this.stopTimer != null) { stopTimer.Dispose(); stopTimer = null; } } else { eventLog.WriteEntry("Detected stream for unknown participant, ignoring. CNAME: " + stream.Properties.CName, EventLogEntryType.Error, ArchiveServiceEventLog.ID.Error); } }
/// <summary> /// we have a new stream - start recording /// </summary> /// <param name="SSRC">what's arrived</param> private void OnNewRtpStream(object sender, RtpEvents.RtpStreamEventArgs ea) { try { RtpStream stream = ea.RtpStream; eventLog.WriteEntry("OnNewRtpStream: " + stream.Properties.CName + " " + stream.PayloadType.ToString(), EventLogEntryType.Information, ArchiveServiceEventLog.ID.Information); if (this.rtpSession != sender) { eventLog.WriteEntry("OnNewRtpStream: this.rtpSession and sender don't match.", EventLogEntryType.Information, ArchiveServiceEventLog.ID.Information); if (this.rtpSession == null) { eventLog.WriteEntry("OnNewRtpStream: this.rtpSession is null.", EventLogEntryType.Information, ArchiveServiceEventLog.ID.Information); } if (sender == null) { eventLog.WriteEntry("OnNewRtpStream: sender is null.", EventLogEntryType.Information, ArchiveServiceEventLog.ID.Information); } //return; } if (streams.ContainsKey(stream.SSRC)) { eventLog.WriteEntry("OnNewRtpStream already in streams collection.", EventLogEntryType.Information, ArchiveServiceEventLog.ID.Information); return; } //eventLog.WriteEntry(string.Format(CultureInfo.CurrentCulture, " New stream found: {0}, {1}", // stream.Properties.CName, stream.Properties.Name)); if (participants[stream.Properties.CName] != null) { ParticipantWrapper participant = (ParticipantWrapper)participants[stream.Properties.CName]; StreamRecorder sm = new StreamRecorder(participant.participantID, stream, perfCounter); streams[stream.SSRC] = sm; perfCounter.AddInstanceForCollection(sm); // Make sure we don't stop recording now if (this.stopTimer != null) { stopTimer.Dispose(); stopTimer = null; } eventLog.WriteEntry("OnNewRtpStream stream added complete.", EventLogEntryType.Information, ArchiveServiceEventLog.ID.Information); } else { eventLog.WriteEntry(Strings.UnknownParticipantError + stream.Properties.CName, EventLogEntryType.Information, ArchiveServiceEventLog.ID.Information); } } catch (Exception e) { eventLog.WriteEntry("OnNewRtpStream exception: " + e.ToString(), EventLogEntryType.Warning, ArchiveServiceEventLog.ID.Warning); } }