Skip to content

Commit

Permalink
Merge pull request #1812 from pupil-labs/drop-non-monotonic-ts
Browse files Browse the repository at this point in the history
Drop frames with non-monotonic timestamps in uvc
  • Loading branch information
papr authored Feb 18, 2020
2 parents b6c3a09 + 6669606 commit 7d2a6e5
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions pupil_src/shared_modules/video_capture/uvc_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -423,6 +423,17 @@ def recent_events(self, events):
# c930 timestamps need to be set here. The camera does not provide valid pts from device
frame.timestamp = uvc.get_time_monotonic() + self.ts_offset
frame.timestamp -= self.g_pool.timebase.value

if (
self._recent_frame is not None
and frame.timestamp <= self._recent_frame.timestamp
):
logger.debug(
"Received non-monotonic timestamps from UVC! Dropping frame."
f" Last: {self._recent_frame.timestamp}, current: {frame.timestamp}"
)
return

self._recent_frame = frame
events["frame"] = frame
self._restart_in = 3
Expand Down

0 comments on commit 7d2a6e5

Please sign in to comment.