Fix various problems
This commit is contained in:
@@ -254,7 +254,6 @@ void CallManager::handleHangup(NeoChatRoom *room, const Quotient::CallHangupEven
|
||||
if (m_session) {
|
||||
m_session->end();
|
||||
delete m_session;
|
||||
m_session = nullptr;
|
||||
}
|
||||
setGlobalState(IDLE);
|
||||
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_participants->clear();
|
||||
connect(m_session, &CallSession::stateChanged, this, [this] {
|
||||
connect(m_session.data(), &CallSession::stateChanged, this, [this] {
|
||||
Q_EMIT stateChanged();
|
||||
if (state() == CallSession::ICEFAILED) {
|
||||
Q_EMIT callEnded();
|
||||
}
|
||||
}); // TODO refactor away?
|
||||
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);
|
||||
QVector<std::pair<QString, QString>> msidToPurpose;
|
||||
for (const auto &uuid : uuids) {
|
||||
@@ -361,7 +360,7 @@ void CallManager::startCall(NeoChatRoom *room)
|
||||
return;
|
||||
}
|
||||
|
||||
auto missingPlugins = m_session->missingPlugins();
|
||||
auto missingPlugins = CallSession::missingPlugins();
|
||||
if (!missingPlugins.isEmpty()) {
|
||||
qCCritical(voip) << "Missing GStreamer plugins:" << missingPlugins;
|
||||
Q_EMIT Controller::instance().errorOccured("Missing GStreamer plugins.");
|
||||
@@ -377,6 +376,7 @@ void CallManager::startCall(NeoChatRoom *room)
|
||||
setCallId(generateCallId());
|
||||
setPartyId(generatePartyId());
|
||||
|
||||
m_participants->clear();
|
||||
for (const auto &user : m_room->users()) {
|
||||
auto participant = new CallParticipant(m_session);
|
||||
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);
|
||||
QVector<std::pair<QString, QString>> msidToPurpose;
|
||||
for (const auto &uuid : uuids) {
|
||||
|
||||
@@ -134,7 +134,7 @@ private:
|
||||
bool init();
|
||||
|
||||
bool m_initialised = false;
|
||||
CallSession *m_session = nullptr;
|
||||
QPointer<CallSession> m_session = nullptr;
|
||||
|
||||
void setLifetime(int lifetime);
|
||||
void setRoom(NeoChatRoom *room);
|
||||
|
||||
@@ -247,6 +247,7 @@ void onGetStats(GstPromise *promise, gpointer)
|
||||
}
|
||||
}
|
||||
|
||||
// TODO port to QTimer?
|
||||
gboolean testPacketLoss(gpointer)
|
||||
{
|
||||
if (!keyFrameRequestData.pipe) {
|
||||
@@ -408,7 +409,6 @@ void iceGatheringStateChanged(GstElement *webrtc, GParamSpec *pspec, gpointer us
|
||||
|
||||
GstWebRTCICEGatheringState newState;
|
||||
g_object_get(webrtc, "ice-gathering-state", &newState, nullptr);
|
||||
qWarning() << "ICEGATHERINSTCHANGED" << newState;
|
||||
if (newState == GST_WEBRTC_ICE_GATHERING_STATE_COMPLETE) {
|
||||
qCWarning(voip) << "GstWebRTCICEGatheringState -> Complete";
|
||||
if (instance->m_isOffering) {
|
||||
@@ -618,10 +618,10 @@ void CallSession::end()
|
||||
{
|
||||
qCDebug(voip) << "Ending Call";
|
||||
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);
|
||||
m_pipe = nullptr;
|
||||
keyFrameRequestData.pipe = nullptr;
|
||||
if (m_busWatchId) {
|
||||
g_source_remove(m_busWatchId);
|
||||
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();
|
||||
static const QVector<QString> videoPlugins = {
|
||||
|
||||
@@ -65,7 +65,7 @@ public:
|
||||
void renegotiateOffer(const QString &offer, const QString &userId);
|
||||
void setTurnServers(QStringList servers);
|
||||
|
||||
QStringList missingPlugins() const;
|
||||
static QStringList missingPlugins();
|
||||
|
||||
CallSession::State state() const;
|
||||
|
||||
|
||||
@@ -9,6 +9,8 @@ import org.kde.kirigami 2.15 as Kirigami
|
||||
import org.kde.neochat 1.0
|
||||
|
||||
TimelineContainer {
|
||||
id: root
|
||||
|
||||
width: ListView.view.width
|
||||
|
||||
innerObject: QQC2.Control {
|
||||
@@ -16,7 +18,7 @@ TimelineContainer {
|
||||
padding: Kirigami.Units.gridUnit*2
|
||||
|
||||
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