@@ -8,6 +8,7 @@
#pragma once
#include <memory>
+#include <queue>
#include <set>
#include <string>
#include <sys/types.h>
@@ -76,9 +77,14 @@ private:
void mediaDeviceDisconnected(MediaDevice *media);
virtual void disconnect();
+ void doQueueRequest(Request *request);
+ void doQueueRequests();
+
std::vector<std::shared_ptr<MediaDevice>> mediaDevices_;
std::vector<std::weak_ptr<Camera>> cameras_;
+ std::queue<Request *> waitingRequests_;
+
const char *name_;
friend class PipelineHandlerFactory;
@@ -58,6 +58,15 @@ TRACEPOINT_EVENT_INSTANCE(
)
)
+TRACEPOINT_EVENT_INSTANCE(
+ libcamera,
+ request,
+ request_device_queue,
+ TP_ARGS(
+ libcamera::Request *, req
+ )
+)
+
TRACEPOINT_EVENT_INSTANCE(
libcamera,
request,
@@ -312,6 +312,17 @@ void PipelineHandler::queueRequest(Request *request)
{
LIBCAMERA_TRACEPOINT(request_queue, request);
+ waitingRequests_.push(request);
+ doQueueRequests();
+}
+
+/**
+ * \brief Queue one requests to the device
+ */
+void PipelineHandler::doQueueRequest(Request *request)
+{
+ LIBCAMERA_TRACEPOINT(request_device_queue, request);
+
Camera *camera = request->_d()->camera();
Camera::Private *data = camera->_d();
data->queuedRequests_.push_back(request);
@@ -325,6 +336,22 @@ void PipelineHandler::queueRequest(Request *request)
}
}
+/**
+ * \brief Queue requests to the device
+ *
+ * Iterate the list of waiting requests and queue them to the device one
+ * by one.
+ */
+void PipelineHandler::doQueueRequests()
+{
+ while (!waitingRequests_.empty()) {
+ Request *request = waitingRequests_.front();
+ waitingRequests_.pop();
+
+ doQueueRequest(request);
+ }
+}
+
/**
* \fn PipelineHandler::queueRequestDevice()
* \brief Queue a request to the device