Added lock acquisition to preview functions
This commit is contained in:
parent
4bf866b66b
commit
fccc58fd62
1 changed files with 24 additions and 21 deletions
|
|
@ -327,6 +327,7 @@ class PiCameraStreamer(BaseCamera):
|
||||||
"""Start the on board GPU camera preview."""
|
"""Start the on board GPU camera preview."""
|
||||||
logging.info("Starting the GPU preview")
|
logging.info("Starting the GPU preview")
|
||||||
|
|
||||||
|
with self.lock():
|
||||||
try:
|
try:
|
||||||
if not self.camera.preview:
|
if not self.camera.preview:
|
||||||
logging.debug("Starting preview")
|
logging.debug("Starting preview")
|
||||||
|
|
@ -351,6 +352,8 @@ class PiCameraStreamer(BaseCamera):
|
||||||
|
|
||||||
def stop_preview(self):
|
def stop_preview(self):
|
||||||
"""Stop the on board GPU camera preview."""
|
"""Stop the on board GPU camera preview."""
|
||||||
|
with self.lock():
|
||||||
|
if self.camera.preview:
|
||||||
self.camera.stop_preview()
|
self.camera.stop_preview()
|
||||||
self.preview_active = False
|
self.preview_active = False
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue