Skip to content

Commit 02bcbb9

Browse files
committed
Improve duplicate camera detection and reporting
Change seen from a set to a mapping of identity key -> camera_id to record which camera produced each key. Add get_camera_id and fallback to camera_id if camera_identity_key raises, logging the exception. Emit a more informative initialization_failed message that includes the camera_id and the conflicting camera, improving diagnostics and robustness when computing identity keys.
1 parent f2d0cc7 commit 02bcbb9

1 file changed

Lines changed: 21 additions & 4 deletions

File tree

dlclivegui/services/multi_camera_controller.py

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -185,13 +185,30 @@ def start(self, camera_settings: list[CameraSettings]) -> None:
185185
return
186186

187187
# Check for dupes
188-
seen = set()
188+
seen = {}
189189
for s in active_settings:
190-
key = camera_identity_key(s)
190+
camera_id = get_camera_id(s)
191+
try:
192+
key = camera_identity_key(s)
193+
except Exception:
194+
LOGGER.exception(
195+
"Failed to compute camera identity key for %s; falling back to camera_id",
196+
camera_id,
197+
)
198+
key = camera_id
199+
191200
if key in seen:
192-
self.initialization_failed.emit([(key, "Duplicate camera configuration")])
201+
self.initialization_failed.emit(
202+
[
203+
(
204+
camera_id,
205+
f"Duplicate camera configuration. Conflicts with {seen[key]}",
206+
)
207+
]
208+
)
193209
return
194-
seen.add(key)
210+
211+
seen[key] = camera_id
195212

196213
self._running = True
197214
self._frames.clear()

0 commit comments

Comments
 (0)