Improved corrupt frame handling
Some checks reported errors
continuous-integration/drone Build was killed
Some checks reported errors
continuous-integration/drone Build was killed
This commit is contained in:
parent
3d1aa220dd
commit
4814030936
@ -376,12 +376,14 @@ async def download(resp, queue):
|
|||||||
blob = buf + data[:marker+2]
|
blob = buf + data[:marker+2]
|
||||||
|
|
||||||
# Parse DCT coefficients
|
# Parse DCT coefficients
|
||||||
|
try:
|
||||||
dct = loads(blob)
|
dct = loads(blob)
|
||||||
|
except RuntimeError:
|
||||||
|
counter_frames.labels("corrupted").inc()
|
||||||
|
else:
|
||||||
now = datetime.utcnow()
|
now = datetime.utcnow()
|
||||||
gauge_last_frame.labels("download").set(now.timestamp())
|
gauge_last_frame.labels("download").set(now.timestamp())
|
||||||
try:
|
try:
|
||||||
# Convert Y component to 16 bit for easier handling
|
|
||||||
queue.put_nowait((
|
queue.put_nowait((
|
||||||
now,
|
now,
|
||||||
blob,
|
blob,
|
||||||
@ -395,7 +397,7 @@ async def download(resp, queue):
|
|||||||
counter_receive_frames.inc()
|
counter_receive_frames.inc()
|
||||||
|
|
||||||
# seek begin
|
# seek begin
|
||||||
marker = data.find(b"\xff\xd8")
|
marker = data.rfind(b"\xff\xd8")
|
||||||
if marker >= 0:
|
if marker >= 0:
|
||||||
buf = data[marker:]
|
buf = data[marker:]
|
||||||
else:
|
else:
|
||||||
|
Loading…
Reference in New Issue
Block a user