Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed FATAL: exception not rethrown in webcamvideostream #237

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions imutils/video/webcamvideostream.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,19 @@ def __init__(self, src=0, name="WebcamVideoStream"):

# initialize the thread name
self.name = name

# intialize thread
self.thread = Thread(target=self.update, name=self.name, args=())
self.thread.daemon = True

# initialize the variable used to indicate if the thread should
# be stopped
self.stopped = False

def start(self):
# start the thread to read frames from the video stream
t = Thread(target=self.update, name=self.name, args=())
t.daemon = True
t.start()

self.thread.start()
return self

def update(self):
Expand All @@ -40,3 +43,6 @@ def read(self):
def stop(self):
# indicate that the thread should be stopped
self.stopped = True

# wait until stream resources are released (producer thread might be still grabbing frame)
self.thread.join()