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