Skip to content
Commit 7b800721 authored by Daniel Calviño Sánchez's avatar Daniel Calviño Sánchez
Browse files

Fix background blur mask not synchronized with video



The input track is played in a video element which, in turn, is drawn on
the canvas used to calculate the segmentation mask and on the output
canvas. However, the segmentation mask canvas is drawn first, then the
segmentation mask is calculated, and then once the calculation is
finished the mask it used to draw the video on the output canvas. The
mask calculation is done in a worker and thus asynchronously, so when
the resulting mask is received the input video might be in a different
frame than the one used to calculate the mask.

To solve this now a snapshot of the input video is taken when the
segmentation mask is calculated, and that snapshot, instead of the real
video, is then used to draw on the output canvas.

Due to this now the video with the blurred background might lag some
frames behind the actual video, although now the blur should "exactly"
match only the background.

Signed-off-by: default avatarDaniel Calviño Sánchez <danxuliu@gmail.com>
parent e3567fa7
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment