From cc709d06de2607a81513a6b2e2496e183f7fd5e0 Mon Sep 17 00:00:00 2001 From: Nicolas Dufresne Date: Thu, 9 Oct 2014 12:15:05 -0400 Subject: [PATCH] v4l2sink: Implement unlock/unlock_stop This will prevent deadlocks, but will also properly flush the pool and allocator when going to READY state. It should also fix issues reported on mailing list when seeking is performed. https://bugzilla.gnome.org/show_bug.cgi?id=738152 --- sys/v4l2/gstv4l2sink.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/sys/v4l2/gstv4l2sink.c b/sys/v4l2/gstv4l2sink.c index 3327d8a..f6ed3ba 100644 --- a/sys/v4l2/gstv4l2sink.c +++ b/sys/v4l2/gstv4l2sink.c @@ -116,6 +116,8 @@ static GstCaps *gst_v4l2sink_get_caps (GstBaseSink * bsink, GstCaps * filter); static gboolean gst_v4l2sink_set_caps (GstBaseSink * bsink, GstCaps * caps); static GstFlowReturn gst_v4l2sink_show_frame (GstVideoSink * bsink, GstBuffer * buf); +static gboolean gst_v4l2sink_unlock (GstBaseSink * sink); +static gboolean gst_v4l2sink_unlock_stop (GstBaseSink * sink); static void gst_v4l2sink_class_init (GstV4l2SinkClass * klass) @@ -185,6 +187,8 @@ gst_v4l2sink_class_init (GstV4l2SinkClass * klass) basesink_class->set_caps = GST_DEBUG_FUNCPTR (gst_v4l2sink_set_caps); basesink_class->propose_allocation = GST_DEBUG_FUNCPTR (gst_v4l2sink_propose_allocation); + basesink_class->unlock = GST_DEBUG_FUNCPTR (gst_v4l2sink_unlock); + basesink_class->unlock_stop = GST_DEBUG_FUNCPTR (gst_v4l2sink_unlock_stop); videosink_class->show_frame = GST_DEBUG_FUNCPTR (gst_v4l2sink_show_frame); @@ -608,3 +612,17 @@ activate_failed: return GST_FLOW_ERROR; } } + +static gboolean +gst_v4l2sink_unlock (GstBaseSink * sink) +{ + GstV4l2Sink *v4l2sink = GST_V4L2SINK (sink); + return gst_v4l2_object_unlock (v4l2sink->v4l2object); +} + +static gboolean +gst_v4l2sink_unlock_stop (GstBaseSink * sink) +{ + GstV4l2Sink *v4l2sink = GST_V4L2SINK (sink); + return gst_v4l2_object_unlock_stop (v4l2sink->v4l2object); +} -- 2.7.4