forked from dsutanto/zenai-kpc-python
merging to main
This commit is contained in:
1 parent
d9c04d36c0
commit
6071d56dc3
5 files changed
+196
-146
No files matched your search
+1
-13
@@ -1108,18 +1108,6 @@ def draw_popups(img, popups, frame_idx):
|
||||
return alive
|
||||
|
||||
|
||||
def _write_live_frame_atomic(path, jpeg_bytes):
|
||||
"""Write JPEG atomically so dashboard readers never see a partial file."""
|
||||
dest = Path(path)
|
||||
dest.parent.mkdir(parents=True, exist_ok=True)
|
||||
tmp = dest.with_suffix(dest.suffix + ".tmp")
|
||||
with open(tmp, "wb") as f:
|
||||
f.write(jpeg_bytes)
|
||||
f.flush()
|
||||
os.fsync(f.fileno())
|
||||
os.replace(tmp, dest)
|
||||
|
||||
|
||||
def connect_stream(source, warmup=WARMUP_FRAMES):
|
||||
attempts = 0
|
||||
while not shutdown_requested:
|
||||
@@ -1605,4 +1593,4 @@ object_tracked = {}
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
run()
|
||||
run()
|
||||
Reference in new issue
Block a user