Last active
August 30, 2022 07:56
-
-
Save sayap/f343bff7700d45b555aea7e581097314 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/plugins/screencast/screencaststream.cpp b/src/plugins/screencast/screencaststream.cpp | |
index 6f25b563a..a38261e9e 100644 | |
--- a/src/plugins/screencast/screencaststream.cpp | |
+++ b/src/plugins/screencast/screencaststream.cpp | |
@@ -107,13 +107,17 @@ void ScreenCastStream::newStreamParams() | |
SPA_TYPE_OBJECT_ParamMeta, SPA_PARAM_Meta, | |
SPA_PARAM_META_type, SPA_POD_Id(SPA_META_VideoDamage), | |
SPA_PARAM_META_size, SPA_POD_CHOICE_RANGE_Int(sizeof(struct spa_meta_region) * videoDamageRegionCount, sizeof(struct spa_meta_region) * 1, sizeof(struct spa_meta_region) * videoDamageRegionCount)), | |
+ (spa_pod *)spa_pod_builder_add_object(&pod_builder, | |
+ SPA_TYPE_OBJECT_ParamMeta, SPA_PARAM_Meta, | |
+ SPA_PARAM_META_type, SPA_POD_Id(SPA_META_VideoCrop), | |
+ SPA_PARAM_META_size, SPA_POD_Int(sizeof(struct spa_meta_region))), | |
(spa_pod *)spa_pod_builder_add_object(&pod_builder, | |
SPA_TYPE_OBJECT_ParamMeta, SPA_PARAM_Meta, | |
SPA_PARAM_META_type, SPA_POD_Id(SPA_META_Header), | |
SPA_PARAM_META_size, SPA_POD_Int(sizeof(struct spa_meta_header))), | |
}; | |
- pw_stream_update_params(pwStream, params, 4); | |
+ pw_stream_update_params(pwStream, params, 5); | |
} | |
void ScreenCastStream::onStreamParamChanged(void *data, uint32_t id, const struct spa_pod *format) | |
@@ -446,6 +450,7 @@ void ScreenCastStream::recordFrame(const QRegion &damagedRegion) | |
addDamage(spa_buffer, damagedRegion | QRect({0, 0}, size)); | |
addHeader(spa_buffer); | |
+ addVideoCrop(spa_buffer); | |
tryEnqueue(buffer); | |
} | |
@@ -465,6 +470,17 @@ void ScreenCastStream::addHeader(spa_buffer *spaBuffer) | |
} | |
} | |
+void ScreenCastStream::addVideoCrop(spa_buffer *spaBuffer) | |
+{ | |
+ spa_meta_region *spaVideoCrop = (spa_meta_region *)spa_buffer_find_meta_data(spaBuffer, SPA_META_VideoCrop, sizeof(spaVideoCrop)); | |
+ if (spaVideoCrop) { | |
+ spaVideoCrop->region.position.x = 0; | |
+ spaVideoCrop->region.position.y = 0; | |
+ spaVideoCrop->region.size.width = m_resolution.width(); | |
+ spaVideoCrop->region.size.height = m_resolution.height(); | |
+ } | |
+} | |
+ | |
void ScreenCastStream::addDamage(spa_buffer *spaBuffer, const QRegion &damagedRegion) | |
{ | |
if (spa_meta *vdMeta = spa_buffer_find_meta(spaBuffer, SPA_META_VideoDamage)) { | |
@@ -525,6 +541,7 @@ void ScreenCastStream::recordCursor() | |
sendCursorData(Cursors::self()->currentCursor(), | |
(spa_meta_cursor *)spa_buffer_find_meta_data(spa_buffer, SPA_META_Cursor, sizeof(spa_meta_cursor))); | |
addHeader(spa_buffer); | |
+ addVideoCrop(spa_buffer); | |
addDamage(spa_buffer, {}); | |
enqueue(); | |
} | |
diff --git a/src/plugins/screencast/screencaststream.h b/src/plugins/screencast/screencaststream.h | |
index 872d01b02..6dbf755f3 100644 | |
--- a/src/plugins/screencast/screencaststream.h | |
+++ b/src/plugins/screencast/screencaststream.h | |
@@ -80,6 +80,7 @@ private: | |
void coreFailed(const QString &errorMessage); | |
void sendCursorData(Cursor *cursor, spa_meta_cursor *spa_cursor); | |
void addHeader(spa_buffer *spaBuffer); | |
+ void addVideoCrop(spa_buffer *spaBuffer); | |
void addDamage(spa_buffer *spaBuffer, const QRegion &damagedRegion); | |
void newStreamParams(); | |
void tryEnqueue(pw_buffer *buffer); |
That's right! I tested on 5.11.10 (latest update) and it works .... except for the odd case of zoom toolbar showing in the middle of the screen 🙂
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I think this patch is no longer necessary with Zoom 5.11.9.