Fixed bug with --gaze-tracking 0 and added explicit gc calls at end of frame.

This commit is contained in:
Emiliana 2020-08-21 22:47:02 +02:00
parent db43cf8096
commit 87236c0549
3 changed files with 22 additions and 6 deletions

View file

@ -7,6 +7,7 @@ import escapi
import dshowcapture
import time
import traceback
import gc
class VideoReader():
def __init__(self, capture, camera=False):
@ -69,7 +70,12 @@ class DShowCaptureReader(VideoReader):
def is_ready(self):
return self.device.capturing()
def read(self):
img = self.device.get_frame(self.timeout)
img = None
try:
img = self.device.get_frame(self.timeout)
except:
gc.collect()
img = self.device.get_frame(self.timeout)
if img is None:
return False, None
else: