return;
}
- data->connection = gst_rtmp_connection_new (socket_connection);
+ data->connection = gst_rtmp_connection_new (socket_connection,
+ g_task_get_cancellable (task));
data->error_handler_id = g_signal_connect (data->connection,
"error", G_CALLBACK (connection_error), task);
connection_error (GstRtmpConnection * connection, gpointer user_data)
{
GTask *task = user_data;
- g_task_return_new_error (task, G_IO_ERROR, G_IO_ERROR_FAILED,
- "error during connection attempt");
+ if (!g_task_had_error (task))
+ g_task_return_new_error (task, G_IO_ERROR, G_IO_ERROR_FAILED,
+ "error during connection attempt");
}
static gchar *
static void
gst_rtmp_connection_init (GstRtmpConnection * rtmpconnection)
{
- rtmpconnection->cancellable = g_cancellable_new ();
rtmpconnection->output_queue =
g_async_queue_new_full ((GDestroyNotify) gst_buffer_unref);
rtmpconnection->input_streams = gst_rtmp_chunk_streams_new ();
}
GstRtmpConnection *
-gst_rtmp_connection_new (GSocketConnection * connection)
+gst_rtmp_connection_new (GSocketConnection * connection,
+ GCancellable * cancellable)
{
GstRtmpConnection *sc;
sc = g_object_new (GST_TYPE_RTMP_CONNECTION, NULL);
+ if (cancellable)
+ sc->cancellable = g_object_ref (cancellable);
+ else
+ sc->cancellable = g_cancellable_new ();
gst_rtmp_connection_set_socket_connection (sc, connection);
GType gst_rtmp_connection_get_type (void);
-GstRtmpConnection *gst_rtmp_connection_new (GSocketConnection * connection);
+GstRtmpConnection *gst_rtmp_connection_new (GSocketConnection * connection, GCancellable * cancellable);
GSocket *gst_rtmp_connection_get_socket (GstRtmpConnection * connection);