[libcamera-devel] [PATCH v2 2/3] gstreamer: Add GstLibcameraSrcState::clearRequests method
Nicolas Dufresne
nicolas at ndufresne.ca
Tue Dec 5 17:11:22 CET 2023
Le jeudi 30 novembre 2023 à 16:43 +0100, Jaslo Ziska via libcamera-devel a
écrit :
> Add a clearRequests method to GstLibcameraSrcState which clears the
> GstLibcameraSrcState::completedRequests_ queue.
>
> Use this new method in gst_libcamera_src_task_leave instead of doing it
> manually.
>
> Signed-off-by: Jaslo Ziska <jaslo at ziska.de>
Reviewed-by: Nicolas Dufresne <nicolas.dufresne at collabora.com>
> ---
> 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 e57ba52f..d448a750 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)
> {
> @@ -629,11 +636,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);
More information about the libcamera-devel
mailing list