From ef6612ff773572c5a3a25b7f2d126978af759253 Mon Sep 17 00:00:00 2001 From: Aleix Pol Gonzalez Date: Wed, 5 Apr 2023 16:36:19 +0000 Subject: [PATCH] screencast: Improve how we communicate that a frame has just cursor info Set the SPA_CHUNK_FLAG_CORRUPTED flag to tell clients to ignore the frame. See https://github.com/obsproject/obs-studio/issues/8630 --- src/plugins/screencast/screencaststream.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/plugins/screencast/screencaststream.cpp b/src/plugins/screencast/screencaststream.cpp index 84c93a4800..e3c2c199ba 100644 --- a/src/plugins/screencast/screencaststream.cpp +++ b/src/plugins/screencast/screencaststream.cpp @@ -472,6 +472,7 @@ void ScreenCastStream::recordFrame(const QRegion &_damagedRegion) } spa_data->chunk->offset = 0; + spa_data->chunk->flags = SPA_CHUNK_FLAG_NONE; static_cast(Compositor::self()->backend())->makeCurrent(); if (data || spa_data[0].type == SPA_DATA_MemFd) { const bool hasAlpha = m_source->hasAlphaChannel(); @@ -629,7 +630,9 @@ void ScreenCastStream::recordCursor() } struct spa_buffer *spa_buffer = m_pendingBuffer->buffer; - spa_buffer->datas[0].chunk->size = 0; + + // in pipewire terms, corrupted means "do not look at the frame contents" and here they're empty. + spa_buffer->datas[0].chunk->flags = SPA_CHUNK_FLAG_CORRUPTED; sendCursorData(Cursors::self()->currentCursor(), (spa_meta_cursor *)spa_buffer_find_meta_data(spa_buffer, SPA_META_Cursor, sizeof(spa_meta_cursor)));