backends/screen-cast-stream-src: Always initially set buffer stride

When mutter creates a dma-buf buffer for screencasting, the buffers
stride will, among other attributes, also be defined.
However, mutter currently only sets the buffer stride, when actually
recording a frame, but not when adding it.
This behaviour disallows screencast consumers (clients) to already
import the respective buffer (i.e. for Vulkan creating a VkImage for the
dma-buf image), as the stride is not yet communicated to the client.

Since the stride won't change after adding the respective buffer,
directly set the buffer stride, when adding the PipeWire buffer. This
allows screencast consumers (clients) to do optimizations in their
encoding paths.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3827>
This commit is contained in:
Pascal Nowack 2024-06-16 19:31:09 +02:00
parent e0c1dff45c
commit 0dd4080509

View File

@ -890,8 +890,6 @@ meta_screen_cast_stream_src_maybe_record_frame_with_timestamp (MetaScreenCastStr
struct spa_meta_region *spa_meta_video_crop;
spa_data->chunk->size = spa_data->maxsize;
spa_data->chunk->stride =
meta_screen_cast_stream_src_calculate_stride (src, spa_data);
spa_data->chunk->flags = SPA_CHUNK_FLAG_NONE;
/* Update VideoCrop if needed */
@ -1447,6 +1445,7 @@ on_stream_add_buffer (void *data,
return;
}
}
spa_data->chunk->stride = stride;
if (priv->buffer_count == 1 && priv->needs_follow_up_with_buffers)
{