std::string SdpEndpointImpl::processOffer (const std::string &offer) { GstSDPMessage *offerSdp = NULL, *result = NULL; std::string offerSdpStr; bool expected = false; if (!offerInProcess.compare_exchange_strong (expected, true) ) { //the endpoint is already negotiated throw KurentoException (SDP_END_POINT_ALREADY_NEGOTIATED, "Endpoint already negotiated"); } offerSdp = str_to_sdp (offer); g_signal_emit_by_name (element, "process-offer", offerSdp, &result); gst_sdp_message_free (offerSdp); if (result == NULL) { offerInProcess = false; throw KurentoException (SDP_END_POINT_PROCESS_OFFER_ERROR, "Error processing offer"); } sdp_to_str (offerSdpStr, result); gst_sdp_message_free (result); MediaSessionStarted event (shared_from_this(), MediaSessionStarted::getName() ); signalMediaSessionStarted (event); return offerSdpStr; }
std::string SdpEndpointImpl::generateOffer () { GstSDPMessage *offer = NULL; std::string offerStr; bool expected = false; if (!offerInProcess.compare_exchange_strong (expected, true) ) { //the endpoint is already negotiated throw KurentoException (SDP_END_POINT_ALREADY_NEGOTIATED, "Endpoint already negotiated"); } if (element == NULL) { } g_signal_emit_by_name (element, "generate-offer", &offer); if (offer == NULL) { offerInProcess = false; throw KurentoException (SDP_END_POINT_GENERATE_OFFER_ERROR, "Error generating offer"); } sdp_to_str (offerStr, offer); gst_sdp_message_free (offer); waitingAnswer = true; return offerStr; }
std::string SdpEndpointImpl::getRemoteSessionDescriptor () { GstSDPMessage *remoteSdp = NULL; std::string remoteSdpStr; g_object_get (element, "remote-sdp", &remoteSdp, NULL); if (remoteSdp == NULL) { throw KurentoException (SDP_END_POINT_NO_REMOTE_SDP_ERROR, "No remote SDP"); } sdp_to_str (remoteSdpStr, remoteSdp);; gst_sdp_message_free (remoteSdp); return remoteSdpStr; }
std::string SdpEndpointImpl::getLocalSessionDescriptor () { GstSDPMessage *localSdp = NULL; std::string localSdpStr; g_object_get (element, "local-sdp", &localSdp, NULL); if (localSdp == NULL) { throw KurentoException (SDP_END_POINT_NO_LOCAL_SDP_ERROR, "No local SDP"); } sdp_to_str (localSdpStr, localSdp); gst_sdp_message_free (localSdp); return localSdpStr; }
std::string SdpEndpointImpl::getRemoteSessionDescriptor () { GstSDPMessage *remoteSdp = NULL; std::string remoteSdpStr; g_signal_emit_by_name (element, "get-remote-sdp", sessId.c_str (), &remoteSdp); if (remoteSdp == NULL) { throw KurentoException (SDP_END_POINT_NO_REMOTE_SDP_ERROR, "No remote SDP"); } sdp_to_str (remoteSdpStr, remoteSdp);; gst_sdp_message_free (remoteSdp); return remoteSdpStr; }
std::string SdpEndpointImpl::getLocalSessionDescriptor () { GstSDPMessage *localSdp = NULL; std::string localSdpStr; g_signal_emit_by_name (element, "get-local-sdp", sessId.c_str (), &localSdp); if (localSdp == NULL) { throw KurentoException (SDP_END_POINT_NO_LOCAL_SDP_ERROR, "No local SDP"); } sdp_to_str (localSdpStr, localSdp); gst_sdp_message_free (localSdp); return localSdpStr; }
std::string SdpEndpointImpl::generateOffer () { GstSDPMessage *offer = NULL; std::string offerStr; if (element == NULL) { } g_signal_emit_by_name (element, "generate-offer", &offer); if (offer == NULL) { throw KurentoException (SDP_END_POINT_GENERATE_OFFER_ERROR, "Error generating offer"); } sdp_to_str (offerStr, offer); gst_sdp_message_free (offer); return offerStr; }
std::string SdpEndpointImpl::processOffer (const std::string &offer) { GstSDPMessage *offerSdp = NULL, *result = NULL; std::string offerSdpStr; offerSdp = str_to_sdp (offer); g_signal_emit_by_name (element, "process-offer", offerSdp, &result); gst_sdp_message_free (offerSdp); if (result == NULL) { throw KurentoException (SDP_END_POINT_PROCESS_OFFER_ERROR, "Error processing offer"); } sdp_to_str (offerSdpStr, result); gst_sdp_message_free (result); MediaSessionStarted event (shared_from_this(), MediaSessionStarted::getName() ); signalMediaSessionStarted (event); return offerSdpStr; }