mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-13 12:51:16 +00:00
Update to new promise API
This commit is contained in:
parent
0c5e799952
commit
e5c5767298
2 changed files with 18 additions and 14 deletions
|
@ -252,11 +252,13 @@ on_offer_created (GstPromise * promise, const gchar * peer_id)
|
||||||
{
|
{
|
||||||
GstElement *webrtc;
|
GstElement *webrtc;
|
||||||
GstWebRTCSessionDescription *offer;
|
GstWebRTCSessionDescription *offer;
|
||||||
|
const GstStructure *reply;
|
||||||
|
|
||||||
g_assert_cmpint (app_state, ==, ROOM_CALL_OFFERING);
|
g_assert_cmpint (app_state, ==, ROOM_CALL_OFFERING);
|
||||||
|
|
||||||
g_assert_cmpint (promise->result, ==, GST_PROMISE_RESULT_REPLIED);
|
g_assert_cmpint (gst_promise_wait (promise), ==, GST_PROMISE_RESULT_REPLIED);
|
||||||
gst_structure_get (promise->promise, "offer",
|
reply = gst_promise_get_reply (promise);
|
||||||
|
gst_structure_get (reply, "offer",
|
||||||
GST_TYPE_WEBRTC_SESSION_DESCRIPTION, &offer, NULL);
|
GST_TYPE_WEBRTC_SESSION_DESCRIPTION, &offer, NULL);
|
||||||
gst_promise_unref (promise);
|
gst_promise_unref (promise);
|
||||||
|
|
||||||
|
@ -275,12 +277,12 @@ on_offer_created (GstPromise * promise, const gchar * peer_id)
|
||||||
static void
|
static void
|
||||||
on_negotiation_needed (GstElement * webrtc, const gchar * peer_id)
|
on_negotiation_needed (GstElement * webrtc, const gchar * peer_id)
|
||||||
{
|
{
|
||||||
GstPromise *promise = gst_promise_new ();
|
GstPromise *promise;
|
||||||
|
|
||||||
app_state = ROOM_CALL_OFFERING;
|
app_state = ROOM_CALL_OFFERING;
|
||||||
g_signal_emit_by_name (webrtc, "create-offer", NULL, promise);
|
promise = gst_promise_new_with_change_func (
|
||||||
gst_promise_set_change_callback (promise,
|
|
||||||
(GstPromiseChangeFunc) on_offer_created, (gpointer) peer_id, NULL);
|
(GstPromiseChangeFunc) on_offer_created, (gpointer) peer_id, NULL);
|
||||||
|
g_signal_emit_by_name (webrtc, "create-offer", NULL, promise);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -576,11 +578,13 @@ on_answer_created (GstPromise * promise, const gchar * peer_id)
|
||||||
{
|
{
|
||||||
GstElement *webrtc;
|
GstElement *webrtc;
|
||||||
GstWebRTCSessionDescription *answer;
|
GstWebRTCSessionDescription *answer;
|
||||||
|
const GstStructure *reply;
|
||||||
|
|
||||||
g_assert_cmpint (app_state, ==, ROOM_CALL_ANSWERING);
|
g_assert_cmpint (app_state, ==, ROOM_CALL_ANSWERING);
|
||||||
|
|
||||||
g_assert_cmpint (promise->result, ==, GST_PROMISE_RESULT_REPLIED);
|
g_assert_cmpint (gst_promise_wait (promise), ==, GST_PROMISE_RESULT_REPLIED);
|
||||||
gst_structure_get (promise->promise, "answer",
|
reply = gst_promise_get_reply (promise);
|
||||||
|
gst_structure_get (reply, "answer",
|
||||||
GST_TYPE_WEBRTC_SESSION_DESCRIPTION, &answer, NULL);
|
GST_TYPE_WEBRTC_SESSION_DESCRIPTION, &answer, NULL);
|
||||||
gst_promise_unref (promise);
|
gst_promise_unref (promise);
|
||||||
|
|
||||||
|
@ -630,8 +634,7 @@ handle_sdp_offer (const gchar * peer_id, const gchar * text)
|
||||||
gst_promise_unref (promise);
|
gst_promise_unref (promise);
|
||||||
|
|
||||||
/* Create an answer that we will send back to the peer */
|
/* Create an answer that we will send back to the peer */
|
||||||
promise = gst_promise_new ();
|
promise = gst_promise_new_with_change_func (
|
||||||
gst_promise_set_change_callback (promise,
|
|
||||||
(GstPromiseChangeFunc) on_answer_created, (gpointer) peer_id, NULL);
|
(GstPromiseChangeFunc) on_answer_created, (gpointer) peer_id, NULL);
|
||||||
g_signal_emit_by_name (webrtc, "create-answer", NULL, promise);
|
g_signal_emit_by_name (webrtc, "create-answer", NULL, promise);
|
||||||
|
|
||||||
|
|
|
@ -219,12 +219,14 @@ static void
|
||||||
on_offer_created (GstPromise * promise, gpointer user_data)
|
on_offer_created (GstPromise * promise, gpointer user_data)
|
||||||
{
|
{
|
||||||
GstWebRTCSessionDescription *offer = NULL;
|
GstWebRTCSessionDescription *offer = NULL;
|
||||||
|
const GstStructure *reply;
|
||||||
gchar *desc;
|
gchar *desc;
|
||||||
|
|
||||||
g_assert (app_state == PEER_CALL_NEGOTIATING);
|
g_assert (app_state == PEER_CALL_NEGOTIATING);
|
||||||
|
|
||||||
g_assert (promise->result == GST_PROMISE_RESULT_REPLIED);
|
g_assert (gst_promise_wait(promise) == GST_PROMISE_RESULT_REPLIED);
|
||||||
gst_structure_get (promise->promise, "offer",
|
reply = gst_promise_get_reply (promise);
|
||||||
|
gst_structure_get (reply, "offer",
|
||||||
GST_TYPE_WEBRTC_SESSION_DESCRIPTION, &offer, NULL);
|
GST_TYPE_WEBRTC_SESSION_DESCRIPTION, &offer, NULL);
|
||||||
gst_promise_unref (promise);
|
gst_promise_unref (promise);
|
||||||
|
|
||||||
|
@ -241,12 +243,11 @@ on_offer_created (GstPromise * promise, gpointer user_data)
|
||||||
static void
|
static void
|
||||||
on_negotiation_needed (GstElement * element, gpointer user_data)
|
on_negotiation_needed (GstElement * element, gpointer user_data)
|
||||||
{
|
{
|
||||||
GstPromise *promise = gst_promise_new ();
|
GstPromise *promise;
|
||||||
|
|
||||||
app_state = PEER_CALL_NEGOTIATING;
|
app_state = PEER_CALL_NEGOTIATING;
|
||||||
|
promise = gst_promise_new_with_change_func (on_offer_created, user_data, NULL);;
|
||||||
g_signal_emit_by_name (webrtc1, "create-offer", NULL, promise);
|
g_signal_emit_by_name (webrtc1, "create-offer", NULL, promise);
|
||||||
gst_promise_set_change_callback (promise, on_offer_created, user_data,
|
|
||||||
NULL);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#define RTP_CAPS_OPUS "application/x-rtp,media=audio,encoding-name=OPUS,payload="
|
#define RTP_CAPS_OPUS "application/x-rtp,media=audio,encoding-name=OPUS,payload="
|
||||||
|
|
Loading…
Reference in a new issue