Unverified Commit 4a9f0df5 authored by LiangLiu's avatar LiangLiu Committed by GitHub
Browse files

Fix send too many frames to socket once (#378)

parent 0b6676a6
......@@ -112,14 +112,11 @@ class VARecorder:
break
# Convert to numpy and scale to [0, 255], convert RGB to BGR for OpenCV/FFmpeg
if not self.realtime:
frames = (data * 255).clamp(0, 255).to(torch.uint8).cpu().numpy()
self.video_conn.send(frames.tobytes())
else:
for i in range(data.shape[0]):
t0 = time.time()
frame = (data[i] * 255).clamp(0, 255).to(torch.uint8).cpu().numpy()
self.video_conn.send(frame.tobytes())
for i in range(data.shape[0]):
t0 = time.time()
frame = (data[i] * 255).clamp(0, 255).to(torch.uint8).cpu().numpy()
self.video_conn.send(frame.tobytes())
if self.realtime:
time.sleep(max(0, packet_secs - (time.time() - t0)))
fail_time = 0
......
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