gst: utils: Factor-out the task resume helper

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>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
This commit is contained in:
Jakub Adam 2020-02-27 14:38:07 -05:00 committed by Laurent Pinchart
parent a9ce14b0e0
commit 9dab15bed6
3 changed files with 13 additions and 9 deletions

View file

@ -167,3 +167,14 @@ gst_libcamera_configure_stream_from_caps(StreamConfiguration &stream_cfg,
stream_cfg.size.width = width; stream_cfg.size.width = width;
stream_cfg.size.height = height; 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);
}
}

View file

@ -18,6 +18,7 @@ GstCaps *gst_libcamera_stream_formats_to_caps(const libcamera::StreamFormats &fo
GstCaps *gst_libcamera_stream_configuration_to_caps(const libcamera::StreamConfiguration &stream_cfg); GstCaps *gst_libcamera_stream_configuration_to_caps(const libcamera::StreamConfiguration &stream_cfg);
void gst_libcamera_configure_stream_from_caps(libcamera::StreamConfiguration &stream_cfg, void gst_libcamera_configure_stream_from_caps(libcamera::StreamConfiguration &stream_cfg,
GstCaps *caps); GstCaps *caps);
void gst_libcamera_resume_task(GstTask *task);
/** /**
* \class GLibLocker * \class GLibLocker

View file

@ -196,15 +196,7 @@ GstLibcameraSrcState::requestCompleted(Request *request)
gst_libcamera_pad_queue_buffer(srcpad, buffer); gst_libcamera_pad_queue_buffer(srcpad, buffer);
} }
{ gst_libcamera_resume_task(this->src_->task);
/* We only want to resume the task if it's paused. */
GstTask *task = 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);
}
}
} }
static bool static bool