sink->used_socket = NULL;
sink->used_socket_v6 = NULL;
- sink->cancellable = g_cancellable_new ();
}
static void
sink = GST_DYNUDPSINK (object);
- if (sink->cancellable)
- g_object_unref (sink->cancellable);
- sink->cancellable = NULL;
-
if (sink->socket)
g_object_unref (sink->socket);
sink->socket = NULL;
}
}
+static void
+gst_dynudpsink_create_cancellable (GstDynUDPSink * sink)
+{
+ GPollFD pollfd;
+
+ sink->cancellable = g_cancellable_new ();
+ sink->made_cancel_fd = g_cancellable_make_pollfd (sink->cancellable, &pollfd);
+}
+
+static void
+gst_dynudpsink_free_cancellable (GstDynUDPSink * sink)
+{
+ if (sink->made_cancel_fd) {
+ g_cancellable_release_fd (sink->cancellable);
+ sink->made_cancel_fd = FALSE;
+ }
+ g_object_unref (sink->cancellable);
+ sink->cancellable = NULL;
+}
+
/* create a socket for sending to remote machine */
static gboolean
gst_dynudpsink_start (GstBaseSink * bsink)
udpsink = GST_DYNUDPSINK (bsink);
+ gst_dynudpsink_create_cancellable (udpsink);
+
udpsink->external_socket = FALSE;
if (udpsink->socket) {
udpsink->used_socket_v6 = NULL;
}
+ gst_dynudpsink_free_cancellable (udpsink);
+
return TRUE;
}
udpsink = GST_DYNUDPSINK (bsink);
- g_object_unref (udpsink->cancellable);
- udpsink->cancellable = g_cancellable_new ();
+ gst_dynudpsink_free_cancellable (udpsink);
+ gst_dynudpsink_create_cancellable (udpsink);
return TRUE;
}