rfbsrc: Implement unlock() method

This prevent stalls when we try to stop the source while waiting
for the server to send more updates.
This commit is contained in:
Nicolas Dufresne 2016-03-26 13:36:34 -04:00
parent 89f3f162a5
commit 52b50d0952

View file

@ -76,6 +76,7 @@ static GstCaps *gst_rfb_src_fixate (GstBaseSrc * bsrc, GstCaps * caps);
static gboolean gst_rfb_src_start (GstBaseSrc * bsrc);
static gboolean gst_rfb_src_stop (GstBaseSrc * bsrc);
static gboolean gst_rfb_src_event (GstBaseSrc * bsrc, GstEvent * event);
static gboolean gst_rfb_src_unlock (GstBaseSrc * bsrc);
static GstFlowReturn gst_rfb_src_create (GstPushSrc * psrc,
GstBuffer ** outbuf);
@ -150,6 +151,7 @@ gst_rfb_src_class_init (GstRfbSrcClass * klass)
gstbasesrc_class->start = GST_DEBUG_FUNCPTR (gst_rfb_src_start);
gstbasesrc_class->stop = GST_DEBUG_FUNCPTR (gst_rfb_src_stop);
gstbasesrc_class->event = GST_DEBUG_FUNCPTR (gst_rfb_src_event);
gstbasesrc_class->unlock = GST_DEBUG_FUNCPTR (gst_rfb_src_unlock);
gstpushsrc_class->create = GST_DEBUG_FUNCPTR (gst_rfb_src_create);
gstelement_class = GST_ELEMENT_CLASS (klass);
@ -655,6 +657,14 @@ gst_rfb_src_event (GstBaseSrc * bsrc, GstEvent * event)
return TRUE;
}
static gboolean
gst_rfb_src_unlock (GstBaseSrc * bsrc)
{
GstRfbSrc *src = GST_RFB_SRC (bsrc);
g_cancellable_cancel (src->decoder->cancellable);
return TRUE;
}
static gboolean
plugin_init (GstPlugin * plugin)
{