webrtcbin recvonly answer to recvonly offer
I'm trying to stream a video from a peer that didn't make the offer.
The sender is a C code that is inspired from the gstwebrtc demo, and the receiver is a js code in a browser using SimplePeer.
The browser is generating this recvonly SDP (as expected): Offer sdp
But the webrtcbin generated answer also have a recvonly SDP (we would expect sendonly) :
Answer sdp
Consequently the program abort with this error :
** ERROR:gstwebrtcbin.c:3369:_connect_rtpfunnel: assertion failed: (stream)
This is probably due to the fact that no stream exists because neither peer create it as both are waiting for the stream.
Here is the code that handles the offer sent by the browser.
// 'sdp' has been retrieved from json sent by the browser
GstWebRTCSessionDescription *offer = gst_webrtc_session_description_new(GST_WEBRTC_SDP_TYPE_OFFER, sdp);
// Set remote description on our pipeline
g_signal_emit_by_name (webrtc1, "set-remote-description", offer, NULL);
// Create answer that we will send back to the peer
GstPromise *promise = gst_promise_new_with_change_func(on_answer_created, NULL, NULL);
g_signal_emit_by_name(webrtc1, "create-answer", NULL, promise);
gst_webrtc_session_description_free(offer);
The code that handle the answer created by webcrtcbin:
static void on_answer_created(GstPromise *promise, gpointer user_data) {
GstWebRTCSessionDescription *answer;
const GstStructure *reply;
reply = gst_promise_get_reply(promise);
gst_structure_get(reply, "answer", GST_TYPE_WEBRTC_SESSION_DESCRIPTION, &answer, NULL);
gst_promise_unref(promise);
// Set local description on our pipeline
g_signal_emit_by_name(webrtc1, "set-local-description", answer, NULL);
send_sdp_to_peer(answer);
gst_webrtc_session_description_free(answer);
}
We only connect the ice candidate signal when creating the pipeline
// pipe1 = gst_parse_launch("...");
webrtc1 = gst_bin_get_by_name (GST_BIN (pipe1), "sendrecv");
g_signal_connect (webrtc1, "on-ice-candidate", G_CALLBACK (send_ice_candidate_message), NULL);
gst_element_set_state (pipe1, GST_STATE_READY);
gst_object_unref (webrtc1);
Does anyone know why the generated answer is RECVONLY whereas the offer is already RECVONLY?
This might be related with #900 (closed).