mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-04-26 04:36:20 +00:00
rtspconnection: Add API to disable session ID caching in the connection
This is necessary to allow having more than one session in the same connection. API: gst_rtsp_connection_set_remember_session_id() API: gst_rtsp_connection_get_remember_session_id()
This commit is contained in:
parent
cd1f9ec992
commit
aef8de337c
2 changed files with 46 additions and 2 deletions
|
@ -126,6 +126,8 @@ struct _GstRTSPConnection
|
||||||
gchar *initial_buffer;
|
gchar *initial_buffer;
|
||||||
gsize initial_buffer_offset;
|
gsize initial_buffer_offset;
|
||||||
|
|
||||||
|
gboolean remember_session_id; /* remember the session id or not */
|
||||||
|
|
||||||
/* Session state */
|
/* Session state */
|
||||||
gint cseq; /* sequence number */
|
gint cseq; /* sequence number */
|
||||||
gchar session_id[512]; /* session id */
|
gchar session_id[512]; /* session id */
|
||||||
|
@ -211,6 +213,8 @@ gst_rtsp_connection_create (const GstRTSPUrl * url, GstRTSPConnection ** conn)
|
||||||
newconn->timeout = 60;
|
newconn->timeout = 60;
|
||||||
newconn->cseq = 1;
|
newconn->cseq = 1;
|
||||||
|
|
||||||
|
newconn->remember_session_id = TRUE;
|
||||||
|
|
||||||
newconn->auth_method = GST_RTSP_AUTH_NONE;
|
newconn->auth_method = GST_RTSP_AUTH_NONE;
|
||||||
newconn->username = NULL;
|
newconn->username = NULL;
|
||||||
newconn->passwd = NULL;
|
newconn->passwd = NULL;
|
||||||
|
@ -1864,8 +1868,10 @@ build_next (GstRTSPBuilder * builder, GstRTSPMessage * message,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* make sure to not overflow */
|
/* make sure to not overflow */
|
||||||
strncpy (conn->session_id, session_id, maxlen);
|
if (conn->remember_session_id) {
|
||||||
conn->session_id[maxlen] = '\0';
|
strncpy (conn->session_id, session_id, maxlen);
|
||||||
|
conn->session_id[maxlen] = '\0';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
res = builder->status;
|
res = builder->status;
|
||||||
goto done;
|
goto done;
|
||||||
|
@ -2844,6 +2850,41 @@ gst_rtsp_connection_do_tunnel (GstRTSPConnection * conn,
|
||||||
return GST_RTSP_OK;
|
return GST_RTSP_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* gst_rtsp_connection_set_remember_session_id:
|
||||||
|
* @conn: a #GstRTSPConnection
|
||||||
|
* @remember: %TRUE if the connection should remember the session id
|
||||||
|
*
|
||||||
|
* Sets if the #GstRTSPConnection should remember the session id from the last
|
||||||
|
* response received and force it onto any further requests.
|
||||||
|
*
|
||||||
|
* The default value is %TRUE
|
||||||
|
*/
|
||||||
|
|
||||||
|
void
|
||||||
|
gst_rtsp_connection_set_remember_session_id (GstRTSPConnection * conn,
|
||||||
|
gboolean remember)
|
||||||
|
{
|
||||||
|
conn->remember_session_id = remember;
|
||||||
|
if (!remember)
|
||||||
|
conn->session_id[0] = '\0';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* gst_rtsp_connection_get_remember_session_id:
|
||||||
|
* @conn: a #GstRTSPConnection
|
||||||
|
*
|
||||||
|
* Returns: %TRUE if the #GstRTSPConnection remembers the session id in the
|
||||||
|
* last response to set it on any further request.
|
||||||
|
*/
|
||||||
|
|
||||||
|
gboolean
|
||||||
|
gst_rtsp_connection_get_remember_session_id (GstRTSPConnection * conn)
|
||||||
|
{
|
||||||
|
return conn->remember_session_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#define READ_ERR (G_IO_HUP | G_IO_ERR | G_IO_NVAL)
|
#define READ_ERR (G_IO_HUP | G_IO_ERR | G_IO_NVAL)
|
||||||
#define READ_COND (G_IO_IN | READ_ERR)
|
#define READ_COND (G_IO_IN | READ_ERR)
|
||||||
#define WRITE_ERR (G_IO_HUP | G_IO_ERR | G_IO_NVAL)
|
#define WRITE_ERR (G_IO_HUP | G_IO_ERR | G_IO_NVAL)
|
||||||
|
|
|
@ -131,6 +131,9 @@ gboolean gst_rtsp_connection_is_tunneled (const GstRTSPConnection *
|
||||||
const gchar * gst_rtsp_connection_get_tunnelid (const GstRTSPConnection *conn);
|
const gchar * gst_rtsp_connection_get_tunnelid (const GstRTSPConnection *conn);
|
||||||
GstRTSPResult gst_rtsp_connection_do_tunnel (GstRTSPConnection *conn, GstRTSPConnection *conn2);
|
GstRTSPResult gst_rtsp_connection_do_tunnel (GstRTSPConnection *conn, GstRTSPConnection *conn2);
|
||||||
|
|
||||||
|
void gst_rtsp_connection_set_remember_session_id (GstRTSPConnection *conn, gboolean remember);
|
||||||
|
gboolean gst_rtsp_connection_get_remember_session_id (GstRTSPConnection *conn);
|
||||||
|
|
||||||
/* async IO */
|
/* async IO */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue