mirror of
https://github.com/brl/mutter.git
synced 2024-11-25 09:30:45 -05:00
screen-cast/src: Add helper to close stream after dispatch
This is needed to close the stream from non-abstract sources during PipeWire dispatch. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1698>
This commit is contained in:
parent
688280f82d
commit
cf5836a6ec
@ -640,6 +640,17 @@ meta_screen_cast_stream_src_disable (MetaScreenCastStreamSrc *src)
|
||||
priv->is_enabled = FALSE;
|
||||
}
|
||||
|
||||
void
|
||||
meta_screen_cast_stream_src_close (MetaScreenCastStreamSrc *src)
|
||||
{
|
||||
MetaScreenCastStreamSrcPrivate *priv =
|
||||
meta_screen_cast_stream_src_get_instance_private (src);
|
||||
|
||||
if (meta_screen_cast_stream_src_is_enabled (src))
|
||||
meta_screen_cast_stream_src_disable (src);
|
||||
priv->emit_closed_after_dispatch = TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
on_stream_state_changed (void *data,
|
||||
enum pw_stream_state old,
|
||||
@ -654,9 +665,7 @@ on_stream_state_changed (void *data,
|
||||
{
|
||||
case PW_STREAM_STATE_ERROR:
|
||||
g_warning ("pipewire stream error: %s", error_message);
|
||||
if (meta_screen_cast_stream_src_is_enabled (src))
|
||||
meta_screen_cast_stream_src_disable (src);
|
||||
priv->emit_closed_after_dispatch = TRUE;
|
||||
meta_screen_cast_stream_src_close (src);
|
||||
break;
|
||||
case PW_STREAM_STATE_PAUSED:
|
||||
if (priv->node_id == SPA_ID_INVALID && priv->pipewire_stream)
|
||||
@ -942,17 +951,11 @@ on_core_error (void *data,
|
||||
const char *message)
|
||||
{
|
||||
MetaScreenCastStreamSrc *src = data;
|
||||
MetaScreenCastStreamSrcPrivate *priv =
|
||||
meta_screen_cast_stream_src_get_instance_private (src);
|
||||
|
||||
g_warning ("pipewire remote error: id:%u %s", id, message);
|
||||
|
||||
if (id == PW_ID_CORE && res == -EPIPE)
|
||||
{
|
||||
if (meta_screen_cast_stream_src_is_enabled (src))
|
||||
meta_screen_cast_stream_src_disable (src);
|
||||
priv->emit_closed_after_dispatch = TRUE;
|
||||
}
|
||||
meta_screen_cast_stream_src_close (src);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
|
@ -76,6 +76,8 @@ struct _MetaScreenCastStreamSrcClass
|
||||
struct spa_meta_cursor *spa_meta_cursor);
|
||||
};
|
||||
|
||||
void meta_screen_cast_stream_src_close (MetaScreenCastStreamSrc *src);
|
||||
|
||||
void meta_screen_cast_stream_src_maybe_record_frame (MetaScreenCastStreamSrc *src,
|
||||
MetaScreenCastRecordFlag flags);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user