summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Dröge <sebastian@centricular.com>2015-07-29 11:26:46 +0100
committerSebastian Dröge <sebastian@centricular.com>2015-07-29 14:31:49 +0100
commit39a90710b7a30d9c50bf8a4b261ecaf2158960d2 (patch)
treec236bcaad16b380c6aa7f6184e73cb59bc13a5e5
parenta0182dd943534b5d9844d8426222ce2bdd7830f9 (diff)
rtspsrc: Strip keys from the fmtp that we use internally in our caps
Skip keys from the fmtp, which we already use ourselves for the caps. Some software is adding random things like clock-rate into the fmtp, and we would otherwise here set a string-typed clock-rate in the caps... and thus fail to create valid RTP caps https://bugzilla.gnome.org/show_bug.cgi?id=753009
-rw-r--r--gst/rtsp/gstrtspsrc.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/gst/rtsp/gstrtspsrc.c b/gst/rtsp/gstrtspsrc.c
index 156ea276e..3edb75224 100644
--- a/gst/rtsp/gstrtspsrc.c
+++ b/gst/rtsp/gstrtspsrc.c
@@ -2152,6 +2152,11 @@ gst_rtspsrc_media_to_caps (gint pt, const GstSDPMedia * media)
for (i = 0; pairs[i]; i++) {
gchar *valpos;
const gchar *val, *key;
+ gint j;
+ const gchar *reserved_keys[] =
+ { "media", "payload", "clock-rate", "encoding-name",
+ "encoding-params"
+ };
/* the key may not have a '=', the value can have other '='s */
valpos = strstr (pairs[i], "=");
@@ -2170,6 +2175,19 @@ gst_rtspsrc_media_to_caps (gint pt, const GstSDPMedia * media)
}
/* strip the key of spaces, convert key to lowercase but not the value. */
key = g_strstrip (pairs[i]);
+
+ /* skip keys from the fmtp, which we already use ourselves for the
+ * caps. Some software is adding random things like clock-rate into
+ * the fmtp, and we would otherwise here set a string-typed clock-rate
+ * in the caps... and thus fail to create valid RTP caps
+ */
+ for (j = 0; j < G_N_ELEMENTS (reserved_keys); j++) {
+ if (g_ascii_strcasecmp (reserved_keys[i], key) == 0) {
+ key = "";
+ break;
+ }
+ }
+
if (strlen (key) > 1) {
tmp = g_ascii_strdown (key, -1);
gst_structure_set (s, tmp, G_TYPE_STRING, val, NULL);