refactor: enhance error logging in RTSPReader for better debugging of frame capture issues
Some checks failed
Build Worker Base and Application Images / deploy-stack (push) Blocked by required conditions
Build Worker Base and Application Images / check-base-changes (push) Successful in 7s
Build Worker Base and Application Images / build-base (push) Has been skipped
Build Worker Base and Application Images / build-docker (push) Has been cancelled
Some checks failed
Build Worker Base and Application Images / deploy-stack (push) Blocked by required conditions
Build Worker Base and Application Images / check-base-changes (push) Successful in 7s
Build Worker Base and Application Images / build-base (push) Has been skipped
Build Worker Base and Application Images / build-docker (push) Has been cancelled
This commit is contained in:
parent
cb9ff7bc86
commit
c6a4258055
1 changed files with 10 additions and 1 deletions
|
@ -94,8 +94,17 @@ class RTSPReader:
|
|||
if not ret or frame is None:
|
||||
consecutive_errors += 1
|
||||
|
||||
# Verbose logging to see actual errors
|
||||
logger.error(f"Camera {self.camera_id}: cap.read() failed - ret={ret}, frame={frame is not None}")
|
||||
|
||||
# Try to get more info from the capture
|
||||
if self.cap.isOpened():
|
||||
logger.debug(f"Camera {self.camera_id}: Capture still open, backend: {self.cap.getBackendName()}")
|
||||
else:
|
||||
logger.error(f"Camera {self.camera_id}: Capture is closed!")
|
||||
|
||||
if consecutive_errors >= self.max_consecutive_errors:
|
||||
logger.error(f"Camera {self.camera_id}: Too many consecutive errors, reinitializing")
|
||||
logger.error(f"Camera {self.camera_id}: Too many consecutive errors ({consecutive_errors}), reinitializing")
|
||||
self._reinitialize_capture()
|
||||
consecutive_errors = 0
|
||||
time.sleep(self.error_recovery_delay)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue