fix: MJPEG server threaded (evite le blocage mono-client, backlog TCP)

This commit is contained in:
nicoboy
2026-07-18 15:37:28 +02:00
parent 0620d9a8a7
commit b472c70ea2

View File

@ -15,7 +15,7 @@ import socket
import sys
import threading
import time
from http.server import BaseHTTPRequestHandler, HTTPServer
from http.server import BaseHTTPRequestHandler, HTTPServer, ThreadingHTTPServer
from pathlib import Path
import numpy as np
@ -287,7 +287,7 @@ def main():
t = threading.Thread(target=capture_loop, args=(model,), daemon=True)
t.start()
server = HTTPServer(("0.0.0.0", MJPEG_PORT), MJPEGHandler)
server = ThreadingHTTPServer(("0.0.0.0", MJPEG_PORT), MJPEGHandler)
print(f"[CAM] MJPEG stream sur http://0.0.0.0:{MJPEG_PORT}/")
print(f"[CAM] Ouvrir dans un navigateur ou VLC : http://192.168.1.84:{MJPEG_PORT}/")