From 17e131a0c682099097e4e84f80f6108557de93f5 Mon Sep 17 00:00:00 2001 From: zqc <835569504@qq.com> Date: Thu, 26 Feb 2026 14:16:38 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B0=86=E5=8F=82=E6=95=B0=E4=BC=A0=E8=BF=9Bbi?= =?UTF-8?q?z=EF=BC=8C=E5=B9=B6=E5=AD=98=E4=B8=BAdict?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- biz/checkpoint/checkpoint_biz.py | 4 +++- rtsp_service_ws_kadian.py | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/biz/checkpoint/checkpoint_biz.py b/biz/checkpoint/checkpoint_biz.py index 8f8dce3..755f456 100644 --- a/biz/checkpoint/checkpoint_biz.py +++ b/biz/checkpoint/checkpoint_biz.py @@ -693,11 +693,13 @@ class KadianDetector: # ========================= 帧处理线程 ========================= class FrameProcessorWorker(threading.Thread): - def __init__(self, raw_queue: queue.Queue, ws_queue: queue.Queue, stop_event: threading.Event): + def __init__(self, raw_queue: queue.Queue, ws_queue: queue.Queue, stop_event: threading.Event, cameras=None): super().__init__(daemon=True) self.raw_queue = raw_queue self.ws_queue = ws_queue self.stop_event = stop_event + # 将摄像头列表转换为字典,key为id,方便通过camera_id快速查找 + self.cameras = {cam.id: cam for cam in cameras} if cameras is not None else {} self.last_ts: Dict[int, float] = {} diff --git a/rtsp_service_ws_kadian.py b/rtsp_service_ws_kadian.py index 65a1ac1..fa06527 100644 --- a/rtsp_service_ws_kadian.py +++ b/rtsp_service_ws_kadian.py @@ -182,7 +182,7 @@ class RTSPService: self.ws_queue = queue.Queue(maxsize=1000) self.capture_workers = [] - self.processor = FrameProcessorWorker(self.raw_queue, self.ws_queue, self.stop_event) + self.processor = FrameProcessorWorker(self.raw_queue, self.ws_queue, self.stop_event, self.cameras) self.ws_sender = WebSocketSender(self.ws_queue, self.stop_event, WS_HOST, WS_PORT) def start(self):