mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-11-26 04:58:49 +03:00
Send ICE candidates gathered after timeout
This commit is contained in:
parent
7377215d28
commit
d508e3abd6
3 changed files with 17 additions and 2 deletions
|
@ -15,6 +15,7 @@
|
||||||
#include "dialogs/AcceptCall.h"
|
#include "dialogs/AcceptCall.h"
|
||||||
|
|
||||||
Q_DECLARE_METATYPE(std::vector<mtx::events::msg::CallCandidates::Candidate>)
|
Q_DECLARE_METATYPE(std::vector<mtx::events::msg::CallCandidates::Candidate>)
|
||||||
|
Q_DECLARE_METATYPE(mtx::events::msg::CallCandidates::Candidate)
|
||||||
Q_DECLARE_METATYPE(mtx::responses::TurnServer)
|
Q_DECLARE_METATYPE(mtx::responses::TurnServer)
|
||||||
|
|
||||||
using namespace mtx::events;
|
using namespace mtx::events;
|
||||||
|
@ -30,11 +31,12 @@ CallManager::CallManager(QSharedPointer<UserSettings> userSettings)
|
||||||
settings_(userSettings)
|
settings_(userSettings)
|
||||||
{
|
{
|
||||||
qRegisterMetaType<std::vector<mtx::events::msg::CallCandidates::Candidate>>();
|
qRegisterMetaType<std::vector<mtx::events::msg::CallCandidates::Candidate>>();
|
||||||
|
qRegisterMetaType<mtx::events::msg::CallCandidates::Candidate>();
|
||||||
qRegisterMetaType<mtx::responses::TurnServer>();
|
qRegisterMetaType<mtx::responses::TurnServer>();
|
||||||
|
|
||||||
connect(&session_, &WebRTCSession::offerCreated, this,
|
connect(&session_, &WebRTCSession::offerCreated, this,
|
||||||
[this](const std::string &sdp,
|
[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());
|
nhlog::ui()->debug("Offer created with callid_ and roomid_: {} {}", callid_, roomid_.toStdString());
|
||||||
emit newMessage(roomid_, CallInvite{callid_, sdp, 0, timeoutms_});
|
emit newMessage(roomid_, CallInvite{callid_, sdp, 0, timeoutms_});
|
||||||
|
@ -43,13 +45,20 @@ CallManager::CallManager(QSharedPointer<UserSettings> userSettings)
|
||||||
|
|
||||||
connect(&session_, &WebRTCSession::answerCreated, this,
|
connect(&session_, &WebRTCSession::answerCreated, this,
|
||||||
[this](const std::string &sdp,
|
[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());
|
nhlog::ui()->debug("Answer created with callid_ and roomid_: {} {}", callid_, roomid_.toStdString());
|
||||||
emit newMessage(roomid_, CallAnswer{callid_, sdp, 0});
|
emit newMessage(roomid_, CallAnswer{callid_, sdp, 0});
|
||||||
emit newMessage(roomid_, CallCandidates{callid_, candidates, 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);
|
connect(&turnServerTimer_, &QTimer::timeout, this, &CallManager::retrieveTurnServer);
|
||||||
turnServerTimer_.start(2000);
|
turnServerTimer_.start(2000);
|
||||||
|
|
||||||
|
|
|
@ -358,6 +358,11 @@ setLocalDescription(GstPromise *promise, gpointer webrtc)
|
||||||
void
|
void
|
||||||
addLocalICECandidate(GstElement *webrtc G_GNUC_UNUSED, guint mlineIndex, gchar *candidate, gpointer G_GNUC_UNUSED)
|
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});
|
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
|
// GStreamer v1.16: webrtcbin's notify::ice-gathering-state triggers GST_WEBRTC_ICE_GATHERING_STATE_COMPLETE too early
|
||||||
|
|
|
@ -46,6 +46,7 @@ public:
|
||||||
signals:
|
signals:
|
||||||
void offerCreated(const std::string &sdp, const std::vector<mtx::events::msg::CallCandidates::Candidate>&);
|
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 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
|
void stateChanged(WebRTCSession::State); // explicit qualifier necessary for Qt
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
|
Loading…
Reference in a new issue