std::string SdpEndpointImpl::processAnswer (const std::string &answer) { GstSDPMessage *answerSdp; std::string resultStr; bool expected = true; bool expected_false = false; if (!waitingAnswer.compare_exchange_strong (expected, true) ) { //offer not generated throw KurentoException (SDP_END_POINT_NOT_OFFER_GENERATED, "Offer not generated. It is not possible to process an answer."); } if (!answerProcessed.compare_exchange_strong (expected_false, true) ) { //the endpoint is already negotiated throw KurentoException (SDP_END_POINT_ANSWER_ALREADY_PROCCESED, "Sdp Answer already processed"); } answerSdp = str_to_sdp (answer); g_signal_emit_by_name (element, "process-answer", answerSdp, NULL); gst_sdp_message_free (answerSdp); MediaSessionStarted event (shared_from_this(), MediaSessionStarted::getName() ); signalMediaSessionStarted (event); return getLocalSessionDescriptor (); }
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::processAnswer (const std::string &answer) { GstSDPMessage *answerSdp; std::string resultStr; answerSdp = str_to_sdp (answer); g_signal_emit_by_name (element, "process-answer", answerSdp, NULL); gst_sdp_message_free (answerSdp); MediaSessionStarted event (shared_from_this(), MediaSessionStarted::getName() ); signalMediaSessionStarted (event); return getLocalSessionDescriptor (); }
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; }