1
0
Fork 0

screen-cast/src: Allow dropping cursor-frame if nothing changed

Allow a screen cast stream source to say that nothing changed in terms
of cursor metadata, and treat this together with a cursor-only frame as
we not recording anything.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3803>
This commit is contained in:
Jonas Ådahl 2024-06-11 16:51:29 +02:00 committed by Marge Bot
parent f19f8fcb16
commit 91d43bfbe1
2 changed files with 12 additions and 0 deletions

View file

@ -776,6 +776,8 @@ meta_screen_cast_stream_src_maybe_record_frame_with_timestamp (MetaScreenCastStr
{
MetaScreenCastStreamSrcPrivate *priv =
meta_screen_cast_stream_src_get_instance_private (src);
MetaScreenCastStreamSrcClass *klass =
META_SCREEN_CAST_STREAM_SRC_GET_CLASS (src);
MetaScreenCastRecordResult record_result =
META_SCREEN_CAST_RECORD_RESULT_RECORDED_NOTHING;
MtkRectangle crop_rect;
@ -787,6 +789,15 @@ meta_screen_cast_stream_src_maybe_record_frame_with_timestamp (MetaScreenCastStr
COGL_TRACE_BEGIN_SCOPED (MaybeRecordFrame,
"Meta::ScreenCastStreamSrc::maybe_record_frame_with_timestamp()");
if ((flags & META_SCREEN_CAST_RECORD_FLAG_CURSOR_ONLY) &&
klass->is_cursor_metadata_valid &&
klass->is_cursor_metadata_valid (src))
{
meta_topic (META_DEBUG_SCREEN_CAST,
"Dropping cursor-only frame as the cursor didn't change");
return record_result;
}
/* Accumulate the damaged region since we might not schedule a frame capture
* eventually but once we do, we should report all the previous damaged areas.
*/

View file

@ -85,6 +85,7 @@ struct _MetaScreenCastStreamSrcClass
gboolean (* get_videocrop) (MetaScreenCastStreamSrc *src,
MtkRectangle *crop_rect);
gboolean (* is_cursor_metadata_valid) (MetaScreenCastStreamSrc *src);
void (* set_cursor_metadata) (MetaScreenCastStreamSrc *src,
struct spa_meta_cursor *spa_meta_cursor);