mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-25 17:50:36 +00:00
client: add state to current thread
Add the client to the ClientState object. Place the ClientState on the current thread.
This commit is contained in:
parent
0499a1ec7d
commit
c9d6455ad3
2 changed files with 24 additions and 0 deletions
|
@ -1780,6 +1780,22 @@ client_session_finalized (GstRTSPClient * client, GstRTSPSession * session)
|
|||
}
|
||||
}
|
||||
|
||||
static GPrivate state_key;
|
||||
|
||||
/**
|
||||
* gst_rtsp_client_state_get_current:
|
||||
*
|
||||
* Get the current #GstRTSPClientState. This object is retrieved from the
|
||||
* current thread that is handling the request for a client.
|
||||
*
|
||||
* Returns: a #GstRTSPClientState
|
||||
*/
|
||||
GstRTSPClientState *
|
||||
gst_rtsp_client_state_get_current (void)
|
||||
{
|
||||
return g_private_get (&state_key);
|
||||
}
|
||||
|
||||
static void
|
||||
handle_request (GstRTSPClient * client, GstRTSPMessage * request)
|
||||
{
|
||||
|
@ -1794,8 +1810,11 @@ handle_request (GstRTSPClient * client, GstRTSPMessage * request)
|
|||
GstRTSPMessage response = { 0 };
|
||||
gchar *sessid;
|
||||
|
||||
state.client = client;
|
||||
state.request = request;
|
||||
state.response = &response;
|
||||
state.auth = priv->auth;
|
||||
g_private_set (&state_key, &state);
|
||||
|
||||
if (gst_debug_category_get_threshold (rtsp_client_debug) >= GST_LEVEL_LOG) {
|
||||
gst_rtsp_message_dump (request);
|
||||
|
@ -1883,6 +1902,7 @@ handle_request (GstRTSPClient * client, GstRTSPMessage * request)
|
|||
}
|
||||
|
||||
done:
|
||||
g_private_set (&state_key, NULL);
|
||||
if (session)
|
||||
g_object_unref (session);
|
||||
if (uri)
|
||||
|
|
|
@ -49,6 +49,7 @@ typedef struct _GstRTSPClientPrivate GstRTSPClientPrivate;
|
|||
|
||||
/**
|
||||
* GstRTSPClientState:
|
||||
* @client: the client
|
||||
* @request: the complete request
|
||||
* @uri: the complete url parsed from @request
|
||||
* @method: the parsed method of @uri
|
||||
|
@ -64,6 +65,7 @@ typedef struct _GstRTSPClientPrivate GstRTSPClientPrivate;
|
|||
* Information passed around containing the client state of a request.
|
||||
*/
|
||||
struct _GstRTSPClientState {
|
||||
GstRTSPClient *client;
|
||||
GstRTSPMessage *request;
|
||||
GstRTSPUrl *uri;
|
||||
GstRTSPMethod method;
|
||||
|
@ -77,6 +79,8 @@ struct _GstRTSPClientState {
|
|||
GstRTSPMessage *response;
|
||||
};
|
||||
|
||||
GstRTSPClientState * gst_rtsp_client_state_get_current (void);
|
||||
|
||||
/**
|
||||
* GstRTSPClientSendFunc:
|
||||
* @client: a #GstRTSPClient
|
||||
|
|
Loading…
Reference in a new issue