diff options
author | David Schleef <ds@schleef.org> | 2013-04-01 19:49:00 -0700 |
---|---|---|
committer | David Schleef <ds@schleef.org> | 2013-04-01 19:54:21 -0700 |
commit | d63458b7defc8d784a4c2bcdb5def8edffe68696 (patch) | |
tree | f9ead7ffdf1cada8cd4271ab93fc7c262d645ab8 | |
parent | 91f508fc14f5cb4aca63bab6609abd29a2dfe0ab (diff) | |
download | gstreamer-plugins-bad-d63458b7defc8d784a4c2bcdb5def8edffe68696.tar.gz |
rtmpsrc: Implement basesrc->unlock()
This fixes ->NULL transition problems if librtmp is stuck in a
recv or send call that never returns.
-rw-r--r-- | ext/rtmp/gstrtmpsrc.c | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/ext/rtmp/gstrtmpsrc.c b/ext/rtmp/gstrtmpsrc.c index e9ab2ebb8..0388a7b33 100644 --- a/ext/rtmp/gstrtmpsrc.c +++ b/ext/rtmp/gstrtmpsrc.c @@ -82,6 +82,7 @@ static void gst_rtmp_src_get_property (GObject * object, guint prop_id, GValue * value, GParamSpec * pspec); static void gst_rtmp_src_finalize (GObject * object); +static gboolean gst_rtmp_src_unlock (GstBaseSrc * src); static gboolean gst_rtmp_src_stop (GstBaseSrc * src); static gboolean gst_rtmp_src_start (GstBaseSrc * src); static gboolean gst_rtmp_src_is_seekable (GstBaseSrc * src); @@ -145,6 +146,7 @@ gst_rtmp_src_class_init (GstRTMPSrcClass * klass) gstbasesrc_class->start = GST_DEBUG_FUNCPTR (gst_rtmp_src_start); gstbasesrc_class->stop = GST_DEBUG_FUNCPTR (gst_rtmp_src_stop); + gstbasesrc_class->unlock = GST_DEBUG_FUNCPTR (gst_rtmp_src_unlock); gstbasesrc_class->is_seekable = GST_DEBUG_FUNCPTR (gst_rtmp_src_is_seekable); gstbasesrc_class->prepare_seek_segment = GST_DEBUG_FUNCPTR (gst_rtmp_src_prepare_seek_segment); @@ -580,6 +582,23 @@ gst_rtmp_src_start (GstBaseSrc * basesrc) #undef STR2AVAL static gboolean +gst_rtmp_src_unlock (GstBaseSrc * basesrc) +{ + GstRTMPSrc *rtmpsrc = GST_RTMP_SRC (basesrc); + + GST_DEBUG_OBJECT (rtmpsrc, "unlock"); + + /* This closes the socket, which means that any pending socket calls + * error out. */ + if (rtmpsrc->rtmp) { + RTMP_Close (rtmpsrc->rtmp); + } + + return TRUE; +} + + +static gboolean gst_rtmp_src_stop (GstBaseSrc * basesrc) { GstRTMPSrc *src; @@ -587,7 +606,6 @@ gst_rtmp_src_stop (GstBaseSrc * basesrc) src = GST_RTMP_SRC (basesrc); if (src->rtmp) { - RTMP_Close (src->rtmp); RTMP_Free (src->rtmp); src->rtmp = NULL; } |