Ejemplo n.º 1
0
        private static void verifyStream(DBStreamPlayer streamPlayer)
        {
            BufferChunk frame;
            long        streamTime;
            BufferChunk sample;
            bool        keyframe;
            long        refTime        = 0;
            long        lastStreamTime = 0;
            long        timediff       = 0;
            DateTime    dt;

            while (streamPlayer.GetNextFrame(out frame, out streamTime))
            {
                try {
                    sample = ProfileUtility.FrameToSample(frame, out keyframe);
                }
                catch (Exception ex) {
                    dt = new DateTime(streamTime);
                    Console.WriteLine("FrameToSample failed at: " + dt.ToString() + "; Sampletime=" + streamTime.ToString());
                    Console.WriteLine(ex.ToString());
                    continue;
                }
                if (refTime == 0)
                {
                    refTime = streamTime;
                }


                timediff = streamTime - lastStreamTime;

                // Look for large intervals
                //if (timediff > 500000L) {
                //    dt = new DateTime(streamTime);
                //    Console.WriteLine("Sample: " + dt.ToString() + "; Sampletime=" + streamTime.ToString() + "; length=" + sample.Length.ToString() + ";interval=" + timediff.ToString());
                //}
                // Look for large samples
                //if (sample.Length > 90000) {
                //    dt = new DateTime(streamTime);
                //    Console.WriteLine("Sample: " + dt.ToString() + "; Sampletime=" + streamTime.ToString() + "; length=" + sample.Length.ToString() + ";interval=" + timediff.ToString());
                //}
                // Look for small samples
                //if (sample.Length < 300) {
                //    dt = new DateTime(streamTime);
                //    Console.WriteLine("Sample: " + dt.ToString() + "; Sampletime=" + streamTime.ToString() + "; length=" + sample.Length.ToString() + ";interval=" + timediff.ToString());
                //}

                lastStreamTime = streamTime;
            }

            DateTime dt1 = new DateTime(refTime);
            DateTime dt2 = new DateTime(lastStreamTime);

            Console.WriteLine("Started at " + dt1.ToString() + "; Ended at " + dt2.ToString() + " (" + lastStreamTime.ToString() + " ticks)" +
                              " after duration ticks =" + (lastStreamTime - refTime).ToString());
        }
Ejemplo n.º 2
0
        private static void verifyStream(DBStreamPlayer streamPlayer)
        {
            BufferChunk frame;
            long        streamTime;
            BufferChunk sample;
            bool        keyframe;
            long        refTime        = 0;
            long        lastStreamTime = 0;

            while (streamPlayer.GetNextFrame(out frame, out streamTime))
            {
                try {
                    sample = ProfileUtility.FrameToSample(frame, out keyframe);
                }
                catch (Exception ex) {
                    DateTime dt = new DateTime(streamTime);
                    Console.WriteLine("FrameToSample failed at: " + dt.ToString() + "; Sampletime=" + streamTime.ToString());
                    Console.WriteLine(ex.ToString());
                    continue;
                }
                if (refTime == 0)
                {
                    refTime = streamTime;
                }
                //DateTime dt = new DateTime(streamTime);
                //Console.WriteLine("Sample: " + dt.ToString() + "; Sampletime=" + streamTime.ToString() + "; length=" + sample.Length.ToString());                    Console.WriteLine(ex.ToString());

                lastStreamTime = streamTime;
            }

            DateTime dt1 = new DateTime(refTime);
            DateTime dt2 = new DateTime(lastStreamTime);

            Console.WriteLine("Started at " + dt1.ToString() + "; Ended at " + dt2.ToString() + " (" + lastStreamTime.ToString() + " ticks)" +
                              " after duration ticks =" + (lastStreamTime - refTime).ToString());
        }