Fix various problems
This commit is contained in:
@@ -254,7 +254,6 @@ void CallManager::handleHangup(NeoChatRoom *room, const Quotient::CallHangupEven
|
|||||||
if (m_session) {
|
if (m_session) {
|
||||||
m_session->end();
|
m_session->end();
|
||||||
delete m_session;
|
delete m_session;
|
||||||
m_session = nullptr;
|
|
||||||
}
|
}
|
||||||
setGlobalState(IDLE);
|
setGlobalState(IDLE);
|
||||||
Q_EMIT callEnded();
|
Q_EMIT callEnded();
|
||||||
@@ -279,14 +278,14 @@ void CallManager::acceptCall()
|
|||||||
|
|
||||||
m_session = CallSession::acceptCall(m_incomingSdp, m_incomingCandidates, m_cachedTurnUris, m_remoteUser->id(), this);
|
m_session = CallSession::acceptCall(m_incomingSdp, m_incomingCandidates, m_cachedTurnUris, m_remoteUser->id(), this);
|
||||||
m_participants->clear();
|
m_participants->clear();
|
||||||
connect(m_session, &CallSession::stateChanged, this, [this] {
|
connect(m_session.data(), &CallSession::stateChanged, this, [this] {
|
||||||
Q_EMIT stateChanged();
|
Q_EMIT stateChanged();
|
||||||
if (state() == CallSession::ICEFAILED) {
|
if (state() == CallSession::ICEFAILED) {
|
||||||
Q_EMIT callEnded();
|
Q_EMIT callEnded();
|
||||||
}
|
}
|
||||||
}); // TODO refactor away?
|
}); // TODO refactor away?
|
||||||
m_incomingCandidates.clear();
|
m_incomingCandidates.clear();
|
||||||
connectSingleShot(m_session, &CallSession::answerCreated, this, [this](const QString &_sdp, const QVector<Candidate> &candidates) {
|
connectSingleShot(m_session.data(), &CallSession::answerCreated, this, [this](const QString &_sdp, const QVector<Candidate> &candidates) {
|
||||||
const auto &[uuids, sdp] = mangleSdp(_sdp);
|
const auto &[uuids, sdp] = mangleSdp(_sdp);
|
||||||
QVector<std::pair<QString, QString>> msidToPurpose;
|
QVector<std::pair<QString, QString>> msidToPurpose;
|
||||||
for (const auto &uuid : uuids) {
|
for (const auto &uuid : uuids) {
|
||||||
@@ -361,7 +360,7 @@ void CallManager::startCall(NeoChatRoom *room)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto missingPlugins = m_session->missingPlugins();
|
auto missingPlugins = CallSession::missingPlugins();
|
||||||
if (!missingPlugins.isEmpty()) {
|
if (!missingPlugins.isEmpty()) {
|
||||||
qCCritical(voip) << "Missing GStreamer plugins:" << missingPlugins;
|
qCCritical(voip) << "Missing GStreamer plugins:" << missingPlugins;
|
||||||
Q_EMIT Controller::instance().errorOccured("Missing GStreamer plugins.");
|
Q_EMIT Controller::instance().errorOccured("Missing GStreamer plugins.");
|
||||||
@@ -377,6 +376,7 @@ void CallManager::startCall(NeoChatRoom *room)
|
|||||||
setCallId(generateCallId());
|
setCallId(generateCallId());
|
||||||
setPartyId(generatePartyId());
|
setPartyId(generatePartyId());
|
||||||
|
|
||||||
|
m_participants->clear();
|
||||||
for (const auto &user : m_room->users()) {
|
for (const auto &user : m_room->users()) {
|
||||||
auto participant = new CallParticipant(m_session);
|
auto participant = new CallParticipant(m_session);
|
||||||
participant->m_user = dynamic_cast<NeoChatUser *>(user);
|
participant->m_user = dynamic_cast<NeoChatUser *>(user);
|
||||||
@@ -392,7 +392,7 @@ void CallManager::startCall(NeoChatRoom *room)
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
connectSingleShot(m_session, &CallSession::offerCreated, this, [this](const QString &_sdp, const QVector<Candidate> &candidates) {
|
connectSingleShot(m_session.data(), &CallSession::offerCreated, this, [this](const QString &_sdp, const QVector<Candidate> &candidates) {
|
||||||
const auto &[uuids, sdp] = mangleSdp(_sdp);
|
const auto &[uuids, sdp] = mangleSdp(_sdp);
|
||||||
QVector<std::pair<QString, QString>> msidToPurpose;
|
QVector<std::pair<QString, QString>> msidToPurpose;
|
||||||
for (const auto &uuid : uuids) {
|
for (const auto &uuid : uuids) {
|
||||||
|
|||||||
@@ -134,7 +134,7 @@ private:
|
|||||||
bool init();
|
bool init();
|
||||||
|
|
||||||
bool m_initialised = false;
|
bool m_initialised = false;
|
||||||
CallSession *m_session = nullptr;
|
QPointer<CallSession> m_session = nullptr;
|
||||||
|
|
||||||
void setLifetime(int lifetime);
|
void setLifetime(int lifetime);
|
||||||
void setRoom(NeoChatRoom *room);
|
void setRoom(NeoChatRoom *room);
|
||||||
|
|||||||
@@ -247,6 +247,7 @@ void onGetStats(GstPromise *promise, gpointer)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO port to QTimer?
|
||||||
gboolean testPacketLoss(gpointer)
|
gboolean testPacketLoss(gpointer)
|
||||||
{
|
{
|
||||||
if (!keyFrameRequestData.pipe) {
|
if (!keyFrameRequestData.pipe) {
|
||||||
@@ -408,7 +409,6 @@ void iceGatheringStateChanged(GstElement *webrtc, GParamSpec *pspec, gpointer us
|
|||||||
|
|
||||||
GstWebRTCICEGatheringState newState;
|
GstWebRTCICEGatheringState newState;
|
||||||
g_object_get(webrtc, "ice-gathering-state", &newState, nullptr);
|
g_object_get(webrtc, "ice-gathering-state", &newState, nullptr);
|
||||||
qWarning() << "ICEGATHERINSTCHANGED" << newState;
|
|
||||||
if (newState == GST_WEBRTC_ICE_GATHERING_STATE_COMPLETE) {
|
if (newState == GST_WEBRTC_ICE_GATHERING_STATE_COMPLETE) {
|
||||||
qCWarning(voip) << "GstWebRTCICEGatheringState -> Complete";
|
qCWarning(voip) << "GstWebRTCICEGatheringState -> Complete";
|
||||||
if (instance->m_isOffering) {
|
if (instance->m_isOffering) {
|
||||||
@@ -618,10 +618,10 @@ void CallSession::end()
|
|||||||
{
|
{
|
||||||
qCDebug(voip) << "Ending Call";
|
qCDebug(voip) << "Ending Call";
|
||||||
if (m_pipe) {
|
if (m_pipe) {
|
||||||
// TODO: This seems to block forever; I don't see significant problem with not doing it...
|
gst_element_set_state(m_pipe, GST_STATE_NULL);
|
||||||
// gst_element_set_state(m_pipe, GST_STATE_NULL);
|
|
||||||
gst_object_unref(m_pipe);
|
gst_object_unref(m_pipe);
|
||||||
m_pipe = nullptr;
|
m_pipe = nullptr;
|
||||||
|
keyFrameRequestData.pipe = nullptr;
|
||||||
if (m_busWatchId) {
|
if (m_busWatchId) {
|
||||||
g_source_remove(m_busWatchId);
|
g_source_remove(m_busWatchId);
|
||||||
m_busWatchId = 0;
|
m_busWatchId = 0;
|
||||||
@@ -822,7 +822,7 @@ void CallSession::acceptCandidates(const QVector<Candidate> &candidates)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList CallSession::missingPlugins() const
|
QStringList CallSession::missingPlugins()
|
||||||
{
|
{
|
||||||
GstRegistry *registry = gst_registry_get();
|
GstRegistry *registry = gst_registry_get();
|
||||||
static const QVector<QString> videoPlugins = {
|
static const QVector<QString> videoPlugins = {
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ public:
|
|||||||
void renegotiateOffer(const QString &offer, const QString &userId);
|
void renegotiateOffer(const QString &offer, const QString &userId);
|
||||||
void setTurnServers(QStringList servers);
|
void setTurnServers(QStringList servers);
|
||||||
|
|
||||||
QStringList missingPlugins() const;
|
static QStringList missingPlugins();
|
||||||
|
|
||||||
CallSession::State state() const;
|
CallSession::State state() const;
|
||||||
|
|
||||||
|
|||||||
@@ -9,6 +9,8 @@ import org.kde.kirigami 2.15 as Kirigami
|
|||||||
import org.kde.neochat 1.0
|
import org.kde.neochat 1.0
|
||||||
|
|
||||||
TimelineContainer {
|
TimelineContainer {
|
||||||
|
id: root
|
||||||
|
|
||||||
width: ListView.view.width
|
width: ListView.view.width
|
||||||
|
|
||||||
innerObject: QQC2.Control {
|
innerObject: QQC2.Control {
|
||||||
@@ -16,7 +18,7 @@ TimelineContainer {
|
|||||||
padding: Kirigami.Units.gridUnit*2
|
padding: Kirigami.Units.gridUnit*2
|
||||||
|
|
||||||
contentItem: QQC2.Label {
|
contentItem: QQC2.Label {
|
||||||
text: model.author.isLocalUser ? i18n("Outgoing Call") : i18n("Incoming Call")
|
text: root.author.isLocalUser ? i18n("Outgoing Call") : i18n("Incoming Call")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user