Message ID | 20231130155323.13259-3-jaslo@ziska.de |
---|---|
State | Accepted |
Headers | show |
Series |
|
Related | show |
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@ziska.de> Reviewed-by: Nicolas Dufresne <nicolas.dufresne@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);
Hi Jaslo, Thank you for the patch. On Thu, Nov 30, 2023 at 04:43:09PM +0100, Jaslo Ziska via libcamera-devel wrote: > Add a clearRequests method to GstLibcameraSrcState which clears the s/method/function/ (the C++ language has functions, not methods) > GstLibcameraSrcState::completedRequests_ queue. > > Use this new method in gst_libcamera_src_task_leave instead of doing it Same here. > manually. > > Signed-off-by: Jaslo Ziska <jaslo@ziska.de> This change by itself doesn't seem like a major improvement, but its usage in patch 3/3 makes it worth it. Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.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);
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);
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@ziska.de> --- src/gstreamer/gstlibcamerasrc.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-)