summaryrefslogtreecommitdiff
path: root/src/gstreamer/gstlibcamerasrc.cpp
diff options
context:
space:
mode:
authorJaslo Ziska <jaslo@ziska.de>2023-11-30 16:43:09 +0100
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2023-12-07 01:26:46 +0200
commitbf231ead1c38d9a8f4a874e404e23b716612d030 (patch)
treeb3b059ad28fea55e662144325e10f22d9855d05b /src/gstreamer/gstlibcamerasrc.cpp
parent9d4da0ca9834c5ecbd8cd1bf10aef3cf3c4716e7 (diff)
gstreamer: Add GstLibcameraSrcState::clearRequests method
Add a clearRequests() function to GstLibcameraSrcState which clears the GstLibcameraSrcState::completedRequests_ queue. Use this new function in gst_libcamera_src_task_leave() instead of doing it manually. Signed-off-by: Jaslo Ziska <jaslo@ziska.de> Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com> Tested-by: Nicolas Dufresne <nicolas.dufresne@collabora.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Diffstat (limited to 'src/gstreamer/gstlibcamerasrc.cpp')
-rw-r--r--src/gstreamer/gstlibcamerasrc.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/gstreamer/gstlibcamerasrc.cpp b/src/gstreamer/gstlibcamerasrc.cpp
index ca4e8854..d1d610c5 100644
--- a/src/gstreamer/gstlibcamerasrc.cpp
+++ b/src/gstreamer/gstlibcamerasrc.cpp
@@ -133,6 +133,7 @@ struct GstLibcameraSrcState {
int queueRequest();
void requestCompleted(Request *request);
int processRequest();
+ void clearRequests();
};
struct _GstLibcameraSrc {
@@ -318,6 +319,12 @@ int GstLibcameraSrcState::processRequest()
return err;
}
+void GstLibcameraSrcState::clearRequests()
+{
+ GLibLocker locker(&lock_);
+ completedRequests_ = {};
+}
+
static bool
gst_libcamera_src_open(GstLibcameraSrc *self)
{
@@ -628,11 +635,7 @@ gst_libcamera_src_task_leave([[maybe_unused]] GstTask *task,
GST_DEBUG_OBJECT(self, "Streaming thread is about to stop");
state->cam_->stop();
-
- {
- GLibLocker locker(&state->lock_);
- state->completedRequests_ = {};
- }
+ state->clearRequests();
{
GLibRecLocker locker(&self->stream_lock);