From 5b2b053afdd72056a40f31eb7708a61efaa58710 Mon Sep 17 00:00:00 2001 From: firestarsdog <229254897+firestarsdog@users.noreply.github.com> Date: Wed, 22 Jul 2026 16:58:54 -0400 Subject: [PATCH] Big UI Camera Fix - Fix Replay --- scripts/launch_ui_c4_desktop.sh | 2 ++ scripts/launch_ui_raybig_desktop.sh | 2 ++ selfdrive/ui/mici/onroad/cameraview.py | 9 ++++++--- selfdrive/ui/onroad/cameraview.py | 9 ++++++--- 4 files changed, 16 insertions(+), 6 deletions(-) diff --git a/scripts/launch_ui_c4_desktop.sh b/scripts/launch_ui_c4_desktop.sh index cdbfd41e1..2d1faca5c 100755 --- a/scripts/launch_ui_c4_desktop.sh +++ b/scripts/launch_ui_c4_desktop.sh @@ -210,6 +210,8 @@ import msgq.ipc_pyx # noqa: F401 import msgq.visionipc.visionipc_pyx # noqa: F401 import openpilot.selfdrive.controls.lib.lateral_mpc_lib.c_generated_code.acados_ocp_solver_pyx # noqa: F401 import openpilot.selfdrive.controls.lib.longitudinal_mpc_lib.c_generated_code.acados_ocp_solver_pyx # noqa: F401 + +assert hasattr(msgq.visionipc.visionipc_pyx.VisionBuf, "frame_id") PY } diff --git a/scripts/launch_ui_raybig_desktop.sh b/scripts/launch_ui_raybig_desktop.sh index d03917bb6..b528893b6 100755 --- a/scripts/launch_ui_raybig_desktop.sh +++ b/scripts/launch_ui_raybig_desktop.sh @@ -212,6 +212,8 @@ import msgq.ipc_pyx # noqa: F401 import msgq.visionipc.visionipc_pyx # noqa: F401 import openpilot.selfdrive.controls.lib.lateral_mpc_lib.c_generated_code.acados_ocp_solver_pyx # noqa: F401 import openpilot.selfdrive.controls.lib.longitudinal_mpc_lib.c_generated_code.acados_ocp_solver_pyx # noqa: F401 + +assert hasattr(msgq.visionipc.visionipc_pyx.VisionBuf, "frame_id") PY } diff --git a/selfdrive/ui/mici/onroad/cameraview.py b/selfdrive/ui/mici/onroad/cameraview.py index 2b0d059c9..d5f7a9d98 100644 --- a/selfdrive/ui/mici/onroad/cameraview.py +++ b/selfdrive/ui/mici/onroad/cameraview.py @@ -292,10 +292,12 @@ class CameraView(Widget): def _observe_displayed_frame(self) -> None: if self.frame is not None: - self._last_frame_id = max(self._last_frame_id, int(self.frame.frame_id)) + client_frame_id = getattr(self.client, "frame_id", -1) if hasattr(self, "client") and self.client is not None else -1 + frame_id = getattr(self.frame, "frame_id", client_frame_id) + self._last_frame_id = max(self._last_frame_id, int(frame_id)) def _accept_frame(self, frame: VisionBuf, packet_frame_id: int) -> bool: - content_frame_id = int(frame.frame_id) + content_frame_id = int(getattr(frame, "frame_id", packet_frame_id)) if content_frame_id < self._last_frame_id: self._regressive_frame_count += 1 if self._regressive_frame_count == 1 or self._regressive_frame_count % 100 == 0: @@ -418,7 +420,8 @@ class CameraView(Widget): # Switch to target self.client = self._target_client self._stream_type = self._target_stream_type - self._last_frame_id = int(self.frame.frame_id) if self.frame is not None else -1 + client_frame_id = getattr(self.client, "frame_id", -1) if hasattr(self, "client") and self.client is not None else -1 + self._last_frame_id = int(getattr(self.frame, "frame_id", client_frame_id)) if self.frame is not None else -1 self._texture_needs_update = True # Reset state diff --git a/selfdrive/ui/onroad/cameraview.py b/selfdrive/ui/onroad/cameraview.py index 0674b2c42..8be38a389 100644 --- a/selfdrive/ui/onroad/cameraview.py +++ b/selfdrive/ui/onroad/cameraview.py @@ -253,10 +253,12 @@ class CameraView(Widget): def _observe_displayed_frame(self) -> None: if self.frame is not None: - self._last_frame_id = max(self._last_frame_id, int(self.frame.frame_id)) + client_frame_id = getattr(self.client, "frame_id", -1) if hasattr(self, "client") and self.client is not None else -1 + frame_id = getattr(self.frame, "frame_id", client_frame_id) + self._last_frame_id = max(self._last_frame_id, int(frame_id)) def _accept_frame(self, frame: VisionBuf, packet_frame_id: int) -> bool: - content_frame_id = int(frame.frame_id) + content_frame_id = int(getattr(frame, "frame_id", packet_frame_id)) if content_frame_id < self._last_frame_id: self._regressive_frame_count += 1 if self._regressive_frame_count == 1 or self._regressive_frame_count % 100 == 0: @@ -370,7 +372,8 @@ class CameraView(Widget): # Switch to target self.client = self._target_client self._stream_type = self._target_stream_type - self._last_frame_id = int(self.frame.frame_id) if self.frame is not None else -1 + client_frame_id = getattr(self.client, "frame_id", -1) if hasattr(self, "client") and self.client is not None else -1 + self._last_frame_id = int(getattr(self.frame, "frame_id", client_frame_id)) if self.frame is not None else -1 self._texture_needs_update = True # Reset state