mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-28 20:51:13 +00:00
sdp: Parse rtcp-fb media attributes
https://bugzilla.gnome.org/show_bug.cgi?id=769698
This commit is contained in:
parent
5424357ffa
commit
4d4f3c3cc4
1 changed files with 70 additions and 0 deletions
|
@ -3270,6 +3270,73 @@ gst_sdp_parse_rtpmap (const gchar * rtpmap, gint * payload, gchar ** name,
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_sdp_media_add_rtcp_fb_attributes_from_media:
|
||||
* @media: a #GstSDPMedia
|
||||
* @pt: payload type
|
||||
* @caps: a #GstCaps
|
||||
*
|
||||
* Parse given @media for "rtcp-fb" attributes and add it to the @caps.
|
||||
*
|
||||
* Mapping of caps from SDP fields:
|
||||
*
|
||||
* a=rtcp-fb:(payload) (param1) [param2]...
|
||||
*
|
||||
* Returns: a #GstSDPResult.
|
||||
*/
|
||||
static GstSDPResult
|
||||
gst_sdp_media_add_rtcp_fb_attributes_from_media (const GstSDPMedia * media,
|
||||
gint pt, GstCaps * caps)
|
||||
{
|
||||
const gchar *rtcp_fb;
|
||||
gchar *p, *to_free;
|
||||
gint payload, i;
|
||||
GstStructure *s;
|
||||
|
||||
g_return_val_if_fail (media != NULL, GST_SDP_EINVAL);
|
||||
g_return_val_if_fail (caps != NULL && GST_IS_CAPS (caps), GST_SDP_EINVAL);
|
||||
|
||||
s = gst_caps_get_structure (caps, 0);
|
||||
|
||||
for (i = 0;; i++) {
|
||||
gboolean all_formats = FALSE;
|
||||
|
||||
if ((rtcp_fb = gst_sdp_media_get_attribute_val_n (media,
|
||||
"rtcp-fb", i)) == NULL)
|
||||
break;
|
||||
|
||||
/* p is now of the format <payload> attr... */
|
||||
to_free = p = g_strdup (rtcp_fb);
|
||||
|
||||
/* check if it applies to all formats */
|
||||
if (*p == '*') {
|
||||
p++;
|
||||
all_formats = TRUE;
|
||||
} else {
|
||||
PARSE_INT (p, " ", payload);
|
||||
}
|
||||
|
||||
if (all_formats || (payload != -1 && payload == pt)) {
|
||||
gchar *tmp, *key;
|
||||
|
||||
SKIP_SPACES (p);
|
||||
|
||||
/* replace space with '-' */
|
||||
key = g_strdup_printf ("rtcp-fb-%s", p);
|
||||
|
||||
for (tmp = key; (tmp = strchr (tmp, ' ')); ++tmp) {
|
||||
*tmp = '-';
|
||||
}
|
||||
|
||||
gst_structure_set (s, key, G_TYPE_BOOLEAN, TRUE, NULL);
|
||||
GST_DEBUG ("adding caps: %s=TRUE", key);
|
||||
g_free (key);
|
||||
} else
|
||||
g_free (to_free);
|
||||
}
|
||||
return GST_SDP_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_sdp_media_get_caps_from_media:
|
||||
* @media: a #GstSDPMedia
|
||||
|
@ -3439,6 +3506,9 @@ gst_sdp_media_get_caps_from_media (const GstSDPMedia * media, gint pt)
|
|||
}
|
||||
}
|
||||
|
||||
/* parse rtcp-fb: field */
|
||||
gst_sdp_media_add_rtcp_fb_attributes_from_media (media, pt, caps);
|
||||
|
||||
return caps;
|
||||
|
||||
/* ERRORS */
|
||||
|
|
Loading…
Reference in a new issue