mirror of
https://github.com/brl/mutter.git
synced 2024-11-28 02:50:41 -05:00
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
This commit is contained in:
parent
92db8902d9
commit
cf88d64882
@ -191,7 +191,7 @@ sync_cursor_state (MetaScreenCastMonitorStreamSrc *monitor_src)
|
|||||||
if (clutter_stage_is_redraw_queued (stage))
|
if (clutter_stage_is_redraw_queued (stage))
|
||||||
return;
|
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);
|
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;
|
MetaLogicalMonitor *logical_monitor;
|
||||||
|
|
||||||
stage = get_stage (monitor_src);
|
stage = get_stage (monitor_src);
|
||||||
if (!clutter_stage_is_redraw_queued (stage))
|
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
monitor = get_monitor (monitor_src);
|
monitor = get_monitor (monitor_src);
|
||||||
logical_monitor = meta_monitor_get_logical_monitor (monitor);
|
logical_monitor = meta_monitor_get_logical_monitor (monitor);
|
||||||
clutter_stage_capture_into (stage, FALSE, &logical_monitor->rect, data);
|
clutter_stage_capture_into (stage, FALSE, &logical_monitor->rect, data);
|
||||||
|
@ -472,34 +472,41 @@ meta_screen_cast_stream_src_maybe_record_frame (MetaScreenCastStreamSrc *src,
|
|||||||
return;
|
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))
|
||||||
|
|
||||||
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))
|
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;
|
||||||
|
|
||||||
|
/* 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 = crop_rect.x;
|
if (meta_screen_cast_stream_src_get_videocrop (src, &crop_rect))
|
||||||
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.position.x = crop_rect.x;
|
||||||
spa_meta_video_crop->region.size.height = crop_rect.height;
|
spa_meta_video_crop->region.position.y = crop_rect.y;
|
||||||
}
|
spa_meta_video_crop->region.size.width = crop_rect.width;
|
||||||
else
|
spa_meta_video_crop->region.size.height = crop_rect.height;
|
||||||
{
|
}
|
||||||
spa_meta_video_crop->region.position.x = 0;
|
else
|
||||||
spa_meta_video_crop->region.position.y = 0;
|
{
|
||||||
spa_meta_video_crop->region.size.width = priv->stream_width;
|
spa_meta_video_crop->region.position.x = 0;
|
||||||
spa_meta_video_crop->region.size.height = priv->stream_height;
|
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
|
else
|
||||||
{
|
{
|
||||||
|
@ -40,6 +40,7 @@ typedef struct _MetaScreenCastStream MetaScreenCastStream;
|
|||||||
typedef enum _MetaScreenCastRecordFlag
|
typedef enum _MetaScreenCastRecordFlag
|
||||||
{
|
{
|
||||||
META_SCREEN_CAST_RECORD_FLAG_NONE = 0,
|
META_SCREEN_CAST_RECORD_FLAG_NONE = 0,
|
||||||
|
META_SCREEN_CAST_RECORD_FLAG_CURSOR_ONLY = 1 << 0,
|
||||||
} MetaScreenCastRecordFlag;
|
} MetaScreenCastRecordFlag;
|
||||||
|
|
||||||
#define META_TYPE_SCREEN_CAST_STREAM_SRC (meta_screen_cast_stream_src_get_type ())
|
#define META_TYPE_SCREEN_CAST_STREAM_SRC (meta_screen_cast_stream_src_get_type ())
|
||||||
|
@ -329,7 +329,7 @@ screen_cast_window_damaged (MetaWindowActor *actor,
|
|||||||
MetaScreenCastStreamSrc *src = META_SCREEN_CAST_STREAM_SRC (window_src);
|
MetaScreenCastStreamSrc *src = META_SCREEN_CAST_STREAM_SRC (window_src);
|
||||||
MetaScreenCastRecordFlag flags;
|
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);
|
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))
|
if (meta_screen_cast_window_has_damage (window_src->screen_cast_window))
|
||||||
return;
|
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);
|
meta_screen_cast_stream_src_maybe_record_frame (src, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user