client: add method to configure thread pool

This commit is contained in:
Wim Taymans 2013-07-10 17:06:36 +02:00
parent 27917f4ef3
commit 00997d956f
2 changed files with 63 additions and 1 deletions

View file

@ -49,6 +49,7 @@ struct _GstRTSPClientPrivate
GstRTSPSessionPool *session_pool;
GstRTSPMountPoints *mount_points;
GstRTSPAuth *auth;
GstRTSPThreadPool *thread_pool;
/* used to cache the media in the last requested DESCRIBE so that
* we can pick it up in the next SETUP immediately */
@ -590,7 +591,7 @@ no_prepare:
GST_ERROR ("client %p: can't prepare media", client);
send_generic_response (client, GST_RTSP_STS_SERVICE_UNAVAILABLE, state);
g_object_unref (media);
state->media = media;
state->media = NULL;
g_object_unref (factory);
state->factory = NULL;
return NULL;
@ -2223,6 +2224,63 @@ gst_rtsp_client_get_auth (GstRTSPClient * client)
return result;
}
/**
* gst_rtsp_client_set_thread_pool:
* @client: a #GstRTSPClient
* @pool: a #GstRTSPThreadPool
*
* configure @pool to be used as the thread pool of @client.
*/
void
gst_rtsp_client_set_thread_pool (GstRTSPClient * client,
GstRTSPThreadPool * pool)
{
GstRTSPClientPrivate *priv;
GstRTSPThreadPool *old;
g_return_if_fail (GST_IS_RTSP_CLIENT (client));
priv = client->priv;
if (pool)
g_object_ref (pool);
g_mutex_lock (&priv->lock);
old = priv->thread_pool;
priv->thread_pool = pool;
g_mutex_unlock (&priv->lock);
if (old)
g_object_unref (old);
}
/**
* gst_rtsp_client_get_thread_pool:
* @client: a #GstRTSPClient
*
* Get the #GstRTSPThreadPool used as the thread pool of @client.
*
* Returns: (transfer full): the #GstRTSPThreadPool of @client. g_object_unref() after
* usage.
*/
GstRTSPThreadPool *
gst_rtsp_client_get_thread_pool (GstRTSPClient * client)
{
GstRTSPClientPrivate *priv;
GstRTSPThreadPool *result;
g_return_val_if_fail (GST_IS_RTSP_CLIENT (client), NULL);
priv = client->priv;
g_mutex_lock (&priv->lock);
if ((result = priv->thread_pool))
g_object_ref (result);
g_mutex_unlock (&priv->lock);
return result;
}
/**
* gst_rtsp_client_set_connection:
* @client: a #GstRTSPClient

View file

@ -36,6 +36,7 @@ typedef struct _GstRTSPClientPrivate GstRTSPClientPrivate;
#include "rtsp-session-pool.h"
#include "rtsp-session-media.h"
#include "rtsp-auth.h"
#include "rtsp-thread-pool.h"
#include "rtsp-token.h"
#include "rtsp-sdp.h"
@ -163,6 +164,9 @@ gboolean gst_rtsp_client_get_use_client_settings (GstRTSPClient * c
void gst_rtsp_client_set_auth (GstRTSPClient *client, GstRTSPAuth *auth);
GstRTSPAuth * gst_rtsp_client_get_auth (GstRTSPClient *client);
void gst_rtsp_client_set_thread_pool (GstRTSPClient *client, GstRTSPThreadPool *pool);
GstRTSPThreadPool * gst_rtsp_client_get_thread_pool (GstRTSPClient *client);
gboolean gst_rtsp_client_set_connection (GstRTSPClient *client, GstRTSPConnection *conn);
GstRTSPConnection * gst_rtsp_client_get_connection (GstRTSPClient *client);