qcamsrc: cleanup on stop_requested

Otherwise false errors and seg faults occur
This commit is contained in:
Joshua M. Doe 2021-01-19 17:07:04 -05:00
parent 44fe9a9714
commit 3bec8a37da

View File

@ -446,7 +446,9 @@ static void
video_frame_release (void *data) video_frame_release (void *data)
{ {
VideoFrame *frame = (VideoFrame *) data; VideoFrame *frame = (VideoFrame *) data;
if (!frame->src->stop_requested && frame->src->handle) {
video_frame_queue (frame); video_frame_queue (frame);
}
} }
static VideoFrame * static VideoFrame *
@ -681,9 +683,13 @@ gst_qcamsrc_create (GstPushSrc * psrc, GstBuffer ** buf)
(VideoFrame *) g_async_queue_timeout_pop (src->queue, (VideoFrame *) g_async_queue_timeout_pop (src->queue,
(guint64) src->timeout * 1000 + src->exposure); (guint64) src->timeout * 1000 + src->exposure);
if (!video_frame) { if (!video_frame) {
if (!src->stop_requested) {
GST_ELEMENT_ERROR (src, RESOURCE, OPEN_READ, GST_ELEMENT_ERROR (src, RESOURCE, OPEN_READ,
("Failed to get buffer in %d ms", src->timeout), (NULL)); ("Failed to get buffer in %d ms", src->timeout), (NULL));
return GST_FLOW_ERROR; return GST_FLOW_ERROR;
} else {
return GST_FLOW_FLUSHING;
}
} }
*buf = gst_buffer_new_wrapped_full ((GstMemoryFlags) *buf = gst_buffer_new_wrapped_full ((GstMemoryFlags)