static int __get_pt_and_encoding_info_from_rtpmap_attribute(const gchar *key, const gchar *value, int *pt, gchar **encoding_info)
{
- RET_VAL_IF(key == NULL, -1, "key is NULL");
+ RET_VAL_IF(g_strcmp0(key, "rtpmap") != 0, -1, "invalid key[%s]", key);
RET_VAL_IF(value == NULL, -1, "value is NULL");
RET_VAL_IF(pt == NULL, -1, "pt is NULL");
RET_VAL_IF(encoding_info == NULL, -1, "encoding_info is NULL");
- RET_VAL_IF(strcmp(key, "rtpmap"), -1, "invalid key[%s]", key);
- RET_VAL_IF(__parse_attribute_value(value, pt, encoding_info), -1, "failed to __parse_attribute_value()");
- return 0;
+ return __parse_attribute_value(value, pt, encoding_info);
+}
+
+static int __get_pt_and_fmt_info_from_fmtp_attribute(const gchar *key, const gchar *value, int *pt, gchar **fmt_info)
+{
+ RET_VAL_IF(g_strcmp0(key, "fmtp") != 0, -1, "invalid key[%s]", key);
+ RET_VAL_IF(value == NULL, -1, "value is NULL");
+ RET_VAL_IF(pt == NULL, -1, "pt is NULL");
+ RET_VAL_IF(fmt_info == NULL, -1, "fmt_info is NULL");
+
+ return __parse_attribute_value(value, pt, fmt_info);
}
static void __update_data_recovery_type_from_remote_description(webrtc_s *webrtc)
RET_IF(msg == NULL, "msg is NULL");
for (i = 0; i < gst_sdp_message_medias_len(msg); i++) {
+ int pt = -1;
+
if (i == MAX_MLINE_NUM) {
LOG_ERROR("reach to max mline num[%u]", i);
break;
}
+
media = gst_sdp_message_get_media(msg, i);
LOG_DEBUG("mline[%u] media[%s, protocol:%s]", i, media->media, media->proto);
memset(&webrtc->data_recovery_types[i], 0, sizeof(webrtc_data_recovery_type_s));
LOG_VERBOSE(" attr[key:%s, value:%s]", attr->key, attr->value);
if (!strcmp(attr->key, "rtpmap")) {
- int pt;
gchar *encoding_info;
if (__get_pt_and_encoding_info_from_rtpmap_attribute(attr->key, attr->value, &pt, &encoding_info) == -1)
}
g_free(encoding_info);
+
+ } else if (!strcmp(attr->key, "fmtp")) {
+ gchar *fmt_info;
+ int current_pt;
+
+ if (__get_pt_and_fmt_info_from_fmtp_attribute(attr->key, attr->value, ¤t_pt, &fmt_info) == -1)
+ continue;
+
+ if ((pt == current_pt) && g_strrstr(fmt_info, "useinbandfec=1")) {
+ webrtc->data_recovery_types[i].inbandfec.pt = current_pt;
+ webrtc->data_recovery_types[i].inbandfec.use = true;
+ LOG_INFO(" inbandfec is set [key:%s, pt:%d, fmt_info:%s]", attr->key, current_pt, fmt_info);
+ }
+
+ g_free(fmt_info);
}
- /* TODO: parsing 'fmtp' */
}
}
}