From 7f73264f6654e834027bfdbb55e141a221d81579 Mon Sep 17 00:00:00 2001 From: Aleix Pol Date: Mon, 27 Jun 2022 21:13:18 +0200 Subject: [PATCH] screencast: Also send the header when we just send the cursor update When sending a frame that just updates the cursor, also increment the sequential value of the frame --- src/plugins/screencast/screencaststream.cpp | 11 ++++++++--- src/plugins/screencast/screencaststream.h | 1 + 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/plugins/screencast/screencaststream.cpp b/src/plugins/screencast/screencaststream.cpp index ae2270ef3c..af1c8452fd 100644 --- a/src/plugins/screencast/screencaststream.cpp +++ b/src/plugins/screencast/screencaststream.cpp @@ -488,7 +488,13 @@ void ScreenCastStream::recordFrame(const QRegion &damagedRegion) } } - spa_meta_header *spaHeader = (spa_meta_header *)spa_buffer_find_meta_data(spa_buffer, SPA_META_Header, sizeof(spaHeader)); + addHeader(spa_buffer); + tryEnqueue(buffer); +} + +void ScreenCastStream::addHeader(spa_buffer *spaBuffer) +{ + spa_meta_header *spaHeader = (spa_meta_header *)spa_buffer_find_meta_data(spaBuffer, SPA_META_Header, sizeof(spaHeader)); if (spaHeader) { spaHeader->flags = 0; spaHeader->dts_offset = 0; @@ -500,8 +506,6 @@ void ScreenCastStream::recordFrame(const QRegion &damagedRegion) } spaHeader->pts = (timestamp - m_start.value()).count(); } - - tryEnqueue(buffer); } void ScreenCastStream::recordCursor() @@ -531,6 +535,7 @@ void ScreenCastStream::recordCursor() spa_buffer->datas[0].chunk->size = 0; sendCursorData(Cursors::self()->currentCursor(), (spa_meta_cursor *)spa_buffer_find_meta_data(spa_buffer, SPA_META_Cursor, sizeof(spa_meta_cursor))); + addHeader(spa_buffer); enqueue(); } diff --git a/src/plugins/screencast/screencaststream.h b/src/plugins/screencast/screencaststream.h index 213b0d1aa2..789914f222 100644 --- a/src/plugins/screencast/screencaststream.h +++ b/src/plugins/screencast/screencaststream.h @@ -80,6 +80,7 @@ private: void updateParams(); void coreFailed(const QString &errorMessage); void sendCursorData(Cursor *cursor, spa_meta_cursor *spa_cursor); + void addHeader(spa_buffer *spaBuffer); void newStreamParams(); void tryEnqueue(pw_buffer *buffer); void enqueue();