rtsp-client: Use a random session ID in the SDP

RFC4566 Section 5.2 says that it should make the username, session id,
nettype, addrtype and unicast address tuple globally unique. Always using
1188340656180883 is not going to guarantee that: https://xkcd.com/221/

Instead let's create a 64 bit random number, which at least brings us
closer to the goal of global uniqueness.

https://tools.ietf.org/html/rfc4566#section-5.2
This commit is contained in:
Sebastian Dröge 2015-01-18 19:08:36 +01:00
parent 634abb9906
commit 69e346419a

View file

@ -2008,6 +2008,8 @@ create_sdp (GstRTSPClient * client, GstRTSPMedia * media)
GstSDPMessage *sdp;
GstSDPInfo info;
const gchar *proto;
guint64 session_id_tmp;
gchar session_id[21];
gst_sdp_message_new (&sdp);
@ -2019,7 +2021,11 @@ create_sdp (GstRTSPClient * client, GstRTSPMedia * media)
else
proto = "IP4";
gst_sdp_message_set_origin (sdp, "-", "1188340656180883", "1", "IN", proto,
session_id_tmp = (((guint64) g_random_int ()) << 32) | g_random_int ();
g_snprintf (session_id, sizeof (session_id), "%" G_GUINT64_FORMAT,
session_id_tmp);
gst_sdp_message_set_origin (sdp, "-", session_id, "1", "IN", proto,
priv->server_ip);
gst_sdp_message_set_session_name (sdp, "Session streamed with GStreamer");