d44c6620ba
The content of this branch was automatically imported from Fedora ELN with the following as its source: https://src.fedoraproject.org/rpms/gnome-remote-desktop#c026821a7a9a0572ad111258d5cc879d8e7d6a13
72 lines
2.7 KiB
Diff
72 lines
2.7 KiB
Diff
From 81172effba7c70d3b2932c67be79a2924eae9d73 Mon Sep 17 00:00:00 2001
|
|
From: =?UTF-8?q?Jonas=20=C3=85dahl?= <jadahl@gmail.com>
|
|
Date: Mon, 12 Oct 2020 17:34:30 +0200
|
|
Subject: [PATCH] vnc: Copy pixels using the right destination stride
|
|
|
|
We're copying the pixels in a separate thread managed by PipeWire, and
|
|
in this thread, accessing the VNC framebuffer dimension and stride is
|
|
racy. Instead of fetching the dimension directly, pass the expected
|
|
width and get the stride it will eventually have.
|
|
|
|
Already before this patch, when the copied pixel end up on the main
|
|
thread and the dimension still doesn't match up, the frame will be
|
|
dropped.
|
|
---
|
|
src/grd-session-vnc.c | 5 +++--
|
|
src/grd-session-vnc.h | 3 ++-
|
|
src/grd-vnc-pipewire-stream.c | 5 +++--
|
|
3 files changed, 8 insertions(+), 5 deletions(-)
|
|
|
|
diff --git a/src/grd-session-vnc.c b/src/grd-session-vnc.c
|
|
index 69fb33d..f4835aa 100644
|
|
--- a/src/grd-session-vnc.c
|
|
+++ b/src/grd-session-vnc.c
|
|
@@ -535,9 +535,10 @@ grd_session_vnc_get_fd (GrdSessionVnc *session_vnc)
|
|
}
|
|
|
|
int
|
|
-grd_session_vnc_get_framebuffer_stride (GrdSessionVnc *session_vnc)
|
|
+grd_session_vnc_get_stride_for_width (GrdSessionVnc *session_vnc,
|
|
+ int width)
|
|
{
|
|
- return session_vnc->rfb_screen->paddedWidthInBytes;
|
|
+ return width * BGRX_BYTES_PER_PIXEL;
|
|
}
|
|
|
|
rfbClientPtr
|
|
diff --git a/src/grd-session-vnc.h b/src/grd-session-vnc.h
|
|
index 0d01ad3..ccd046c 100644
|
|
--- a/src/grd-session-vnc.h
|
|
+++ b/src/grd-session-vnc.h
|
|
@@ -60,7 +60,8 @@ void grd_session_vnc_move_cursor (GrdSessionVnc *session_vnc,
|
|
|
|
int grd_session_vnc_get_fd (GrdSessionVnc *session_vnc);
|
|
|
|
-int grd_session_vnc_get_framebuffer_stride (GrdSessionVnc *session_vnc);
|
|
+int grd_session_vnc_get_stride_for_width (GrdSessionVnc *session_vnc,
|
|
+ int width);
|
|
|
|
gboolean grd_session_vnc_is_client_gone (GrdSessionVnc *session_vnc);
|
|
|
|
diff --git a/src/grd-vnc-pipewire-stream.c b/src/grd-vnc-pipewire-stream.c
|
|
index 96dd7c9..82ceb9b 100644
|
|
--- a/src/grd-vnc-pipewire-stream.c
|
|
+++ b/src/grd-vnc-pipewire-stream.c
|
|
@@ -326,10 +326,11 @@ process_buffer (GrdVncPipeWireStream *stream,
|
|
int height;
|
|
int y;
|
|
|
|
- src_stride = buffer->datas[0].chunk->stride;
|
|
- dst_stride = grd_session_vnc_get_framebuffer_stride (stream->session);
|
|
height = stream->spa_format.size.height;
|
|
width = stream->spa_format.size.width;
|
|
+ src_stride = buffer->datas[0].chunk->stride;
|
|
+ dst_stride = grd_session_vnc_get_stride_for_width (stream->session,
|
|
+ width);
|
|
|
|
frame->data = g_malloc (height * dst_stride);
|
|
for (y = 0; y < height; y++)
|
|
--
|
|
2.28.0
|
|
|