screencast: Add ability to stop streams
When a stream is destroyed by a consumer, mutter won't be able to recognize that. For mutter, the stream just paused, but did not disconnect, because the connection state of a PipeWire stream only represents, whether the respective PipeWire context is connected to PipeWire. In addition to that, it may be the case, that the stream consumer just recreates the stream. So even if mutter would be able to know, when the stream consumer destroyed a stream, but not the whole screencast or remote-desktop session, then mutter would not know, whether the stream will be resumed eventually or not. So, add an explicit API call to the screencast interface to stop a stream. For virtual streams, this also means, that the respective virtual monitor is destroyed. Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2889 Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3307>
This commit is contained in:
parent
d2122a02a3
commit
a2a4067e07
2 changed files with 33 additions and 0 deletions
|
@ -199,6 +199,14 @@
|
|||
-->
|
||||
<method name="Start"/>
|
||||
|
||||
<!--
|
||||
Stop:
|
||||
@short_description: Stop the stream
|
||||
|
||||
Stop the started stream.
|
||||
-->
|
||||
<method name="Stop"/>
|
||||
|
||||
<!--
|
||||
PipeWireStreamAdded:
|
||||
@short_description: Pipewire stream added
|
||||
|
|
|
@ -396,10 +396,35 @@ handle_start (MetaDBusScreenCastStream *skeleton,
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
handle_stop (MetaDBusScreenCastStream *skeleton,
|
||||
GDBusMethodInvocation *invocation)
|
||||
{
|
||||
MetaScreenCastStream *stream = META_SCREEN_CAST_STREAM (skeleton);
|
||||
MetaScreenCastStreamPrivate *priv =
|
||||
meta_screen_cast_stream_get_instance_private (stream);
|
||||
|
||||
if (!check_permission (stream, invocation))
|
||||
{
|
||||
g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR,
|
||||
G_DBUS_ERROR_ACCESS_DENIED,
|
||||
"Permission denied");
|
||||
return G_DBUS_METHOD_INVOCATION_HANDLED;
|
||||
}
|
||||
|
||||
if (priv->src)
|
||||
meta_screen_cast_stream_close (stream);
|
||||
|
||||
meta_dbus_screen_cast_stream_complete_stop (skeleton, invocation);
|
||||
|
||||
return G_DBUS_METHOD_INVOCATION_HANDLED;
|
||||
}
|
||||
|
||||
static void
|
||||
meta_screen_cast_stream_init_iface (MetaDBusScreenCastStreamIface *iface)
|
||||
{
|
||||
iface->handle_start = handle_start;
|
||||
iface->handle_stop = handle_stop;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
|
|
Loading…
Reference in a new issue