Optimization code

Optimization code.
Judge the size of the camera data. If the data is abnormal, discard the
frame data.
This commit is contained in:
Suhayl 2019-12-07 16:11:27 +08:00
parent 3dc1e4cd92
commit c5d490750b

View File

@ -90,11 +90,12 @@ class Server:
self.connection.flush()
stream.seek(0)
b = stream.read()
lengthBin = struct.pack('L', len(b))
length=len(b)
if length >5120000:
continue
lengthBin = struct.pack('L', length)
self.connection.write(lengthBin)
self.connection.write(b)
if time.time() - start > 600:
break
stream.seek(0)
stream.truncate()
except :