From bf231ead1c38d9a8f4a874e404e23b716612d030 Mon Sep 17 00:00:00 2001 From: Jaslo Ziska Date: Thu, 30 Nov 2023 16:43:09 +0100 Subject: 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 Reviewed-by: Nicolas Dufresne Tested-by: Nicolas Dufresne Reviewed-by: Laurent Pinchart Signed-off-by: Laurent Pinchart --- src/gstreamer/gstlibcamerasrc.cpp | 13 ++++++++----- 1 file 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); -- cgit v1.2.1