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();