diff options
author | Nicolas Dufresne <nicolas.dufresne@collabora.com> | 2014-05-23 17:54:20 -0400 |
---|---|---|
committer | Nicolas Dufresne <nicolas.dufresne@collabora.co.uk> | 2014-05-24 15:38:53 -0400 |
commit | 3acbd9cb99b9cbe4c6f3b23107d22a649e8a0540 (patch) | |
tree | 28dd87d537bd693de4dae7c4095e733fa55961aa /sys | |
parent | a65ab6378d829ced2d2544b81fca6bb41c1291b5 (diff) | |
download | gstreamer-plugins-good-3acbd9cb99b9cbe4c6f3b23107d22a649e8a0540.tar.gz |
v4l2videodec: Handle early task stop
Diffstat (limited to 'sys')
-rw-r--r-- | sys/v4l2/gstv4l2videodec.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/sys/v4l2/gstv4l2videodec.c b/sys/v4l2/gstv4l2videodec.c index 3d793e97e..cc730e1c5 100644 --- a/sys/v4l2/gstv4l2videodec.c +++ b/sys/v4l2/gstv4l2videodec.c @@ -418,6 +418,20 @@ beach: gst_pad_pause_task (decoder->srcpad); } +static void +gst_v4l2_video_dec_loop_stopped (GstV4l2VideoDec * self) +{ + /* When flushing, decoding thread may never run */ + if (g_atomic_int_get (&self->processing)) { + GST_DEBUG_OBJECT (self, "Early stop of decoding thread"); + self->output_flow = GST_FLOW_FLUSHING; + g_atomic_int_set (&self->processing, FALSE); + } + + GST_DEBUG_OBJECT (self, "Decoding task destroyed: %s", + gst_flow_get_name (self->output_flow)); +} + static GstFlowReturn gst_v4l2_video_dec_handle_frame (GstVideoDecoder * decoder, GstVideoCodecFrame * frame) @@ -517,7 +531,8 @@ gst_v4l2_video_dec_handle_frame (GstVideoDecoder * decoder, * processing to unlock input if draining, or prevent potential block */ g_atomic_int_set (&self->processing, TRUE); if (!gst_pad_start_task (decoder->srcpad, - (GstTaskFunction) gst_v4l2_video_dec_loop, self, NULL)) + (GstTaskFunction) gst_v4l2_video_dec_loop, self, + (GDestroyNotify) gst_v4l2_video_dec_loop_stopped)) goto start_task_failed; } |