diff options
author | Georges Basile Stavracas Neto <georges.stavracas@gmail.com> | 2023-01-24 12:27:06 -0300 |
---|---|---|
committer | Robert Mader <robert.mader@collabora.com> | 2023-04-07 12:49:53 +0200 |
commit | bc19f551296c675dbc01e63cdaf33a7edb588ec0 (patch) | |
tree | 0884923bc74ceb8b1747995762b40ca3410d2b88 | |
parent | bc2f1145d867213715748fa0ac3e90bfd5a8429a (diff) | |
download | mutter-bc19f551296c675dbc01e63cdaf33a7edb588ec0.tar.gz |
screen-cast/monitor-src: Record frames with presentation time
Pass the timestamp of the frame as the target timestamp of the
record. This makes the rudimentary frame throttling mechanism
inside MetaScreenCastStreamSrc work with the timing variability
that dynamic dispatch times introduced.
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2804>
-rw-r--r-- | src/backends/meta-screen-cast-monitor-stream-src.c | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/src/backends/meta-screen-cast-monitor-stream-src.c b/src/backends/meta-screen-cast-monitor-stream-src.c index 6bcffd9a5..efb458067 100644 --- a/src/backends/meta-screen-cast-monitor-stream-src.c +++ b/src/backends/meta-screen-cast-monitor-stream-src.c @@ -160,14 +160,20 @@ stage_painted (MetaStage *stage, MetaScreenCastStreamSrc *src = META_SCREEN_CAST_STREAM_SRC (monitor_src); MetaScreenCastRecordResult record_result; MetaScreenCastRecordFlag flags; + int64_t presentation_time_us; if (monitor_src->maybe_record_idle_id) return; + if (!clutter_frame_get_target_presentation_time (frame, &presentation_time_us)) + presentation_time_us = g_get_monotonic_time (); + flags = META_SCREEN_CAST_RECORD_FLAG_DMABUF_ONLY; - record_result = meta_screen_cast_stream_src_maybe_record_frame (src, - flags, - NULL); + record_result = + meta_screen_cast_stream_src_maybe_record_frame_with_timestamp (src, + flags, + NULL, + presentation_time_us); if (!(record_result & META_SCREEN_CAST_RECORD_RESULT_RECORDED_FRAME)) { @@ -189,6 +195,7 @@ before_stage_painted (MetaStage *stage, META_SCREEN_CAST_MONITOR_STREAM_SRC (user_data); MetaScreenCastStreamSrc *src = META_SCREEN_CAST_STREAM_SRC (monitor_src); MetaScreenCastRecordFlag flags; + int64_t presentation_time_us; if (monitor_src->maybe_record_idle_id) return; @@ -196,8 +203,14 @@ before_stage_painted (MetaStage *stage, if (!clutter_stage_view_peek_scanout (view)) return; + if (!clutter_frame_get_target_presentation_time (frame, &presentation_time_us)) + presentation_time_us = g_get_monotonic_time (); + flags = META_SCREEN_CAST_RECORD_FLAG_DMABUF_ONLY; - meta_screen_cast_stream_src_maybe_record_frame (src, flags, NULL); + meta_screen_cast_stream_src_maybe_record_frame_with_timestamp (src, + flags, + NULL, + presentation_time_us); } static gboolean |