From bb9478be40b450629f165d5d3566f4e4a3ee1b66 Mon Sep 17 00:00:00 2001 From: Athanasios Oikonomou Date: Tue, 28 Oct 2014 08:48:20 +0200 Subject: [PATCH] rtmp: fix seeking and potential segfault Segfault info: https://bugzilla.gnome.org/show_bug.cgi?id=739263 Seeking info: http://forums.openpli.org/topic/32910-mediaplayer-seek-doesnt-work-with-rtmp-streams/ diff --git a/ext/rtmp/gstrtmpsrc.c b/ext/rtmp/gstrtmpsrc.c index b9ecfcf..8b4bf22 100644 --- a/ext/rtmp/gstrtmpsrc.c +++ b/ext/rtmp/gstrtmpsrc.c @@ -89,7 +89,6 @@ static void gst_rtmp_src_finalize (GObject * object); static gboolean gst_rtmp_src_connect (GstRTMPSrc * src); -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); @@ -137,7 +136,6 @@ 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); @@ -603,23 +601,6 @@ 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; @@ -627,6 +608,7 @@ 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; } -- 1.7.10.4