Commit 27682f28 authored by nextime's avatar nextime

Add test file to test windows pipe pergormances

parent f8539531
import sys
import time
frame=b""
print(time.time)
num=0
while True:
frame = sys.stdin.buffer.read(1920*1080*3)
#frame = frame + pkt
sys.stdin.buffer.flush()
if len(frame) >= 1920*1080*3:
frane=frame[1920*1080*3:]
num = num+1
if num > 600:
print("ANTANI!", time.time(), num)
sys.exit(0)
time.sleep(0.01)
...@@ -90,28 +90,35 @@ class RemoteProcessFLVWriter: ...@@ -90,28 +90,35 @@ class RemoteProcessFLVWriter:
stderr=asyncio.subprocess.PIPE, stderr=asyncio.subprocess.PIPE,
) )
self.stdout = asyncio.create_task(self._read_to_vcam(self.proc.stdout)) self.stdout = asyncio.create_task(self._read_to_vcam(self.proc.stdout))
self.stderr = asyncio.create_task(self._read_to_file(stderr_log, self.proc.stderr)) #self.stderr = asyncio.create_task(self._read_to_file(stderr_log, self.proc.stderr))
#self.stdout = asyncio.create_task(self._read_to_vcam(self.proc))
async def _read_to_vcam(self, stream: StreamReader): async def _read_to_vcam(self, stream: StreamReader):
with pyvirtualcam.Camera(1920, 1080, 30, fmt=PixelFormat.BGR, device=args.device, print_fps=30) as cam: with pyvirtualcam.Camera(1920, 1080, 30, fmt=PixelFormat.BGR, device=args.device, print_fps=30) as cam:
frame="" frame=b''
frames=0 frames=0
last=time.time() last=time.time()
while not stream.at_eof(): while not stream.at_eof():
frame = await stream.readexactly(1920*1080*3) #pkt = await stream.read(1920*1080*3)
if len(frame) >= 1920*1080*3: #print(len(pkt))
if time.time()-last >= 1: pkt = await stream.readexactly(1920*1080*3)
last=time.time() #pkt, stderr = await stream.communicate()
print(frames, 'fps') if pkt:
frames=0 frame = frame + pkt
#cam.send(np.fromstring(frame[:1920*1080*3], dtype='uint8').reshape((1080,1920,3,))) #print(len(frame))
#cam.send(np.frombuffer(frame, dtype='uint8').reshape((1080, 1920, 3,))) if len(frame) >= 1920*1080*3:
#cam.send(rframe) if time.time()-last >= 1:
#cam.sleep_until_next_frame() last=time.time()
print(frames, 'fps')
frames=frames+1 frames=0
time.sleep(.01) #cam.send(np.fromstring(frame[:1920*1080*3], dtype='uint8').reshape((1080,1920,3,)))
#cam.send(np.frombuffer(frame, dtype='uint8').reshape((1080, 1920, 3,)))
#cam.send(rframe)
#cam.sleep_until_next_frame()
frames=frames+1
frame=frame[1920*1080*3:]
time.sleep(.01)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment