Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[stable23] Fix flickering with background blur when changing quality #6586

Merged
merged 3 commits into from Nov 22, 2021

Conversation

backportbot-nextcloud[bot]
Copy link

backport of #6569

Whenever a segmentation is calculated it is used to draw the input
stream to the output canvas with the background blurred. The
segmentation calculation was triggered at regular intervals, but it was
not taken into account whether a previous segmentation was still being
calculated. Now a new segmentation is calculated only if the previous
one finished already.

This prevents running outdated segmentations and thus should reduce the
load on low end devices in which calculating the segmentation for a
frame takes longer than the time elapsed between frames.

Besides that, if the input stream was changed the previous segmentation
could be processed when the new one had not finished loading yet, which
could led to visual glitches. This is also implicitly fixed by this
change, as the previous segmentation will be discarded if it does not
match the expected frame id.

Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
The segmentation was always run at 30 FPS. However, if the input stream
has a lower FPS calculating the segmentation again is a waste of
resources, as it might have not changed since the previous input frame.
Moreover, as the output stream also runs at the same FPS as the input
the canvas could be drawn without any effect in the output.

As the input stream, the calculation of the segmentation and the drawing
of a new output frame are not synchronized in some cases this could
introduce some lag between the drawn segmentation and the input video.
However, due to the lack of synchronization that could happen already
(and the fixed 30 FPS only overcomed that on lower FPS inputs by sheer
luck and brute force), and the reduced load is worth that minor
annoyance. This could be solved by synchronizing the input stream and
the segmentation mask, but that comes with its own challenges.

Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
When the constraints of the input stream were changed the background
blur was stopped and started again to apply the new width, height and
frame rate to the output. However, changing a stream (any stream, it is
unrelated to the background blur) causes a flickering (one or more black
frames in between), so every time that the sent video quality was
adjusted the local video flickered.

Now, instead of reseting the background blur, the internal elements are
updated and adjusted to the new constraints of the input, but the same
output stream is kept. This avoids the stream change and thus the
flickering. Note, however, that the video will temporary freeze instead
while the input stream is being re-rendered, although this should be
less annoying than the flickering.

Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
@nickvergessen nickvergessen merged commit 872a4f9 into stable23 Nov 22, 2021
@nickvergessen nickvergessen deleted the backport/6569/stable23 branch November 22, 2021 15:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug feature: call 📹 Voice and video calls feature: frontend 🖌️ "Web UI" client
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants