From c6f8220920ca9a4e0fd3f9f6b9af555dda7cec34 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Sun, 14 Jul 2013 18:11:59 +0200 Subject: [PATCH] rtspconnection: Create a new write GSource after removing it After removal, a GSource is destroyed and can never be attached again to a main context. We need to create a new one instead. https://bugzilla.gnome.org/show_bug.cgi?id=704198 --- gst-libs/gst/rtsp/gstrtspconnection.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/gst-libs/gst/rtsp/gstrtspconnection.c b/gst-libs/gst/rtsp/gstrtspconnection.c index 15813bef9e..9041a3305f 100644 --- a/gst-libs/gst/rtsp/gstrtspconnection.c +++ b/gst-libs/gst/rtsp/gstrtspconnection.c @@ -2978,6 +2978,16 @@ gst_rtsp_source_dispatch_write (GPollableOutputStream * stream, if (watch->write_added) { g_source_remove_child_source ((GSource *) watch, watch->writesrc); watch->write_added = FALSE; + + /* Need to create a new source as once removed/destroyed sources + * can't be attached again later */ + g_source_unref (watch->writesrc); + watch->writesrc = + g_pollable_output_stream_create_source (G_POLLABLE_OUTPUT_STREAM + (watch->conn->output_stream), NULL); + g_source_set_callback (watch->writesrc, + (GSourceFunc) gst_rtsp_source_dispatch_write, watch, NULL); + /* we add the write source when we actually have something to write */ } break; }