diff options
author | Sebastian Dröge <sebastian@centricular.com> | 2015-01-18 19:08:36 +0100 |
---|---|---|
committer | Sebastian Dröge <sebastian@centricular.com> | 2015-01-18 19:08:36 +0100 |
commit | 69e346419a16dbfd0a23a5e5169f606e55c31fa2 (patch) | |
tree | 59336b62af371092749f5b6f6eb289314b0c0086 | |
parent | 634abb9906d4251d3f4efd5e31fd0d1968b1e457 (diff) |
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
-rw-r--r-- | gst/rtsp-server/rtsp-client.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/gst/rtsp-server/rtsp-client.c b/gst/rtsp-server/rtsp-client.c index faff8b1..6fbb5ea 100644 --- a/gst/rtsp-server/rtsp-client.c +++ b/gst/rtsp-server/rtsp-client.c @@ -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"); |