From d32c03488fcf6cdb0ca2e99b0ed6ade078460deb Mon Sep 17 00:00:00 2001 From: Sebastian Keller Date: Sun, 21 Aug 2022 16:00:40 +0200 Subject: [PATCH] screencast: Always copy buffers in pipewiresrc Pipewire 0.3.52 via commit a1f33a99 introduced a change that affects how long pipewiresrc holds onto the pw_buffers it dequeued. Before that change the pw_buffer was held until the end of the videoconvert element at the beginning of the pipeline. After that change the pw_buffer was held onto until the filesink at the end of the pipeline. This was starving MetaScreenCastStreamSrc of pw_buffers to record new frames into, resulting in the majority of frames being missed, especially in situations in which the encoder was taking longer. Pipewire 0.3.57 via commit 1ea1d525 will allow queuing the pw_buffer early again via the `always-copy` option. This however is only a workaround until a proper solution is found in either pipewire or gstreamer that does not depend on copying the buffer contents and instead queues the pw_buffer again after videoconvert as prior to a1f33a99. Since it is not clear yet when a proper solution will arrive, this makes use of `always-copy` as a workaround for now and should be reverted once it is no longer needed. Related: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/5585 Related: https://gitlab.freedesktop.org/pipewire/pipewire/-/issues/2461 Related: https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/283 Part-of: --- js/dbusServices/screencast/screencastService.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/js/dbusServices/screencast/screencastService.js b/js/dbusServices/screencast/screencastService.js index 75ffba7c2..5ff5aff52 100644 --- a/js/dbusServices/screencast/screencastService.js +++ b/js/dbusServices/screencast/screencastService.js @@ -230,9 +230,12 @@ var Recorder = class { _ensurePipeline(nodeId) { const framerate = this._framerate; + const needsCopy = + Gst.Registry.get().check_feature_version('pipewiresrc', 0, 3, 57); let fullPipeline = ` pipewiresrc path=${nodeId} + always-copy=${needsCopy} do-timestamp=true keepalive-time=1000 resend-last=true !