[mutter/gbsneto/scanout-screencast: 2/2] screen-cast/monitor-stream: Immediately record scanout frames




commit a8a8133f9eb17e5d7c55ccf0d2623c5fe834e02a
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Mon Dec 27 15:32:27 2021 -0300

    screen-cast/monitor-stream: Immediately record scanout frames
    
    When the before-paint function is executed, it's only purpose
    is to check if there's any scanout queue, and immediately
    record it if any.
    
    However, since [1], we regressed in this specific case with the
    introduction of an idle callback in the before-paint function.
    
    Revert before-paint - and only that - back to immediately capturing
    any available scanout. Only record these frames when the target
    buffer is a DMA-BUF handle.
    
    [1] https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1914

 src/backends/meta-screen-cast-monitor-stream-src.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)
---
diff --git a/src/backends/meta-screen-cast-monitor-stream-src.c 
b/src/backends/meta-screen-cast-monitor-stream-src.c
index 82d3862c9a..757cfe217b 100644
--- a/src/backends/meta-screen-cast-monitor-stream-src.c
+++ b/src/backends/meta-screen-cast-monitor-stream-src.c
@@ -128,7 +128,7 @@ maybe_record_frame_on_idle (gpointer user_data)
 
   monitor_src->maybe_record_idle_id = 0;
 
-  flags = META_SCREEN_CAST_RECORD_FLAG_NONE;
+  flags = META_SCREEN_CAST_RECORD_FLAG_DMABUF_ONLY;
   meta_screen_cast_stream_src_maybe_record_frame (src, flags);
 
   return G_SOURCE_REMOVE;
@@ -162,6 +162,7 @@ before_stage_painted (MetaStage           *stage,
   MetaScreenCastMonitorStreamSrc *monitor_src =
     META_SCREEN_CAST_MONITOR_STREAM_SRC (user_data);
   MetaScreenCastStreamSrc *src = META_SCREEN_CAST_STREAM_SRC (monitor_src);
+  MetaScreenCastRecordFlag flags;
 
   if (monitor_src->maybe_record_idle_id)
     return;
@@ -169,10 +170,8 @@ before_stage_painted (MetaStage           *stage,
   if (!clutter_stage_view_peek_scanout (view))
     return;
 
-  monitor_src->maybe_record_idle_id = g_idle_add (maybe_record_frame_on_idle,
-                                                  src);
-  g_source_set_name_by_id (monitor_src->maybe_record_idle_id,
-                           "[mutter] maybe_record_frame_on_idle [monitor-src]");
+  flags = META_SCREEN_CAST_RECORD_FLAG_NONE;
+  meta_screen_cast_stream_src_maybe_record_frame (src, flags);
 }
 
 static MetaBackend *


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]