Browse Source

Fix infinite loop when the frame rate can not be decreased

The previous minimum frame rate was wrongly got from the maximum frame
rate, so when the minimum frame rate was compared after decreasing it it
was always seen as changed. Due to this the constraints will be applied
again even if they did not actually change due to having reached the
minimum capped value, which would end in an infinite loop if the
constraints could not be applied and the minimum frame rate was (tried
to be) decreased again.

However, note that the scenario above was unlikely to happen in the real
world, as the browsers would likely accept the minimum capped value for
the frame rate of 1. The problem would occur if the stream did not come
from a device (even virtual ones) but from an HTML canvas or something
similar that does not allow to change the constraints.

Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
pull/6101/head
Daniel Calviño Sánchez 4 years ago
parent
commit
88356923cc
  1. 2
      src/utils/webrtc/VideoConstrainer.js

2
src/utils/webrtc/VideoConstrainer.js

@ -297,7 +297,7 @@ VideoConstrainer.prototype = {
let changed = false
if (constraints.frameRate && constraints.frameRate.min) {
const previousFrameRateMin = constraints.frameRate.max
const previousFrameRateMin = constraints.frameRate.min
constraints.frameRate.min = Math.min(Math.round(constraints.frameRate.min / 1.5), 1)
changed = previousFrameRateMin !== constraints.frameRate.min
}

Loading…
Cancel
Save