summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDoug Nazar <nazard@nazar.ca>2021-04-29 03:07:42 -0400
committerDoug Nazar <nazard@nazar.ca>2021-04-29 03:07:42 -0400
commit274c8e6b978f71c4fcd7082dbffaf786167394b7 (patch)
tree78e81d15876fff9cdaa9ba8ee6a1c6a946ef8623
parenta8a45b577651d693505e01ea6971deee1d7de78b (diff)
rtsp-media: Ensure the bus watch is removed during unprepare
It's possible for the destruction of the source to be delayed. Instead of relying on the dispose() to remove the bus watch, do it ourselves. Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-rtsp-server/-/merge_requests/202>
-rw-r--r--gst/rtsp-server/rtsp-media.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/gst/rtsp-server/rtsp-media.c b/gst/rtsp-server/rtsp-media.c
index 55d2b31..63f43bc 100644
--- a/gst/rtsp-server/rtsp-media.c
+++ b/gst/rtsp-server/rtsp-media.c
@@ -131,7 +131,6 @@ struct _GstRTSPMediaPrivate
/* the pipeline for the media */
GstElement *pipeline;
GSource *source;
- guint id;
GstRTSPThread *thread;
GList *pending_pipeline_elements;
@@ -3811,7 +3810,7 @@ default_prepare (GstRTSPMedia * media, GstRTSPThread * thread)
g_source_set_callback (priv->source, (GSourceFunc) bus_message,
g_object_ref (media), (GDestroyNotify) watch_destroyed);
- priv->id = g_source_attach (priv->source, context);
+ g_source_attach (priv->source, context);
/* add stuff to the bin */
gst_bin_add (GST_BIN (priv->pipeline), priv->rtpbin);
@@ -4034,9 +4033,17 @@ finish_unprepare (GstRTSPMedia * media)
/* the source has the last ref to the media */
if (priv->source) {
+ GstBus *bus;
+
+ GST_DEBUG ("removing bus watch");
+ bus = gst_pipeline_get_bus (GST_PIPELINE_CAST (priv->pipeline));
+ gst_bus_remove_watch (bus);
+ gst_object_unref (bus);
+
GST_DEBUG ("destroy source");
g_source_destroy (priv->source);
g_source_unref (priv->source);
+ priv->source = NULL;
}
if (priv->thread) {
GST_DEBUG ("stop thread");