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. Related: https://gitlab.gnome.org/GNOME/mutter/-/issues/1323 https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1361
This commit is contained in:
parent
cea0722e72
commit
882967d3ce
@ -178,7 +178,7 @@ sync_cursor_state (MetaScreenCastAreaStreamSrc *area_src)
|
||||
if (is_redraw_queued (area_src))
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -212,7 +212,7 @@ sync_cursor_state (MetaScreenCastMonitorStreamSrc *monitor_src)
|
||||
if (is_redraw_queued (monitor_src))
|
||||
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);
|
||||
}
|
||||
|
||||
@ -396,9 +396,6 @@ meta_screen_cast_monitor_stream_src_record_to_buffer (MetaScreenCastStreamSrc *s
|
||||
MetaMonitor *monitor;
|
||||
MetaLogicalMonitor *logical_monitor;
|
||||
|
||||
if (!is_redraw_queued (monitor_src))
|
||||
return FALSE;
|
||||
|
||||
monitor = get_monitor (monitor_src);
|
||||
logical_monitor = meta_monitor_get_logical_monitor (monitor);
|
||||
stage = get_stage (monitor_src);
|
||||
|
@ -472,34 +472,41 @@ meta_screen_cast_stream_src_maybe_record_frame (MetaScreenCastStreamSrc *src,
|
||||
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;
|
||||
|
||||
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 (do_record_frame (src, spa_buffer, data))
|
||||
{
|
||||
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;
|
||||
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.size.height = crop_rect.height;
|
||||
}
|
||||
else
|
||||
{
|
||||
spa_meta_video_crop->region.position.x = 0;
|
||||
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;
|
||||
if (meta_screen_cast_stream_src_get_videocrop (src, &crop_rect))
|
||||
{
|
||||
spa_meta_video_crop->region.position.x = crop_rect.x;
|
||||
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.size.height = crop_rect.height;
|
||||
}
|
||||
else
|
||||
{
|
||||
spa_meta_video_crop->region.position.x = 0;
|
||||
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
|
||||
{
|
||||
|
@ -40,6 +40,7 @@ typedef struct _MetaScreenCastStream MetaScreenCastStream;
|
||||
typedef enum _MetaScreenCastRecordFlag
|
||||
{
|
||||
META_SCREEN_CAST_RECORD_FLAG_NONE = 0,
|
||||
META_SCREEN_CAST_RECORD_FLAG_CURSOR_ONLY = 1 << 0,
|
||||
} MetaScreenCastRecordFlag;
|
||||
|
||||
#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);
|
||||
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);
|
||||
}
|
||||
|
||||
@ -375,7 +375,7 @@ sync_cursor_state (MetaScreenCastWindowStreamSrc *window_src)
|
||||
if (meta_screen_cast_window_has_damage (window_src->screen_cast_window))
|
||||
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);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user