sdp: cleanup sdp info
authorWim Taymans <wim.taymans@collabora.co.uk>
Fri, 14 Jun 2013 14:05:59 +0000 (16:05 +0200)
committerWim Taymans <wim.taymans@collabora.co.uk>
Fri, 14 Jun 2013 14:06:46 +0000 (16:06 +0200)
We don't need to pass the proto, we can more easily check a boolean.

Fixes https://bugzilla.gnome.org/show_bug.cgi?id=702063

gst/rtsp-server/rtsp-client.c
gst/rtsp-server/rtsp-sdp.c
gst/rtsp-server/rtsp-sdp.h

index 6d67ff9..d3d9c69 100644 (file)
@@ -1157,8 +1157,7 @@ make_server_transport (GstRTSPClient * client, GstRTSPClientState * state,
   switch (st->lower_transport) {
     case GST_RTSP_LOWER_TRANS_UDP:
       st->client_port = ct->client_port;
-      gst_rtsp_stream_get_server_port (state->stream, &st->server_port, 
-          family);
+      gst_rtsp_stream_get_server_port (state->stream, &st->server_port, family);
       break;
     case GST_RTSP_LOWER_TRANS_UDP_MCAST:
       st->port = ct->port;
@@ -1415,22 +1414,19 @@ create_sdp (GstRTSPClient * client, GstRTSPMedia * media)
   gst_sdp_message_add_attribute (sdp, "type", "broadcast");
   gst_sdp_message_add_attribute (sdp, "control", "*");
 
-  info.server_proto = proto;
-  info.server_ip = g_strdup (priv->server_ip);
+  info.is_ipv6 = priv->is_ipv6;
+  info.server_ip = priv->server_ip;
 
   /* create an SDP for the media object */
   if (!gst_rtsp_sdp_from_media (sdp, &info, media))
     goto no_sdp;
 
-  g_free (info.server_ip);
-
   return sdp;
 
   /* ERRORS */
 no_sdp:
   {
     GST_ERROR ("client %p: could not create SDP", client);
-    g_free (info.server_ip);
     gst_sdp_message_free (sdp);
     return NULL;
   }
index 22f6e00..399367a 100644 (file)
@@ -131,16 +131,10 @@ gst_rtsp_sdp_from_media (GstSDPMessage * sdp, GstSDPInfo * info,
     gst_sdp_media_set_proto (smedia, "RTP/AVP");
 
     /* for the c= line */
-    if (strcmp (info->server_proto, "IP6") == 0) {
-      gst_sdp_media_add_connection (smedia, "IN", info->server_proto,
-          "::", 16, 0);
+    if (info->is_ipv6) {
+      gst_sdp_media_add_connection (smedia, "IN", "IP6", "::", 16, 0);
     } else {
-      if (strcmp (info->server_proto, "IP4") != 0) {
-        GST_WARNING ("unknown ip version when creating connection line in sdp,"
-            " using IP4");
-      }
-      gst_sdp_media_add_connection (smedia, "IN", info->server_proto,
-          "0.0.0.0", 16, 0);
+      gst_sdp_media_add_connection (smedia, "IN", "IP4", "0.0.0.0", 16, 0);
     }
 
     /* get clock-rate, media type and params for the rtpmap attribute */
index e5f3fd3..7732f36 100644 (file)
@@ -28,8 +28,8 @@
 G_BEGIN_DECLS
 
 typedef struct {
-  const gchar *server_proto;
-  gchar *server_ip;
+  gboolean is_ipv6;
+  const gchar *server_ip;
 } GstSDPInfo;
 
 /* creating SDP */