public void Test1() { var camFilter = new VirtualCamFilter(); var tcpServer = new NetworkCamServer(NetworkCamPortNumber, camFilter); var startTask = tcpServer.StartAsync(); Thread.Sleep(1000); var client = new NetworkCamDriverClient(); client.Connect("127.0.0.1", NetworkCamPortNumber); var b = new byte[1920 * 1080 * 4]; var image = new Memory <byte>(b); //for (var i = 0; i < 10; i++) //{ // //Thread.Sleep(100); // ConcurrentRandom.NextBytes(b); // client.SendImage(image).Wait(); //} Thread.Sleep(2_000); var b1 = VirtualCamFilter.FrontBuffer.ToArray(); for (var i = 0; i < b.Length; i++) { Assert.Equal(b[i], b1[i]); } Assert.Equal(b, b1); }
public VirtualCamFilter() : base("Tedd.VirtualNetworkCam") { Logger.Info("VirtualCamFilter.Ctr()"); if (_tcpServer == null) { _tcpServer = new NetworkCamServer(9090, this); _tcpServerTask = _tcpServer.StartAsync(); _settings = new AppSettings(); var size = m_nWidth * m_nHeight * ((m_nBitCount + 7) / 8); var b1 = new byte[size]; var b2 = new byte[size]; //rnd.NextBytes(b1); //rnd.NextBytes(b2); FrontBuffer = new Memory <byte>(b1); BackBuffer = new Memory <byte>(b2); } m_bmi.bmiHeader = new BitmapInfoHeader(); AddPin(new VirtualCamStream("Capture", this)); }