From 0dd408050925571b8fb94ef5f4307940da71f40e Mon Sep 17 00:00:00 2001 From: Pascal Nowack Date: Sun, 16 Jun 2024 19:31:09 +0200 Subject: [PATCH] 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: --- src/backends/meta-screen-cast-stream-src.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/backends/meta-screen-cast-stream-src.c b/src/backends/meta-screen-cast-stream-src.c index d6e8f417e..3dd64fd27 100644 --- a/src/backends/meta-screen-cast-stream-src.c +++ b/src/backends/meta-screen-cast-stream-src.c @@ -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) {