Limit the segmentation rate to the stream frame rate
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>
Loading
Please register or sign in to comment