[mutter/gnome-3-36] screen-cast: Let the reason for recording determine what to record
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter/gnome-3-36] screen-cast: Let the reason for recording determine what to record
- Date: Wed, 8 Jul 2020 18:24:57 +0000 (UTC)
commit cf88d648822eb6b7d412c08d4038c657d415bfff
Author: Jonas Ã…dahl <jadahl gmail com>
Date: Fri Jul 3 16:52:43 2020 +0200
screen-cast: Let the reason for recording determine what to record
E.g. we'll have pointer movement that, if no painting is already
scheduled, should only send new cursor metadata without any new pixel
buffer. When this happens, tell next step to not record the pixels if
this was the case, instead of having it rediscover this itself.
Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/1323
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1351
src/backends/meta-screen-cast-monitor-stream-src.c | 5 +--
src/backends/meta-screen-cast-stream-src.c | 51 ++++++++++++----------
src/backends/meta-screen-cast-stream-src.h | 1 +
src/backends/meta-screen-cast-window-stream-src.c | 4 +-
4 files changed, 33 insertions(+), 28 deletions(-)
---
diff --git a/src/backends/meta-screen-cast-monitor-stream-src.c
b/src/backends/meta-screen-cast-monitor-stream-src.c
index 70edb229cc..17aa7aeb4b 100644
--- a/src/backends/meta-screen-cast-monitor-stream-src.c
+++ b/src/backends/meta-screen-cast-monitor-stream-src.c
@@ -191,7 +191,7 @@ sync_cursor_state (MetaScreenCastMonitorStreamSrc *monitor_src)
if (clutter_stage_is_redraw_queued (stage))
return;
- flags = META_SCREEN_CAST_RECORD_FLAG_NONE;
+ flags = META_SCREEN_CAST_RECORD_FLAG_CURSOR_ONLY;
meta_screen_cast_stream_src_maybe_record_frame (src, flags);
}
@@ -376,9 +376,6 @@ meta_screen_cast_monitor_stream_src_record_to_buffer (MetaScreenCastStreamSrc *s
MetaLogicalMonitor *logical_monitor;
stage = get_stage (monitor_src);
- if (!clutter_stage_is_redraw_queued (stage))
- return FALSE;
-
monitor = get_monitor (monitor_src);
logical_monitor = meta_monitor_get_logical_monitor (monitor);
clutter_stage_capture_into (stage, FALSE, &logical_monitor->rect, data);
diff --git a/src/backends/meta-screen-cast-stream-src.c b/src/backends/meta-screen-cast-stream-src.c
index 7f124bffff..463d316ebe 100644
--- a/src/backends/meta-screen-cast-stream-src.c
+++ b/src/backends/meta-screen-cast-stream-src.c
@@ -472,34 +472,41 @@ meta_screen_cast_stream_src_maybe_record_frame (MetaScreenCastStreamSrc *src,
return;
}
- if (do_record_frame (src, spa_buffer, data))
+ if (!(flags & META_SCREEN_CAST_RECORD_FLAG_CURSOR_ONLY))
{
- struct spa_meta_region *spa_meta_video_crop;
+ if (do_record_frame (src, spa_buffer, data))
+ {
+ struct spa_meta_region *spa_meta_video_crop;
- spa_buffer->datas[0].chunk->size = spa_buffer->datas[0].maxsize;
- spa_buffer->datas[0].chunk->stride = priv->video_stride;
+ spa_buffer->datas[0].chunk->size = spa_buffer->datas[0].maxsize;
+ spa_buffer->datas[0].chunk->stride = priv->video_stride;
- /* Update VideoCrop if needed */
- spa_meta_video_crop =
- spa_buffer_find_meta_data (spa_buffer, SPA_META_VideoCrop,
- sizeof (*spa_meta_video_crop));
- if (spa_meta_video_crop)
- {
- if (meta_screen_cast_stream_src_get_videocrop (src, &crop_rect))
- {
- spa_meta_video_crop->region.position.x = crop_rect.x;
- spa_meta_video_crop->region.position.y = crop_rect.y;
- spa_meta_video_crop->region.size.width = crop_rect.width;
- spa_meta_video_crop->region.size.height = crop_rect.height;
- }
- else
+ /* Update VideoCrop if needed */
+ spa_meta_video_crop =
+ spa_buffer_find_meta_data (spa_buffer, SPA_META_VideoCrop,
+ sizeof (*spa_meta_video_crop));
+ if (spa_meta_video_crop)
{
- spa_meta_video_crop->region.position.x = 0;
- spa_meta_video_crop->region.position.y = 0;
- spa_meta_video_crop->region.size.width = priv->stream_width;
- spa_meta_video_crop->region.size.height = priv->stream_height;
+ if (meta_screen_cast_stream_src_get_videocrop (src, &crop_rect))
+ {
+ spa_meta_video_crop->region.position.x = crop_rect.x;
+ spa_meta_video_crop->region.position.y = crop_rect.y;
+ spa_meta_video_crop->region.size.width = crop_rect.width;
+ spa_meta_video_crop->region.size.height = crop_rect.height;
+ }
+ else
+ {
+ spa_meta_video_crop->region.position.x = 0;
+ spa_meta_video_crop->region.position.y = 0;
+ spa_meta_video_crop->region.size.width = priv->stream_width;
+ spa_meta_video_crop->region.size.height = priv->stream_height;
+ }
}
}
+ else
+ {
+ spa_buffer->datas[0].chunk->size = 0;
+ }
}
else
{
diff --git a/src/backends/meta-screen-cast-stream-src.h b/src/backends/meta-screen-cast-stream-src.h
index 6c73d05c1d..87054eedf5 100644
--- a/src/backends/meta-screen-cast-stream-src.h
+++ b/src/backends/meta-screen-cast-stream-src.h
@@ -40,6 +40,7 @@ typedef struct _MetaScreenCastStream MetaScreenCastStream;
typedef enum _MetaScreenCastRecordFlag
{
META_SCREEN_CAST_RECORD_FLAG_NONE = 0,
+ META_SCREEN_CAST_RECORD_FLAG_CURSOR_ONLY = 1 << 0,
} MetaScreenCastRecordFlag;
#define META_TYPE_SCREEN_CAST_STREAM_SRC (meta_screen_cast_stream_src_get_type ())
diff --git a/src/backends/meta-screen-cast-window-stream-src.c
b/src/backends/meta-screen-cast-window-stream-src.c
index b3217330fb..dfc5baa1a2 100644
--- a/src/backends/meta-screen-cast-window-stream-src.c
+++ b/src/backends/meta-screen-cast-window-stream-src.c
@@ -329,7 +329,7 @@ screen_cast_window_damaged (MetaWindowActor *actor,
MetaScreenCastStreamSrc *src = META_SCREEN_CAST_STREAM_SRC (window_src);
MetaScreenCastRecordFlag flags;
- flags = META_SCREEN_CAST_RECORD_FLAG_NONE;
+ flags = META_SCREEN_CAST_RECORD_FLAG_CURSOR_ONLY;
meta_screen_cast_stream_src_maybe_record_frame (src, flags);
}
@@ -375,7 +375,7 @@ sync_cursor_state (MetaScreenCastWindowStreamSrc *window_src)
if (meta_screen_cast_window_has_damage (window_src->screen_cast_window))
return;
- flags = META_SCREEN_CAST_RECORD_FLAG_NONE;
+ flags = META_SCREEN_CAST_RECORD_FLAG_CURSOR_ONLY;
meta_screen_cast_stream_src_maybe_record_frame (src, flags);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]