[mutter/gbsneto/more-screencast: 7/9] monitor-stream-src: Add before-paint watch to catch scanouts
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter/gbsneto/more-screencast: 7/9] monitor-stream-src: Add before-paint watch to catch scanouts
- Date: Tue, 1 Sep 2020 13:26:46 +0000 (UTC)
commit f19d9913786825517269a345d03f66c8ac1acf9e
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date: Sat Aug 29 15:41:57 2020 -0300
monitor-stream-src: Add before-paint watch to catch scanouts
Scanouts are taken away after painting. However, when we're
streaming, what we actually want is to capture whatever is
going to end up on screen - and that includes the scanout
if there's any.
Add a before-paint watch that only records new frames if a
scanout is set.
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1421
src/backends/meta-screen-cast-monitor-stream-src.c | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
---
diff --git a/src/backends/meta-screen-cast-monitor-stream-src.c
b/src/backends/meta-screen-cast-monitor-stream-src.c
index 0f086cab9a..b0b3b3763e 100644
--- a/src/backends/meta-screen-cast-monitor-stream-src.c
+++ b/src/backends/meta-screen-cast-monitor-stream-src.c
@@ -127,6 +127,25 @@ stage_painted (MetaStage *stage,
meta_screen_cast_stream_src_maybe_record_frame (src, flags);
}
+static void
+before_stage_painted (MetaStage *stage,
+ ClutterStageView *view,
+ ClutterPaintContext *paint_context,
+ gpointer user_data)
+{
+ MetaScreenCastStreamSrc *src = META_SCREEN_CAST_STREAM_SRC (user_data);
+ CoglScanout *scanout;
+
+ scanout = clutter_stage_view_peek_scanout (view);
+ if (scanout)
+ {
+ MetaScreenCastRecordFlag flags;
+
+ flags = META_SCREEN_CAST_RECORD_FLAG_NONE;
+ meta_screen_cast_stream_src_maybe_record_frame (src, flags);
+ }
+}
+
static MetaBackend *
get_backend (MetaScreenCastMonitorStreamSrc *monitor_src)
{
@@ -344,6 +363,9 @@ meta_screen_cast_monitor_stream_src_enable (MetaScreenCastStreamSrc *src)
meta_cursor_tracker_track_position (cursor_tracker);
G_GNUC_FALLTHROUGH;
case META_SCREEN_CAST_CURSOR_MODE_HIDDEN:
+ add_view_watches (monitor_src,
+ META_STAGE_WATCH_BEFORE_PAINT,
+ before_stage_painted);
add_view_watches (monitor_src,
META_STAGE_WATCH_AFTER_ACTOR_PAINT,
stage_painted);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]