From 19243a65f96cb7b30b2d82948088b87d1d12ab35 Mon Sep 17 00:00:00 2001 From: ishiy Date: Thu, 21 Apr 2022 14:13:20 +0900 Subject: [PATCH 1/2] Close #22 --- actfw_jetson/camera.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/actfw_jetson/camera.py b/actfw_jetson/camera.py index f5afdbe..d318bd2 100644 --- a/actfw_jetson/camera.py +++ b/actfw_jetson/camera.py @@ -72,11 +72,10 @@ def __init__(self, size, fps, logger=DEFAULT_LOGGER): self._pipeline.set_state(self._Gst.State.PLAYING) self._glib_loop = GObject.MainLoop() - threading.Thread(target=self._glib_loop.run).start() def run(self): # _appsink_on_new_sample produces frames - pass + threading.Thread(target=self._glib_loop.run).start() def stop(self): self._pipeline.set_state(self._Gst.State.NULL) From 217b44630ffaf06c7da7f13fa31e013551f6026c Mon Sep 17 00:00:00 2001 From: ishiy Date: Thu, 21 Apr 2022 14:42:40 +0900 Subject: [PATCH 2/2] Fix --- actfw_jetson/camera.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/actfw_jetson/camera.py b/actfw_jetson/camera.py index d318bd2..ce9c50d 100644 --- a/actfw_jetson/camera.py +++ b/actfw_jetson/camera.py @@ -69,13 +69,12 @@ def __init__(self, size, fps, logger=DEFAULT_LOGGER): # subscribe to signal appsink.connect("new-sample", _appsink_on_new_sample, self) - self._pipeline.set_state(self._Gst.State.PLAYING) - self._glib_loop = GObject.MainLoop() + threading.Thread(target=self._glib_loop.run).start() def run(self): # _appsink_on_new_sample produces frames - threading.Thread(target=self._glib_loop.run).start() + self._pipeline.set_state(self._Gst.State.PLAYING) def stop(self): self._pipeline.set_state(self._Gst.State.NULL)