summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authortrilene <trilene@runbox.com>2020-07-23 17:58:22 -0400
committertrilene <trilene@runbox.com>2020-07-23 17:58:22 -0400
commitd508e3abd6d306c9e89c1a4d19b7b691acbd88b7 (patch)
treee8c49d296b448d3b6a9a407b0b956c40f503041c /src
parentConfirm logout/quit if active call in progress (diff)
downloadnheko-d508e3abd6d306c9e89c1a4d19b7b691acbd88b7.tar.xz
Send ICE candidates gathered after timeout
Diffstat (limited to 'src')
-rw-r--r--src/CallManager.cpp13
-rw-r--r--src/WebRTCSession.cpp5
-rw-r--r--src/WebRTCSession.h1
3 files changed, 17 insertions, 2 deletions
diff --git a/src/CallManager.cpp b/src/CallManager.cpp

index b5c59e08..37b150b4 100644 --- a/src/CallManager.cpp +++ b/src/CallManager.cpp
@@ -15,6 +15,7 @@ #include "dialogs/AcceptCall.h" Q_DECLARE_METATYPE(std::vector<mtx::events::msg::CallCandidates::Candidate>) +Q_DECLARE_METATYPE(mtx::events::msg::CallCandidates::Candidate) Q_DECLARE_METATYPE(mtx::responses::TurnServer) using namespace mtx::events; @@ -30,11 +31,12 @@ CallManager::CallManager(QSharedPointer<UserSettings> userSettings) settings_(userSettings) { qRegisterMetaType<std::vector<mtx::events::msg::CallCandidates::Candidate>>(); + qRegisterMetaType<mtx::events::msg::CallCandidates::Candidate>(); qRegisterMetaType<mtx::responses::TurnServer>(); connect(&session_, &WebRTCSession::offerCreated, this, [this](const std::string &sdp, - const std::vector<mtx::events::msg::CallCandidates::Candidate>& candidates) + const std::vector<CallCandidates::Candidate> &candidates) { nhlog::ui()->debug("Offer created with callid_ and roomid_: {} {}", callid_, roomid_.toStdString()); emit newMessage(roomid_, CallInvite{callid_, sdp, 0, timeoutms_}); @@ -43,13 +45,20 @@ CallManager::CallManager(QSharedPointer<UserSettings> userSettings) connect(&session_, &WebRTCSession::answerCreated, this, [this](const std::string &sdp, - const std::vector<mtx::events::msg::CallCandidates::Candidate>& candidates) + const std::vector<CallCandidates::Candidate> &candidates) { nhlog::ui()->debug("Answer created with callid_ and roomid_: {} {}", callid_, roomid_.toStdString()); emit newMessage(roomid_, CallAnswer{callid_, sdp, 0}); emit newMessage(roomid_, CallCandidates{callid_, candidates, 0}); }); + connect(&session_, &WebRTCSession::newICECandidate, this, + [this](const CallCandidates::Candidate &candidate) + { + nhlog::ui()->debug("New ICE candidate created with callid_ and roomid_: {} {}", callid_, roomid_.toStdString()); + emit newMessage(roomid_, CallCandidates{callid_, {candidate}, 0}); + }); + connect(&turnServerTimer_, &QTimer::timeout, this, &CallManager::retrieveTurnServer); turnServerTimer_.start(2000); diff --git a/src/WebRTCSession.cpp b/src/WebRTCSession.cpp
index 5baed72e..c3f5341a 100644 --- a/src/WebRTCSession.cpp +++ b/src/WebRTCSession.cpp
@@ -358,6 +358,11 @@ setLocalDescription(GstPromise *promise, gpointer webrtc) void addLocalICECandidate(GstElement *webrtc G_GNUC_UNUSED, guint mlineIndex, gchar *candidate, gpointer G_GNUC_UNUSED) { + if (WebRTCSession::instance().state() == WebRTCSession::State::CONNECTED) { + emit WebRTCSession::instance().newICECandidate({"audio", (uint16_t)mlineIndex, candidate}); + return; + } + gcandidates.push_back({"audio", (uint16_t)mlineIndex, candidate}); // GStreamer v1.16: webrtcbin's notify::ice-gathering-state triggers GST_WEBRTC_ICE_GATHERING_STATE_COMPLETE too early diff --git a/src/WebRTCSession.h b/src/WebRTCSession.h
index 42db204d..f9882089 100644 --- a/src/WebRTCSession.h +++ b/src/WebRTCSession.h
@@ -46,6 +46,7 @@ public: signals: void offerCreated(const std::string &sdp, const std::vector<mtx::events::msg::CallCandidates::Candidate>&); void answerCreated(const std::string &sdp, const std::vector<mtx::events::msg::CallCandidates::Candidate>&); + void newICECandidate(const mtx::events::msg::CallCandidates::Candidate&); void stateChanged(WebRTCSession::State); // explicit qualifier necessary for Qt private slots: