diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/argaze/utils/contexts/TobiiProGlasses2.py | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/src/argaze/utils/contexts/TobiiProGlasses2.py b/src/argaze/utils/contexts/TobiiProGlasses2.py index 13dcf4a..b8810ae 100644 --- a/src/argaze/utils/contexts/TobiiProGlasses2.py +++ b/src/argaze/utils/contexts/TobiiProGlasses2.py @@ -1171,6 +1171,7 @@ class SegmentPlayback(ArFeatures.DataPlaybackContext): self.__sync_event_unit = None self.__sync_event_factor = None self.__sync_data_ts = None + self.__sync_video_ts = None self.__sync_ts = None self.__last_sync_data_ts = None self.__last_sync_ts = None @@ -1303,13 +1304,16 @@ class SegmentPlayback(ArFeatures.DataPlaybackContext): logging.debug('> read image at %i timestamp', video_ts) - # Don't process images if sync is required but sync event not happened yet - if self.__sync_event is not None and self.__sync_ts is not None: + # if sync is required + if self.__sync_event is not None: - sync_video_ts = int(self.__sync_ts + video_ts - self.__sync_data_ts) + # Wait for a first sync event + if self.__sync_ts is not None: - # Process camera image - self._process_camera_image(timestamp=sync_video_ts, image=video_image) + self.__sync_video_ts = int(self.__sync_ts + video_ts - self.__sync_data_ts) + + # Process camera image + self._process_camera_image(timestamp=self.__sync_video_ts, image=video_image) # Otherwise, always process images elif self.__sync_event is None: @@ -1360,8 +1364,13 @@ class SegmentPlayback(ArFeatures.DataPlaybackContext): logging.info('Difference between data and sync event timestamps is %i ms', diff_data_ts-diff_sync_ts) + # Don't process gaze positions if sync is required but no image have been processed yet + if self.__sync_event is not None and self.__sync_video_ts is None: + + continue + # Don't process gaze positions if sync is required but sync event not happened yet - if self.__sync_event is not None and self.__sync_ts is None: + elif self.__sync_event is not None and self.__sync_ts is None: continue |