Beispiel #1
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);
            }
        }
        /// <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);
            }
        }
 /// <summary>
 /// Presenter left the venue.  Note that this is not raised if the listener was terminated.
 /// </summary>
 /// <param name="ea"></param>
 private void PresentationStreamRemoved(RtpEvents.RtpStreamEventArgs ea)
 {
     Debug.WriteLine("PresentatinStreamRemoved: " + ea.RtpStream.SSRC.ToString());
     if (ea.RtpStream.SSRC == currentPresenterSSRC)
     {
         currentPresenterSSRC = 0;
     }
 }
        private void PresentationStreamAdded(RtpEvents.RtpStreamEventArgs ea)
        {
            Thread thread = CreateTheListeningThread(new ListeningThreadMethod(ListenerWorker), ea.RtpStream);

            thread.IsBackground = true;
            thread.Name         = "Presenter ListenerWorker";
            thread.Start();
            presenterListenThreads.Add(new ListenerThreadData(ea.RtpStream, thread));
        }
Beispiel #5
0
            /// <summary>
            /// Creates a <see cref="ParticipantModel"/> and <see cref="RTPMessageReceiver"/>
            /// whenever a new stream is connected to the venue.  The <see cref="ParticipantModel"/>
            /// is added to the current <see cref="ClassroomModel"/>.
            /// </summary>
            private void HandleStreamAdded(object sender, RtpEvents.RtpStreamEventArgs args)
            {
                using (Synchronizer.Lock(this.m_Sender.m_Classroom.SyncRoot)) {
                    using (Synchronizer.Lock(this)) {
                        if (this.m_Disposed)
                        {
                            throw new ObjectDisposedException("RTPMessageSender");
                        }

                        RtpStream stream = args.RtpStream;

                        // Ignore streams that are not part of our session.
                        if (this.m_Sender.m_RtpSession.ContainsStream(stream))
                        {
                            // Ignore streams that are not DynamicPresentations.
                            if (stream.PayloadType == PayloadType.dynamicPresentation)
                            {
                                // Ignore our own stream, but create a listener for all others.
                                if (stream.SSRC != this.m_Sender.m_RtpSender.SSRC)
                                {
                                    // If we've not seen this client before, create a new ParticipantModel,
                                    // identified by the participant's CName, which, if the participant
                                    // is running Classroom Presenter, is a Guid string.
                                    string cname = stream.Properties.CName;

                                    // It's possible for a participant to generate more than one Rtp stream,
                                    // so we need to keep a different table for m_Participants than m_Receivers.
                                    ParticipantModel participant = ((ParticipantModel)this.m_Participants[cname]);
                                    if (participant == null)
                                    {
                                        // Also get the remote client's HumanName from the participant data.
                                        RtpParticipant client = this.m_Sender.m_RtpSession.Participants[cname];
                                        participant = new ParticipantModel(new Guid(cname), client.Name);
                                        // Add the participant to our table.
                                        this.m_Participants.Add(cname, participant);
                                    }

                                    // Add the participant to the classroom if it is not already a member.
                                    if (!this.m_Sender.m_Classroom.Participants.Contains(participant))
                                    {
                                        this.m_Sender.m_Classroom.Participants.Add(participant);
                                    }

                                    // Create a receiver for this specific stream (there may be more than one stream per participant)
                                    // and add it to the table of receivers so it can be disposed when the stream is removed.
                                    RTPMessageReceiver receiver = new RTPMessageReceiver(this.m_Sender, stream,
                                                                                         this.m_Sender.m_Model, this.m_Sender.m_Classroom, participant);
                                    this.m_Receivers.Add(stream, receiver);
                                }
                            }
                        }
                    }
                }
            }
Beispiel #6
0
        static void OnNewRtpStream(object sender, RtpEvents.RtpStreamEventArgs ea)
        {
            Console.Out.WriteLine("New RTP stream");

            if (session != sender)
            {
                return;
            }

            RtpStream stream = ea.RtpStream;

            stream.FrameReceived += new RtpStream.FrameReceivedEventHandler(stream_FrameReceived);
        }
Beispiel #7
0
 private void RtpStreamRemoved(object sender, RtpEvents.RtpStreamEventArgs ea)
 {
     ea.RtpStream.FrameReceived -= new RtpStream.FrameReceivedEventHandler(Odbior);
     this.Invoke((MethodInvoker) delegate() {
         d_tlp_kamery.Controls.Remove(((PictureBox)(((formy)(polaczenia[ea.RtpStream])).obrazy)));
         foreach (Label l in ((formy)(polaczenia[ea.RtpStream])).naglowki)
         {
             d_flp_strefy.Controls.Remove(l);
         }
         foreach (NumericUpDown N in ((formy)(polaczenia[ea.RtpStream])).pola)
         {
             d_flp_strefy.Controls.Remove(N);
         }
     });
 }
Beispiel #8
0
        /// <summary>
        /// One of the listeners saw a new stream
        /// </summary>
        /// This could be invoked on behalf of either the presenter or the conferencing listener.
        /// <param name="rtpStream"></param>
        private void OnRtpStreamAdded(object o, RtpEvents.RtpStreamEventArgs ea)
        {
            String streamID = makeStreamIdentifier(ea.RtpStream.Properties.CName, ea.RtpStream.Properties.Name);

            Debug.WriteLine("StreamAdded: " + streamID + " payload:" + ea.RtpStream.PayloadType.ToString());
            bool selected = false;

            if ((confSession != null) && (confSession.Streams.ContainsKey(ea.RtpStream.SSRC)))
            {
                if (ea.RtpStream.PayloadType == MSR.LST.Net.Rtp.PayloadType.dynamicAudio)
                {
                    assrcs.Add(ea.RtpStream.SSRC, streamID);
                    selected = assrcs.IsChecked(streamID);
                }

                if (ea.RtpStream.PayloadType == MSR.LST.Net.Rtp.PayloadType.dynamicVideo)
                {
                    vssrcs.Add(ea.RtpStream.SSRC, streamID);
                    selected = vssrcs.IsChecked(streamID);
                }
                if (OnStreamAddRemove != null)
                {
                    StreamAddRemoveEventArgs area = new StreamAddRemoveEventArgs(true, selected, streamID, ea.RtpStream.PayloadType);
                    OnStreamAddRemove(area);
                }
            }

            if ((presenterSession != null) && (presenterSession.Streams.ContainsKey(ea.RtpStream.SSRC)))
            {
                if (ea.RtpStream.PayloadType == MSR.LST.Net.Rtp.PayloadType.dynamicPresentation)
                {
                    //Note: this is not necessarily an Instructor node, but we need to let the listen threads figure that out.
                    if (OnPresentationStreamAdded != null)
                    {
                        OnPresentationStreamAdded(ea);
                    }
                }
            }
        }
Beispiel #9
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);
            }
        }
Beispiel #10
0
        /// <summary>
        /// Event handler for RTP Stream Removed.  Note this is not raised before a listener terminates.
        /// </summary>
        /// <param name="o"></param>
        /// <param name="ea"></param>
        private void OnRtpStreamRemoved(object o, RtpEvents.RtpStreamEventArgs ea)
        {
            String streamID = makeStreamIdentifier(ea.RtpStream.Properties.CName, ea.RtpStream.Properties.Name);

            Debug.WriteLine("StreamRemoved: " + streamID + " payload:" + ea.RtpStream.PayloadType.ToString());

            //PRI2: There is a potential problem here because I have no way to tell which session triggered the event.
            if (confSession != null)
            {
                if (ea.RtpStream.PayloadType == MSR.LST.Net.Rtp.PayloadType.dynamicAudio)
                {
                    assrcs.Remove(streamID);
                }

                if (ea.RtpStream.PayloadType == MSR.LST.Net.Rtp.PayloadType.dynamicVideo)
                {
                    vssrcs.Remove(streamID);
                }

                if (OnStreamAddRemove != null)
                {
                    StreamAddRemoveEventArgs area = new StreamAddRemoveEventArgs(false, false, streamID, ea.RtpStream.PayloadType);
                    OnStreamAddRemove(area);
                }
            }

            if (presenterSession != null)
            {
                if (ea.RtpStream.PayloadType == MSR.LST.Net.Rtp.PayloadType.dynamicPresentation)
                {
                    if (OnPresentationStreamRemoved != null)
                    {
                        OnPresentationStreamRemoved(ea);
                    }
                }
            }
        }
Beispiel #11
0
 private void RtpStreamAdded(object sender, RtpEvents.RtpStreamEventArgs ea)
 {
     ea.RtpStream.FrameReceived += new MSR.LST.Net.Rtp.RtpStream.FrameReceivedEventHandler(FrameReceived);
 }
Beispiel #12
0
 private void RtpStreamRemoved(object sender, RtpEvents.RtpStreamEventArgs ea)
 {
     ea.RtpStream.FrameReceived -= new RtpStream.FrameReceivedEventHandler(FrameReceived);
 }
Beispiel #13
0
 void RtpEvents_RtpStreamRemoved(object sender, RtpEvents.RtpStreamEventArgs ea)
 {
     ea.RtpStream.FrameReceived -= RtpStream_FrameReceived;
 }
        /// <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);
            }
        }
Beispiel #15
0
        private void RtpStreamAdded(object sender, RtpEvents.RtpStreamEventArgs ea)
        {
            if (firststream)
            {
                FORMY.naglowki = new ArrayList();
                FORMY.pola     = new ArrayList();

                Label label = new Label();
                label.Text     = "Kamera " + (polaczenia.Count + 1).ToString() + ". Położenie strefy:";
                label.AutoSize = true;
                this.Invoke((MethodInvoker) delegate() { d_flp_strefy.Controls.Add(label); });
                this.Invoke((MethodInvoker) delegate() { d_flp_strefy.SetFlowBreak(label, true); });
                FORMY.naglowki.Add(label);

                Label X = new Label();
                X.Text     = "X:";
                X.AutoSize = true;
                this.Invoke((MethodInvoker) delegate() { d_flp_strefy.Controls.Add(X); });
                FORMY.naglowki.Add(X);

                NumericUpDown textX = new NumericUpDown();
                this.Invoke((MethodInvoker) delegate() { d_flp_strefy.Controls.Add(textX); });
                this.Invoke((MethodInvoker) delegate() { d_flp_strefy.SetFlowBreak(textX, true); });
                FORMY.pola.Add(textX);

                Label Y = new Label();
                Y.Text     = "Y:";
                Y.AutoSize = true;
                this.Invoke((MethodInvoker) delegate() { d_flp_strefy.Controls.Add(Y); });
                FORMY.naglowki.Add(Y);

                NumericUpDown textY = new NumericUpDown();
                this.Invoke((MethodInvoker) delegate() { d_flp_strefy.Controls.Add(textY); });
                this.Invoke((MethodInvoker) delegate() { d_flp_strefy.SetFlowBreak(textY, true); });
                FORMY.pola.Add(textY);


                Label wysokosc = new Label();
                wysokosc.Text     = "Wysokość strefy w pikselach";
                wysokosc.AutoSize = true;
                this.Invoke((MethodInvoker) delegate() { d_flp_strefy.Controls.Add(wysokosc); });
                FORMY.naglowki.Add(wysokosc);


                NumericUpDown textH = new NumericUpDown();
                this.Invoke((MethodInvoker) delegate() { d_flp_strefy.Controls.Add(textH); });
                this.Invoke((MethodInvoker) delegate() { d_flp_strefy.SetFlowBreak(textH, true); });
                FORMY.pola.Add(textH);

                Label szerokosc = new Label();
                szerokosc.Text     = "Szerokość strefy w pikselach";
                szerokosc.AutoSize = true;
                this.Invoke((MethodInvoker) delegate() { d_flp_strefy.Controls.Add(szerokosc); });
                FORMY.naglowki.Add(szerokosc);

                NumericUpDown textW = new NumericUpDown();
                this.Invoke((MethodInvoker) delegate() { d_flp_strefy.Controls.Add(textW); });
                FORMY.pola.Add(textW);

                PictureBox ol = new PictureBox();
                ol.Dock = DockStyle.Fill;
                this.Invoke((MethodInvoker) delegate() { d_tlp_kamery.Controls.Add(ol); });
                FORMY.obrazy = ol;
                ea.RtpStream.FrameReceived += new RtpStream.FrameReceivedEventHandler(Odbior);
                polaczenia.Add(ea.RtpStream, FORMY);
            }
            else
            {
                firststream = true;
            }
        }
Beispiel #16
0
 private void RtpStreamAdded(object sender, RtpEvents.RtpStreamEventArgs ea)
 {
     //dodanie zdarzenia obsługującego odbiór ramki
     ea.RtpStream.FrameReceived += new RtpStream.FrameReceivedEventHandler(Odbior);
 }
 void RtpEvents_RtpStreamAdded(object sender, RtpEvents.RtpStreamEventArgs ea)
 {
     Console.Out.WriteLine("Stream added\n");
 }
 void RtpEvents_RtpStreamTimeout(object sender, RtpEvents.RtpStreamEventArgs ea)
 {
     Console.Out.WriteLine("Stream timeout\n");
 }
 // CF1, CF3
 private void RtpStreamAdded(object sender, RtpEvents.RtpStreamEventArgs ea)
 {
     rtpStream = ea.RtpStream;
 }