From 0b0a04278172ff5779d078ce34b62daa199f3f8d Mon Sep 17 00:00:00 2001 From: =?utf8?q?Sebastian=20Dr=C3=B6ge?= Date: Wed, 17 Aug 2016 09:49:04 +0300 Subject: [PATCH] rtspsrc: Allow mimetypes with properties as long as they're application/sdp Some servers add properties like charset, e.g. application/sdp; charset=utf8 Ideally we should also parse the charset and do conversion of all messages, but that's for a later time. --- gst/rtsp/gstrtspsrc.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/gst/rtsp/gstrtspsrc.c b/gst/rtsp/gstrtspsrc.c index 58bed88..a080090 100644 --- a/gst/rtsp/gstrtspsrc.c +++ b/gst/rtsp/gstrtspsrc.c @@ -6792,8 +6792,24 @@ restart: /* could not be set but since the request returned OK, we assume it * was SDP, else check it. */ if (respcont) { - if (g_ascii_strcasecmp (respcont, "application/sdp") != 0) + const gchar *props = strchr (respcont, ';'); + + if (props) { + gchar *mimetype = g_strndup (respcont, props - respcont); + + mimetype = g_strstrip (mimetype); + if (g_ascii_strcasecmp (mimetype, "application/sdp") != 0) { + g_free (mimetype); + goto wrong_content_type; + } + + /* TODO: Check for charset property and do conversions of all messages if + * needed. Some servers actually send that property */ + + g_free (mimetype); + } else if (g_ascii_strcasecmp (respcont, "application/sdp") != 0) { goto wrong_content_type; + } } /* get message body and parse as SDP */ -- 2.7.4