Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions dlclivegui/gui/main_window.py
Original file line number Diff line number Diff line change
Expand Up @@ -1760,6 +1760,8 @@ def _on_multi_frame_display_ready(self, frame_data: MultiFrameData) -> None:

Called at GUI_MAX_DISPLAY_FPS, not at camera capture FPS for performance reasons.
"""
if not self.multi_camera_controller.is_running():
return # queued before stop, delivered after: would redraw a frozen frame
self._multi_camera_frames = frame_data.frames
self._multi_camera_display_ids = frame_data.display_ids or {}
self._display_dirty = True
Expand Down
17 changes: 17 additions & 0 deletions tests/gui/test_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,3 +243,20 @@ def test_processor_controls_reenabled_after_inference_stops(
assert window.refresh_processors_button.isEnabled()
assert window.processor_combo.isEnabled()
assert window.use_custom_proc_checkbox.isEnabled()


@pytest.mark.gui
def test_display_frame_delivered_after_stop_is_dropped(window, multi_camera_controller, monkeypatch):
camera_id = "fake:index:0"
frame_data = MultiFrameData(
frames={camera_id: np.full((120, 160, 3), 127, dtype=np.uint8)},
timestamps={camera_id: 123.0},
source_camera_id=camera_id,
)
monkeypatch.setattr(multi_camera_controller, "is_running", lambda: False)

window._on_multi_frame_display_ready(frame_data)
window._update_display_from_pending()

assert not window._multi_camera_frames
assert window._current_frame is None
Loading