Commit 18bd44d0 authored by Jan Grulich's avatar Jan Grulich
Browse files

Close screencast session when we stop streaming

We should close screencast session when the client consuming our
stream will no longer be able to recieve anything from us, for
example when we close the window which we were streaming.


(cherry picked from commit 169251ab)
parent 0a12da6b
......@@ -72,6 +72,8 @@ uint ScreenCastPortal::CreateSession(const QDBusObjectPath &handle,
WaylandIntegration::stopAllStreaming();
});
connect(WaylandIntegration::waylandIntegration(), &WaylandIntegration::WaylandIntegration::streamingStopped, session, &Session::close);
return 0;
}
......
......@@ -49,6 +49,7 @@ bool Session::handleMessage(const QDBusMessage &message, const QDBusConnection &
if (message.interface() == QLatin1String("org.freedesktop.impl.portal.Session")) {
if (message.member() == QLatin1String("Close")) {
close();
Q_EMIT closed();
QDBusMessage reply = message.createReply();
return connection.send(reply);
......@@ -97,7 +98,14 @@ QString Session::introspect(const QString &path) const
bool Session::close()
{
QDBusMessage reply = QDBusMessage::createSignal(m_path, QStringLiteral("org.freedesktop.impl.portal.Session"), QStringLiteral("Closed"));
return QDBusConnection::sessionBus().send(reply);
const bool result = QDBusConnection::sessionBus().send(reply);
sessionList.remove(m_path);
QDBusConnection::sessionBus().unregisterObject(m_path);
deleteLater();
return result;
}
Session *Session::createSession(QObject *parent, SessionType type, const QString &appId, const QString &path)
......
......@@ -319,6 +319,8 @@ void WaylandIntegration::WaylandIntegrationPrivate::stopAllStreaming()
m_streamInput = false;
// First unbound outputs and destroy remote access manager so we no longer receive buffers
Q_EMIT streamingStopped();
}
void WaylandIntegration::WaylandIntegrationPrivate::stopStreaming(uint32_t nodeid)
......
......@@ -101,6 +101,7 @@ class WaylandIntegration : public QObject
Q_SIGNALS:
void newBuffer(uint8_t *screenData);
void plasmaWindowManagementInitialized();
void streamingStopped();
};
void authenticate();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment