/// <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);
            }
        }
Example #2
0
        /// <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);
            }
        }
Example #3
0
 internal void RemoveInstanceForCollection(StreamRecorder sm)
 {
     lock (streams)
     {
         if (streams.Contains(sm))
         {
             streams.Remove(sm);
         }
     }
 }
Example #4
0
 internal void AddInstanceForCollection(StreamRecorder sm)
 {
     lock (streams)
     {
         if (!streams.Contains(sm))
         {
             streams.Add(sm);
         }
     }
 }
Example #5
0
        /// <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)
        {
            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);
            }
        }
 internal void RemoveInstanceForCollection(StreamRecorder sm)
 {
     lock(streams)
     {
         if( streams.Contains(sm) )
             streams.Remove(sm);
     }
 }
 internal void AddInstanceForCollection(StreamRecorder sm)
 {
     lock(streams)
     {
         if( !streams.Contains(sm) )
             streams.Add(sm);
     }
 }
        /// <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);
            }
        }
        /// <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);
            }
        }