sdp: Add rtcp-fb media attributes based on caps

https://bugzilla.gnome.org/show_bug.cgi?id=769698
This commit is contained in:
Tomasz Zajac 2016-08-10 11:38:58 +02:00 committed by Sebastian Dröge
parent 7a40442ad5
commit 5424357ffa

View file

@ -3467,6 +3467,8 @@ no_rate:
*
* a=fmtp:(payload) (param)[=(value)];...
*
* a=rtcp-fb:(payload) (param1) [param2]...
*
* Returns: a #GstSDPResult.
*
* Since: 1.8
@ -3478,7 +3480,7 @@ gst_sdp_media_set_media_from_caps (const GstCaps * caps, GstSDPMedia * media)
gchar *tmp;
gint caps_pt, caps_rate;
guint n_fields, j;
gboolean first;
gboolean first, nack, nack_pli, ccm_fir;
GString *fmtp;
GstStructure *s;
@ -3516,6 +3518,34 @@ gst_sdp_media_set_media_from_caps (const GstCaps * caps, GstSDPMedia * media)
g_free (tmp);
}
/* get rtcp-fb attributes */
if (gst_structure_get_boolean (s, "rtcp-fb-nack", &nack)) {
if (nack) {
tmp = g_strdup_printf ("%d nack", caps_pt);
gst_sdp_media_add_attribute (media, "rtcp-fb", tmp);
g_free (tmp);
GST_DEBUG ("adding rtcp-fb-nack to pt=%d\n", caps_pt);
}
}
if (gst_structure_get_boolean (s, "rtcp-fb-nack-pli", &nack_pli)) {
if (nack_pli) {
tmp = g_strdup_printf ("%d nack pli", caps_pt);
gst_sdp_media_add_attribute (media, "rtcp-fb", tmp);
g_free (tmp);
GST_DEBUG ("adding rtcp-fb-nack-pli to pt=%d\n", caps_pt);
}
}
if (gst_structure_get_boolean (s, "rtcp-fb-ccm-fir", &ccm_fir)) {
if (ccm_fir) {
tmp = g_strdup_printf ("%d ccm fir", caps_pt);
gst_sdp_media_add_attribute (media, "rtcp-fb", tmp);
g_free (tmp);
GST_DEBUG ("adding rtcp-fb-ccm-fir to pt=%d\n", caps_pt);
}
}
/* collect all other properties and add them to fmtp or attributes */
fmtp = g_string_new ("");
g_string_append_printf (fmtp, "%d ", caps_pt);
@ -3550,6 +3580,8 @@ gst_sdp_media_set_media_from_caps (const GstCaps * caps, GstSDPMedia * media)
/* handled later */
if (g_str_has_prefix (fname, "x-gst-rtsp-server-rtx-time"))
continue;
if (g_str_has_prefix (fname, "rtcp-fb-"))
continue;
if (!strcmp (fname, "a-framesize")) {
/* a-framesize attribute */