63 lines
2.0 KiB
Diff
63 lines
2.0 KiB
Diff
From f3efe25a5cb173bc63b380619b8673cd5ba99f6f Mon Sep 17 00:00:00 2001
|
|
From: =?UTF-8?q?Jonas=20=C3=85dahl?= <jadahl@gmail.com>
|
|
Date: Thu, 18 Jun 2020 11:35:44 +0200
|
|
Subject: [PATCH 2/2] vnc/pipewire-stream: Only try to copy frame pixels if
|
|
there are any
|
|
|
|
The producer might send empty frames with only cursor metadata, and in
|
|
this case we shouldn't try to copy any pixels, as there are no.
|
|
---
|
|
src/grd-vnc-pipewire-stream.c | 28 ++++++++++++++++------------
|
|
1 file changed, 16 insertions(+), 12 deletions(-)
|
|
|
|
diff --git a/src/grd-vnc-pipewire-stream.c b/src/grd-vnc-pipewire-stream.c
|
|
index 91fb0a1..ee8ad5d 100644
|
|
--- a/src/grd-vnc-pipewire-stream.c
|
|
+++ b/src/grd-vnc-pipewire-stream.c
|
|
@@ -312,9 +312,6 @@ process_buffer (GrdVncPipeWireStream *stream,
|
|
size_t size;
|
|
uint8_t *map;
|
|
void *src_data;
|
|
- int src_stride;
|
|
- int dst_stride;
|
|
- int height;
|
|
int y;
|
|
struct spa_meta_cursor *spa_meta_cursor;
|
|
g_autofree GrdVncFrame *frame = NULL;
|
|
@@ -365,16 +362,23 @@ process_buffer (GrdVncPipeWireStream *stream,
|
|
return NULL;
|
|
}
|
|
|
|
- src_stride = buffer->datas[0].chunk->stride;
|
|
- dst_stride = grd_session_vnc_get_framebuffer_stride (stream->session);
|
|
- height = stream->spa_format.size.height;
|
|
-
|
|
- frame->data = g_malloc (height * dst_stride);
|
|
- for (y = 0; y < height; y++)
|
|
+ if (src_data)
|
|
{
|
|
- memcpy (((uint8_t *) frame->data) + y * dst_stride,
|
|
- ((uint8_t *) src_data) + y * src_stride,
|
|
- dst_stride);
|
|
+ int src_stride;
|
|
+ int dst_stride;
|
|
+ int height;
|
|
+
|
|
+ src_stride = buffer->datas[0].chunk->stride;
|
|
+ dst_stride = grd_session_vnc_get_framebuffer_stride (stream->session);
|
|
+ height = stream->spa_format.size.height;
|
|
+
|
|
+ frame->data = g_malloc (height * dst_stride);
|
|
+ for (y = 0; y < height; y++)
|
|
+ {
|
|
+ memcpy (((uint8_t *) frame->data) + y * dst_stride,
|
|
+ ((uint8_t *) src_data) + y * src_stride,
|
|
+ dst_stride);
|
|
+ }
|
|
}
|
|
|
|
if (map)
|
|
--
|
|
2.26.2
|
|
|