sdp: cleanup sdp info

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
This commit is contained in:
Wim Taymans 2013-06-14 16:05:59 +02:00
parent f9f994e33d
commit 3dbe0e17d4
3 changed files with 8 additions and 18 deletions

View file

@ -1157,8 +1157,7 @@ make_server_transport (GstRTSPClient * client, GstRTSPClientState * state,
switch (st->lower_transport) { switch (st->lower_transport) {
case GST_RTSP_LOWER_TRANS_UDP: case GST_RTSP_LOWER_TRANS_UDP:
st->client_port = ct->client_port; st->client_port = ct->client_port;
gst_rtsp_stream_get_server_port (state->stream, &st->server_port, gst_rtsp_stream_get_server_port (state->stream, &st->server_port, family);
family);
break; break;
case GST_RTSP_LOWER_TRANS_UDP_MCAST: case GST_RTSP_LOWER_TRANS_UDP_MCAST:
st->port = ct->port; 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, "type", "broadcast");
gst_sdp_message_add_attribute (sdp, "control", "*"); gst_sdp_message_add_attribute (sdp, "control", "*");
info.server_proto = proto; info.is_ipv6 = priv->is_ipv6;
info.server_ip = g_strdup (priv->server_ip); info.server_ip = priv->server_ip;
/* create an SDP for the media object */ /* create an SDP for the media object */
if (!gst_rtsp_sdp_from_media (sdp, &info, media)) if (!gst_rtsp_sdp_from_media (sdp, &info, media))
goto no_sdp; goto no_sdp;
g_free (info.server_ip);
return sdp; return sdp;
/* ERRORS */ /* ERRORS */
no_sdp: no_sdp:
{ {
GST_ERROR ("client %p: could not create SDP", client); GST_ERROR ("client %p: could not create SDP", client);
g_free (info.server_ip);
gst_sdp_message_free (sdp); gst_sdp_message_free (sdp);
return NULL; return NULL;
} }

View file

@ -131,16 +131,10 @@ gst_rtsp_sdp_from_media (GstSDPMessage * sdp, GstSDPInfo * info,
gst_sdp_media_set_proto (smedia, "RTP/AVP"); gst_sdp_media_set_proto (smedia, "RTP/AVP");
/* for the c= line */ /* for the c= line */
if (strcmp (info->server_proto, "IP6") == 0) { if (info->is_ipv6) {
gst_sdp_media_add_connection (smedia, "IN", info->server_proto, gst_sdp_media_add_connection (smedia, "IN", "IP6", "::", 16, 0);
"::", 16, 0);
} else { } else {
if (strcmp (info->server_proto, "IP4") != 0) { gst_sdp_media_add_connection (smedia, "IN", "IP4", "0.0.0.0", 16, 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);
} }
/* get clock-rate, media type and params for the rtpmap attribute */ /* get clock-rate, media type and params for the rtpmap attribute */

View file

@ -28,8 +28,8 @@
G_BEGIN_DECLS G_BEGIN_DECLS
typedef struct { typedef struct {
const gchar *server_proto; gboolean is_ipv6;
gchar *server_ip; const gchar *server_ip;
} GstSDPInfo; } GstSDPInfo;
/* creating SDP */ /* creating SDP */