Пример #1
0
        private void handleFrameReceived(object sender, MSR.LST.Net.Rtp.RtpStream.FrameReceivedEventArgs ea)
        {
            BufferChunk chunk  = ea.Frame;
            string      source = ea.RtpStream.Properties.CName;

            try {
                using (MemoryStream ms = new MemoryStream(chunk.Buffer)) {
                    object msg = this.m_bf.Deserialize(ms);
                    if (msg is UW.ClassroomPresenter.Network.Messages.Message)
                    {
                        NetworkEvent newEvent = new NetworkMessageEvent((Message)msg, DateTime.Now.Ticks, source);
                        this.m_archiver.AppendEvent(newEvent);
                        EventArchivedDelegate ead = new EventArchivedDelegate(this.EventArchived);
                        ead(this, newEvent);
                    }
                    else if (msg is UW.ClassroomPresenter.Network.Chunking.Chunk)
                    {
                        NetworkEvent newEvent = new NetworkChunkEvent((UW.ClassroomPresenter.Network.Chunking.Chunk)msg, DateTime.Now.Ticks, source);
                        this.m_archiver.AppendEvent(newEvent);
                        EventArchivedDelegate ead = new EventArchivedDelegate(this.EventArchived);
                        ead(this, newEvent);
                    }
                    else if (msg is UW.ClassroomPresenter.Network.RTP.RtpNackMessage)
                    {
                        NetworkEvent newEvent = new NetworkNACKMessageEvent((UW.ClassroomPresenter.Network.RTP.RtpNackMessage)msg, DateTime.Now.Ticks, source);
                        this.m_archiver.AppendEvent(newEvent);
                        EventArchivedDelegate ead = new EventArchivedDelegate(this.EventArchived);
                        ead(this, newEvent);
                    }
                }
            } catch (Exception e) {
                Debug.WriteLine("EXCEPTION : " + e.ToString() + " : " + e.StackTrace);
            }
        }
Пример #2
0
 private void handleFrameReceived(object sender, MSR.LST.Net.Rtp.RtpStream.FrameReceivedEventArgs ea)
 {
     BufferChunk chunk = ea.Frame;
     string source = ea.RtpStream.Properties.CName;
     try {
         using (MemoryStream ms = new MemoryStream(chunk.Buffer)) {
             object msg = this.m_bf.Deserialize(ms);
             if (msg is UW.ClassroomPresenter.Network.Messages.Message) {
                 NetworkEvent newEvent = new NetworkMessageEvent((Message)msg, DateTime.Now.Ticks, source);
                 this.m_archiver.AppendEvent(newEvent);
                 EventArchivedDelegate ead = new EventArchivedDelegate(this.EventArchived);
                 ead(this, newEvent);
             } else if (msg is UW.ClassroomPresenter.Network.Chunking.Chunk) {
                 NetworkEvent newEvent = new NetworkChunkEvent((UW.ClassroomPresenter.Network.Chunking.Chunk)msg, DateTime.Now.Ticks, source);
                 this.m_archiver.AppendEvent(newEvent);
                 EventArchivedDelegate ead = new EventArchivedDelegate(this.EventArchived);
                 ead(this, newEvent);
             } else if (msg is UW.ClassroomPresenter.Network.RTP.RtpNackMessage) {
                 NetworkEvent newEvent = new NetworkNACKMessageEvent((UW.ClassroomPresenter.Network.RTP.RtpNackMessage)msg, DateTime.Now.Ticks, source);
                 this.m_archiver.AppendEvent(newEvent);
                 EventArchivedDelegate ead = new EventArchivedDelegate(this.EventArchived);
                 ead(this, newEvent);
             }
         }
     } catch (Exception e) {
         Debug.WriteLine("EXCEPTION : " + e.ToString() + " : " + e.StackTrace);
     }
 }
Пример #3
0
        public NetworkPlayback(string filename)
        {
            ChunkAssembler assembler = new ChunkAssembler();
            NetworkArchiver archiver = new NetworkArchiver();
            archiver.OpenArchive(filename);

            while (archiver.HasMoreEvents()) {
                //Get the current event
                NetworkEvent ne = archiver.GetNextEvent();
                if (ne != null) {
                    //Add it to the chunkEvents (which contains everything)
                    this.chunkEvents.Add(ne);
                    if (ne is NetworkChunkEvent) {
                        NetworkChunkEvent nce = (NetworkChunkEvent)ne;
                        //Add it to the chunk assembler
                        Message m = assembler.Add(nce.chunk);
                        if (m != null) {
                            //We have a complete message!
                            NetworkMessageEvent nme = new NetworkMessageEvent(m, ne.timeIndex, ne.source);
                            this.messageEvents.Add(nme);
                        }
                    } else if (ne is NetworkMessageEvent) {
                        this.messageEvents.Add(((NetworkMessageEvent)ne).message);
                    } else {
                        //Skip
                    }
                }
            }
            archiver.CloseArchive();
        }