1
0
Fork 0

screen-cast/monitor-src: Record DMA-BUF frames immediately

Instead of always, unconditionally scheduling an idle callback for
frame recording, try to record a DMA-BUF only frame, and only if
that's not possible, schedule the idle callback.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2804>
This commit is contained in:
Georges Basile Stavracas Neto 2022-12-03 19:20:25 -03:00 committed by Robert Mader
parent 7f28fa6c79
commit bc2f1145d8

View file

@ -158,14 +158,24 @@ stage_painted (MetaStage *stage,
MetaScreenCastMonitorStreamSrc *monitor_src =
META_SCREEN_CAST_MONITOR_STREAM_SRC (user_data);
MetaScreenCastStreamSrc *src = META_SCREEN_CAST_STREAM_SRC (monitor_src);
MetaScreenCastRecordResult record_result;
MetaScreenCastRecordFlag flags;
if (monitor_src->maybe_record_idle_id)
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_DMABUF_ONLY;
record_result = meta_screen_cast_stream_src_maybe_record_frame (src,
flags,
NULL);
if (!(record_result & META_SCREEN_CAST_RECORD_RESULT_RECORDED_FRAME))
{
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]");
}
}
static void