From d508e3abd6d306c9e89c1a4d19b7b691acbd88b7 Mon Sep 17 00:00:00 2001 From: trilene Date: Thu, 23 Jul 2020 17:58:22 -0400 Subject: Send ICE candidates gathered after timeout --- src/CallManager.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'src/CallManager.cpp') 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) +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) settings_(userSettings) { qRegisterMetaType>(); + qRegisterMetaType(); qRegisterMetaType(); connect(&session_, &WebRTCSession::offerCreated, this, [this](const std::string &sdp, - const std::vector& candidates) + const std::vector &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) connect(&session_, &WebRTCSession::answerCreated, this, [this](const std::string &sdp, - const std::vector& candidates) + const std::vector &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); -- cgit 1.5.1