Message ID | 20200227200407.490616-26-nicolas.dufresne@collabora.com |
---|---|
State | Accepted |
Headers | show |
Series |
|
Related | show |
Hi Nicolas and Jakub, Thank you for the patch. On Thu, Feb 27, 2020 at 03:04:05PM -0500, Nicolas Dufresne wrote: > From: Jakub Adam <jakub.adam@collabora.com> > > Task resume will be added in the core GStreamer API in the future and > we will need to call this in another location in the following patches. > > Signed-off-by: Jakub Adam <jakub.adam@collabora.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> > --- > src/gstreamer/gstlibcamera-utils.cpp | 11 +++++++++++ > src/gstreamer/gstlibcamera-utils.h | 1 + > src/gstreamer/gstlibcamerasrc.cpp | 10 +--------- > 3 files changed, 13 insertions(+), 9 deletions(-) > > diff --git a/src/gstreamer/gstlibcamera-utils.cpp b/src/gstreamer/gstlibcamera-utils.cpp > index 231f3c5..11c2d56 100644 > --- a/src/gstreamer/gstlibcamera-utils.cpp > +++ b/src/gstreamer/gstlibcamera-utils.cpp > @@ -160,3 +160,14 @@ gst_libcamera_configure_stream_from_caps(StreamConfiguration &stream_cfg, > stream_cfg.size.width = width; > stream_cfg.size.height = height; > } > + > +void > +gst_libcamera_resume_task(GstTask *task) > +{ > + /* We only want to resume the task if it's paused. */ > + GLibLocker lock(GST_OBJECT(task)); > + if (GST_TASK_STATE(task) == GST_TASK_PAUSED) { > + GST_TASK_STATE(task) = GST_TASK_STARTED; > + GST_TASK_SIGNAL(task); > + } > +} > diff --git a/src/gstreamer/gstlibcamera-utils.h b/src/gstreamer/gstlibcamera-utils.h > index 51898a0..440f196 100644 > --- a/src/gstreamer/gstlibcamera-utils.h > +++ b/src/gstreamer/gstlibcamera-utils.h > @@ -17,6 +17,7 @@ GstCaps *gst_libcamera_stream_formats_to_caps(const libcamera::StreamFormats &fo > GstCaps *gst_libcamera_stream_configuration_to_caps(const libcamera::StreamConfiguration &stream_cfg); > void gst_libcamera_configure_stream_from_caps(libcamera::StreamConfiguration &stream_cfg, > GstCaps *caps); > +void gst_libcamera_resume_task(GstTask *task); > > /** > * \class GLibLocker > diff --git a/src/gstreamer/gstlibcamerasrc.cpp b/src/gstreamer/gstlibcamerasrc.cpp > index 1e55916..fe60584 100644 > --- a/src/gstreamer/gstlibcamerasrc.cpp > +++ b/src/gstreamer/gstlibcamerasrc.cpp > @@ -193,15 +193,7 @@ GstLibcameraSrcState::requestCompleted(Request *request) > gst_libcamera_pad_queue_buffer(srcpad, buffer); > } > > - { > - /* We only want to resume the task if it's paused. */ > - GstTask *task = this->src->task; > - GLibLocker lock(GST_OBJECT(task)); > - if (GST_TASK_STATE(task) == GST_TASK_PAUSED) { > - GST_TASK_STATE(task) = GST_TASK_STARTED; > - GST_TASK_SIGNAL(task); > - } > - } > + gst_libcamera_resume_task(this->src->task); > } > > static bool
diff --git a/src/gstreamer/gstlibcamera-utils.cpp b/src/gstreamer/gstlibcamera-utils.cpp index 231f3c5..11c2d56 100644 --- a/src/gstreamer/gstlibcamera-utils.cpp +++ b/src/gstreamer/gstlibcamera-utils.cpp @@ -160,3 +160,14 @@ gst_libcamera_configure_stream_from_caps(StreamConfiguration &stream_cfg, stream_cfg.size.width = width; stream_cfg.size.height = height; } + +void +gst_libcamera_resume_task(GstTask *task) +{ + /* We only want to resume the task if it's paused. */ + GLibLocker lock(GST_OBJECT(task)); + if (GST_TASK_STATE(task) == GST_TASK_PAUSED) { + GST_TASK_STATE(task) = GST_TASK_STARTED; + GST_TASK_SIGNAL(task); + } +} diff --git a/src/gstreamer/gstlibcamera-utils.h b/src/gstreamer/gstlibcamera-utils.h index 51898a0..440f196 100644 --- a/src/gstreamer/gstlibcamera-utils.h +++ b/src/gstreamer/gstlibcamera-utils.h @@ -17,6 +17,7 @@ GstCaps *gst_libcamera_stream_formats_to_caps(const libcamera::StreamFormats &fo GstCaps *gst_libcamera_stream_configuration_to_caps(const libcamera::StreamConfiguration &stream_cfg); void gst_libcamera_configure_stream_from_caps(libcamera::StreamConfiguration &stream_cfg, GstCaps *caps); +void gst_libcamera_resume_task(GstTask *task); /** * \class GLibLocker diff --git a/src/gstreamer/gstlibcamerasrc.cpp b/src/gstreamer/gstlibcamerasrc.cpp index 1e55916..fe60584 100644 --- a/src/gstreamer/gstlibcamerasrc.cpp +++ b/src/gstreamer/gstlibcamerasrc.cpp @@ -193,15 +193,7 @@ GstLibcameraSrcState::requestCompleted(Request *request) gst_libcamera_pad_queue_buffer(srcpad, buffer); } - { - /* We only want to resume the task if it's paused. */ - GstTask *task = this->src->task; - GLibLocker lock(GST_OBJECT(task)); - if (GST_TASK_STATE(task) == GST_TASK_PAUSED) { - GST_TASK_STATE(task) = GST_TASK_STARTED; - GST_TASK_SIGNAL(task); - } - } + gst_libcamera_resume_task(this->src->task); } static bool