static void
gst_rtsp_client_init (GstRTSPClient * client)
{
+ g_mutex_init (&client->lock);
client->use_client_settings = DEFAULT_USE_CLIENT_SETTINGS;
client->close_response_seq = 0;
}
}
g_free (client->server_ip);
+ g_mutex_clear (&client->lock);
G_OBJECT_CLASS (gst_rtsp_client_parent_class)->finalize (obj);
}
{
GstRTSPSessionPool *old;
+ g_return_if_fail (GST_IS_RTSP_CLIENT (client));
+
+ if (pool)
+ g_object_ref (pool);
+
+ g_mutex_lock (&client->lock);
old = client->session_pool;
- if (old != pool) {
- if (pool)
- g_object_ref (pool);
- client->session_pool = pool;
- if (old)
- g_object_unref (old);
- }
+ client->session_pool = pool;
+ g_mutex_unlock (&client->lock);
+
+ if (old)
+ g_object_unref (old);
}
/**
{
GstRTSPSessionPool *result;
+ g_return_val_if_fail (GST_IS_RTSP_CLIENT (client), NULL);
+
+ g_mutex_lock (&client->lock);
if ((result = client->session_pool))
g_object_ref (result);
+ g_mutex_unlock (&client->lock);
return result;
}
{
GstRTSPServer *old;
+ g_return_if_fail (GST_IS_RTSP_CLIENT (client));
+
+ if (server)
+ g_object_ref (server);
+
+ g_mutex_lock (&client->lock);
old = client->server;
- if (old != server) {
- if (server)
- g_object_ref (server);
- client->server = server;
- if (old)
- g_object_unref (old);
- }
+ client->server = server;
+ g_mutex_unlock (&client->lock);
+
+ if (old)
+ g_object_unref (old);
}
/**
{
GstRTSPServer *result;
+ g_return_val_if_fail (GST_IS_RTSP_CLIENT (client), NULL);
+
+ g_mutex_lock (&client->lock);
if ((result = client->server))
g_object_ref (result);
+ g_mutex_unlock (&client->lock);
return result;
}
{
GstRTSPMountPoints *old;
+ g_return_if_fail (GST_IS_RTSP_CLIENT (client));
+
+ if (mounts)
+ g_object_ref (mounts);
+
+ g_mutex_lock (&client->lock);
old = client->mount_points;
+ client->mount_points = mounts;
+ g_mutex_unlock (&client->lock);
- if (old != mounts) {
- if (mounts)
- g_object_ref (mounts);
- client->mount_points = mounts;
- if (old)
- g_object_unref (old);
- }
+ if (old)
+ g_object_unref (old);
}
/**
{
GstRTSPMountPoints *result;
+ g_return_val_if_fail (GST_IS_RTSP_CLIENT (client), NULL);
+
+ g_mutex_lock (&client->lock);
if ((result = client->mount_points))
g_object_ref (result);
+ g_mutex_unlock (&client->lock);
return result;
}
gst_rtsp_client_set_use_client_settings (GstRTSPClient * client,
gboolean use_client_settings)
{
+ g_return_if_fail (GST_IS_RTSP_CLIENT (client));
+
+ g_mutex_lock (&client->lock);
client->use_client_settings = use_client_settings;
+ g_mutex_unlock (&client->lock);
}
/**
gboolean
gst_rtsp_client_get_use_client_settings (GstRTSPClient * client)
{
- return client->use_client_settings;
+ gboolean res;
+
+ g_return_val_if_fail (GST_IS_RTSP_CLIENT (client), FALSE);
+
+ g_mutex_lock (&client->lock);
+ res = client->use_client_settings;
+ g_mutex_unlock (&client->lock);
+
+ return res;
}
/**
g_return_if_fail (GST_IS_RTSP_CLIENT (client));
+ if (auth)
+ g_object_ref (auth);
+
+ g_mutex_lock (&client->lock);
old = client->auth;
+ client->auth = auth;
+ g_mutex_unlock (&client->lock);
- if (old != auth) {
- if (auth)
- g_object_ref (auth);
- client->auth = auth;
- if (old)
- g_object_unref (old);
- }
+ if (old)
+ g_object_unref (old);
}
g_return_val_if_fail (GST_IS_RTSP_CLIENT (client), NULL);
+ g_mutex_lock (&client->lock);
if ((result = client->auth))
g_object_ref (result);
+ g_mutex_unlock (&client->lock);
return result;
}
GstRTSPConnection *conn;
GstRTSPResult res;
+ g_return_val_if_fail (GST_IS_RTSP_CLIENT (client), FALSE);
+ g_return_val_if_fail (G_IS_SOCKET (socket), FALSE);
+
GST_RTSP_CHECK (gst_rtsp_connection_create_from_socket (socket, ip, port,
initial_buffer, &conn), no_connection);
GstRTSPConnection *conn;
GstRTSPResult res;
+ g_return_val_if_fail (GST_IS_RTSP_CLIENT (client), FALSE);
+ g_return_val_if_fail (G_IS_SOCKET (socket), FALSE);
+
/* a new client connected. */
GST_RTSP_CHECK (gst_rtsp_connection_accept (socket, &conn, cancellable),
accept_failed);