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: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2436>
This commit is contained in:
Sebastian Keller 2022-08-21 16:00:40 +02:00 committed by Marge Bot
parent 91ce5ca960
commit d32c03488f

View File

@ -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 !