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;
|
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
|
static void
|
||||||
on_stream_state_changed (void *data,
|
on_stream_state_changed (void *data,
|
||||||
enum pw_stream_state old,
|
enum pw_stream_state old,
|
||||||
@ -654,9 +665,7 @@ on_stream_state_changed (void *data,
|
|||||||
{
|
{
|
||||||
case PW_STREAM_STATE_ERROR:
|
case PW_STREAM_STATE_ERROR:
|
||||||
g_warning ("pipewire stream error: %s", error_message);
|
g_warning ("pipewire stream error: %s", error_message);
|
||||||
if (meta_screen_cast_stream_src_is_enabled (src))
|
meta_screen_cast_stream_src_close (src);
|
||||||
meta_screen_cast_stream_src_disable (src);
|
|
||||||
priv->emit_closed_after_dispatch = TRUE;
|
|
||||||
break;
|
break;
|
||||||
case PW_STREAM_STATE_PAUSED:
|
case PW_STREAM_STATE_PAUSED:
|
||||||
if (priv->node_id == SPA_ID_INVALID && priv->pipewire_stream)
|
if (priv->node_id == SPA_ID_INVALID && priv->pipewire_stream)
|
||||||
@ -942,17 +951,11 @@ on_core_error (void *data,
|
|||||||
const char *message)
|
const char *message)
|
||||||
{
|
{
|
||||||
MetaScreenCastStreamSrc *src = data;
|
MetaScreenCastStreamSrc *src = data;
|
||||||
MetaScreenCastStreamSrcPrivate *priv =
|
|
||||||
meta_screen_cast_stream_src_get_instance_private (src);
|
|
||||||
|
|
||||||
g_warning ("pipewire remote error: id:%u %s", id, message);
|
g_warning ("pipewire remote error: id:%u %s", id, message);
|
||||||
|
|
||||||
if (id == PW_ID_CORE && res == -EPIPE)
|
if (id == PW_ID_CORE && res == -EPIPE)
|
||||||
{
|
meta_screen_cast_stream_src_close (src);
|
||||||
if (meta_screen_cast_stream_src_is_enabled (src))
|
|
||||||
meta_screen_cast_stream_src_disable (src);
|
|
||||||
priv->emit_closed_after_dispatch = TRUE;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
|
@ -76,6 +76,8 @@ struct _MetaScreenCastStreamSrcClass
|
|||||||
struct spa_meta_cursor *spa_meta_cursor);
|
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,
|
void meta_screen_cast_stream_src_maybe_record_frame (MetaScreenCastStreamSrc *src,
|
||||||
MetaScreenCastRecordFlag flags);
|
MetaScreenCastRecordFlag flags);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user