コード例 #1
0
        public void FrameProcessorQueueTest()
        {
            var fp = new TestFrameProcessor();

            var framesList = new List <VideoFrame>();

            fp.Return = false;

            for (byte i = 0; i < 10; i++)
            {
                var frame = new VideoFrame(DateTime.Now, new byte[] { i }, Resolution.Resolution1MP, FrameFormat.Argb32);
                framesList.Add(frame);
                fp.ProcessFrame(frame);
            }
            Assert.AreEqual(0, fp.ProcessFrameCalled.Count);
            fp.Return = true;
            Thread.Sleep(10);
            Assert.AreEqual(10, fp.ProcessFrameCalled.Count);

            for (byte i = 0; i < 10; i++)
            {
                Assert.AreEqual(framesList[i], fp.ProcessFrameCalled[i]);
                framesList[i].Dispose();
            }

            Assert.IsFalse(fp.IsDisposed);
            fp.Dispose();
            Assert.IsTrue(fp.IsDisposed);
        }
コード例 #2
0
        public void FrameProcessorTest()
        {
            var fp = new TestFrameProcessor();

            for (byte i = 0; i < 10; i++)
            {
                var frame = new VideoFrame(DateTime.Now, new[] { i }, Resolution.Resolution1MP, FrameFormat.Argb32);
                fp.ProcessFrameCalled.Clear();
                fp.ProcessFrame(frame);
                Thread.Sleep(10);
                Assert.AreEqual(frame, fp.ProcessFrameCalled[0]);
                frame.Dispose();
            }
            Assert.IsFalse(fp.IsDisposed);
            fp.Dispose();
            Assert.IsTrue(fp.IsDisposed);
        }