static gboolean kms_webrtc_session_add_connection (KmsWebrtcSession * self, KmsSdpSession * sess, SdpMediaConfig * mconf, gboolean offerer) { KmsBaseRtpSession *base_rtp_sess = KMS_BASE_RTP_SESSION (sess); gboolean connected, active; KmsIRtpConnection *conn; conn = kms_base_rtp_session_get_connection (base_rtp_sess, mconf); if (conn == NULL) { GST_ERROR_OBJECT (self, "No connection created"); return FALSE; } g_object_get (conn, "added", &connected, NULL); if (connected) { GST_DEBUG_OBJECT (self, "Conn already added"); return TRUE; } active = sdp_utils_media_is_active (kms_sdp_media_config_get_sdp_media (mconf), offerer); kms_i_rtp_connection_add (conn, GST_BIN (self), active); kms_i_rtp_connection_sink_sync_state_with_parent (conn); kms_i_rtp_connection_src_sync_state_with_parent (conn); return TRUE; }
static gboolean kms_base_rtp_session_configure_connection (KmsBaseRtpSession * self, SdpMediaConfig * neg_mconf, SdpMediaConfig * remote_mconf, gboolean offerer) { GstSDPMedia *neg_media = kms_sdp_media_config_get_sdp_media (neg_mconf); const gchar *neg_proto_str = gst_sdp_media_get_proto (neg_media); const gchar *neg_media_str = gst_sdp_media_get_media (neg_media); GstSDPMedia *remote_media = kms_sdp_media_config_get_sdp_media (remote_mconf); const gchar *remote_proto_str = gst_sdp_media_get_proto (remote_media); const gchar *remote_media_str = gst_sdp_media_get_media (remote_media); gboolean active; if (g_strcmp0 (neg_proto_str, remote_proto_str) != 0) { GST_WARNING_OBJECT (self, "Negotiated proto ('%s') not matching with remote proto ('%s')", neg_proto_str, remote_proto_str); return FALSE; } if (!kms_utils_contains_proto (neg_proto_str, "RTP")) { GST_DEBUG_OBJECT (self, "'%s' protocol does not need RTP connection", neg_proto_str); /* It cannot be managed here but could be managed by the child class */ return FALSE; } if (g_strcmp0 (neg_media_str, remote_media_str) != 0) { GST_WARNING_OBJECT (self, "Negotiated media ('%s') not matching with remote media ('%s')", neg_media_str, remote_media_str); return FALSE; } if (kms_base_rtp_session_process_remote_ssrc (self, remote_media, neg_mconf) == NULL) { return TRUE; /* It cannot be managed here but could be managed by the child class */ } active = sdp_utils_media_is_active (neg_media, offerer); return kms_base_rtp_session_add_connection_for_session (self, neg_mconf, active); }