return text;
}
+static GstSDPMessage* __webrtcbin_get_description(GstElement *webrtcbin, bool is_remote)
+{
+ GstWebRTCSessionDescription *desc;
+ const char *desc_type = is_remote ? "remote-description" : "local-description";
+
+ RET_VAL_IF(webrtcbin == NULL, NULL, "webrtcbin is NULL");
+
+ g_object_get(webrtcbin, desc_type, &desc, NULL);
+ RET_VAL_IF(desc == NULL, NULL, "%s is NULL", desc_type);
+
+ LOG_DEBUG("%s: type[%d], sdp[%p]", desc_type, desc->type, (void*)desc->sdp);
+
+ return desc->sdp;
+}
+
+static void __update_data_recovery_type_from_remote_offer_description(webrtc_s *webrtc)
+{
+ guint i, j;
+ guint attr_length;
+ GstSDPMessage *msg;
+ const GstSDPMedia *media;
+ const GstSDPAttribute *attr;
+
+ RET_IF(webrtc == NULL, "webrtc is NULL");
+
+ msg = __webrtcbin_get_description(webrtc->gst.webrtcbin, true);
+ RET_IF(msg == NULL, "msg is NULL");
+
+ for (i = 0; i < gst_sdp_message_medias_len(msg); i++) {
+ 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));
+
+ attr_length = gst_sdp_media_attributes_len(media);
+ for (j = 0; j < attr_length; j++) {
+ attr = gst_sdp_media_get_attribute(media, j);
+ if (!strcmp(attr->key, "rtpmap")) {
+ if (g_strrstr(attr->value, "red/")) {
+ webrtc->data_recovery_types[i].red = true;
+ LOG_INFO(" RED is set [key:%s, value:%s]", attr->key, attr->value);
+ continue;
+ }
+ if (g_strrstr(attr->value, "ulpfec/")) {
+ webrtc->data_recovery_types[i].ulpfec = true;
+ LOG_INFO(" ULPFEC is set [key:%s, value:%s]", attr->key, attr->value);
+ continue;
+ }
+ }
+ }
+ }
+}
+
static bool __meet_gst_state(webrtc_state_e state, GstState gst_state)
{
if (state == WEBRTC_STATE_IDLE && gst_state == GST_STATE_READY)
LOG_DEBUG("webrtc[%p] [SignalingState] is changed to [%s]", webrtc, __signaling_state_info[state].str);
webrtc->negotiation_states.signaling_state = __signaling_state_info[state].state;
+ if (state == GST_WEBRTC_SIGNALING_STATE_HAVE_REMOTE_OFFER)
+ __update_data_recovery_type_from_remote_offer_description(webrtc);
+
__post_signaling_state_change_cb_in_idle(webrtc, state);
}
RET_IF(transceiver == NULL, "transceiver is NULL");
RET_IF(webrtc == NULL, "webrtc is NULL");
- LOG_INFO("webrtc[%p] new transceiver[%p, mline:%u, mid:%s, direction:%d] user_data[%p]",
- webrtc, transceiver, transceiver->mline, transceiver->mid, transceiver->direction, user_data);
+ LOG_INFO("webrtc[%p] new transceiver[%p, mline:%u, mid:%s, direction:%d, kind:%d] user_data[%p]",
+ webrtc, transceiver, transceiver->mline, transceiver->mid, transceiver->direction, transceiver->kind, user_data);
+ PRINT_CAPS(transceiver->codec_preferences, "codec preferences");
if (g_hash_table_size(webrtc->gst.source_slots) == 0) {
/* In this case, it might be an answerer without setting any media source.