Admit onboard camera preview only after its acquisition producer is ready

This commit is contained in:
DCCONSTRUCTIONS
2026-09-07 16:44:38 +03:00
parent fa8ac760a1
commit 9e03404f23
5 changed files with 65 additions and 12 deletions
@@ -970,7 +970,9 @@ class XgridsK1CameraGateway:
)
return self.snapshot()
def open_delivery(self, generation: int) -> CameraProcessLease:
def open_delivery(
self, generation: int, *, require_recording: bool = False
) -> CameraProcessLease:
with self._lifecycle_lock:
with self._lock:
self._require_open_locked()
@@ -978,6 +980,8 @@ class XgridsK1CameraGateway:
raise ValueError("camera preview generation не активно")
producer = self._producer
recording_active = self._recording_root is not None
if require_recording and (not recording_active or producer is None):
raise RuntimeError("camera acquisition producer is not ready")
if producer is None:
# An acquisition owns its producer lifecycle. Once an epoch is
# sealed, a disposable browser reconnect must not resurrect the