summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/android/camera_worker.cpp14
-rw-r--r--src/android/camera_worker.h6
2 files changed, 14 insertions, 6 deletions
diff --git a/src/android/camera_worker.cpp b/src/android/camera_worker.cpp
index 300ddde0..9f727826 100644
--- a/src/android/camera_worker.cpp
+++ b/src/android/camera_worker.cpp
@@ -52,18 +52,24 @@ void CaptureRequest::queue()
*/
CameraWorker::CameraWorker()
{
- worker_.moveToThread(&thread_);
+ worker_.moveToThread(this);
}
void CameraWorker::start()
{
- thread_.start();
+ Thread::start();
}
void CameraWorker::stop()
{
- thread_.exit();
- thread_.wait();
+ exit();
+ wait();
+}
+
+void CameraWorker::run()
+{
+ exec();
+ dispatchMessages(Message::Type::InvokeMessage);
}
void CameraWorker::queueRequest(CaptureRequest *request)
diff --git a/src/android/camera_worker.h b/src/android/camera_worker.h
index 64b1658b..e289ef9b 100644
--- a/src/android/camera_worker.h
+++ b/src/android/camera_worker.h
@@ -42,7 +42,7 @@ private:
std::unique_ptr<libcamera::Request> request_;
};
-class CameraWorker
+class CameraWorker : private libcamera::Thread
{
public:
CameraWorker();
@@ -52,6 +52,9 @@ public:
void queueRequest(CaptureRequest *request);
+protected:
+ void run() override;
+
private:
class Worker : public libcamera::Object
{
@@ -63,7 +66,6 @@ private:
};
Worker worker_;
- libcamera::Thread thread_;
};
#endif /* __ANDROID_CAMERA_WORKER_H__ */