From d100180ce3838c9705c23ce03e69fa9ba921a5ae Mon Sep 17 00:00:00 2001 From: Justin Kim Date: Wed, 1 Nov 2017 12:44:59 +0900 Subject: [PATCH] sdpmessage: do not append NULL value for session-level attr If an attribute is defined without value, the generated text should be 'a=key' rather than 'a=key:'. For media-level, it has already been done. https://bugzilla.gnome.org/show_bug.cgi?id=789742 --- gst-libs/gst/sdp/gstsdpmessage.c | 2 +- tests/check/libs/sdp.c | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/gst-libs/gst/sdp/gstsdpmessage.c b/gst-libs/gst/sdp/gstsdpmessage.c index a3fb942a0d..65a7f7549b 100644 --- a/gst-libs/gst/sdp/gstsdpmessage.c +++ b/gst-libs/gst/sdp/gstsdpmessage.c @@ -570,7 +570,7 @@ gst_sdp_message_as_text (const GstSDPMessage * msg) if (attr->key) { g_string_append_printf (lines, "a=%s", attr->key); - if (attr->value) + if (attr->value && attr->value[0] != '\0') g_string_append_printf (lines, ":%s", attr->value); g_string_append_printf (lines, "\r\n"); } diff --git a/tests/check/libs/sdp.c b/tests/check/libs/sdp.c index 7da67ead94..b6f1d9ce13 100644 --- a/tests/check/libs/sdp.c +++ b/tests/check/libs/sdp.c @@ -53,6 +53,7 @@ static const gchar *sdp = "v=0\r\n" "s=TestSessionToCopy\r\n" "c=IN IP4 127.0.0.1\r\n" "t=0 0\r\n" + "a=sendrecv\r\n" "m=video 3434 RTP/AVP 96 97 99\r\n" "a=rtpmap:96 MP4V-ES/90000\r\n" "a=rtpmap:97 H263-1998/90000\r\n"