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:
parent
3dc1e4cd92
commit
c5d490750b
@ -90,11 +90,12 @@ class Server:
|
|||||||
self.connection.flush()
|
self.connection.flush()
|
||||||
stream.seek(0)
|
stream.seek(0)
|
||||||
b = stream.read()
|
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(lengthBin)
|
||||||
self.connection.write(b)
|
self.connection.write(b)
|
||||||
if time.time() - start > 600:
|
|
||||||
break
|
|
||||||
stream.seek(0)
|
stream.seek(0)
|
||||||
stream.truncate()
|
stream.truncate()
|
||||||
except :
|
except :
|
||||||
|
Loading…
Reference in New Issue
Block a user