Do not emit "change" events if attribute did not change
"change:XXX" events should be emitted only if XXX actually changed. In
most cases the duplicated events were not a problem, but when background
blur was enabled in a call with more than 5 participants it could cause
the browser to crash.
SentVideoQualityThrottler starts listening to events when video becomes
available, so if "change:videoAvailable(true)" was emitted again the
event handlers were duplicated. One of the handlers was set for the
"speaking" event, which causes the video quality to be adjusted if
needed. When background blur is enabled adjusting the video quality
restarts the effect, which causes the video stream to be recreated,
which in turn caused "change:videoAvailable(true)" to be emitted.
Due to all this, whenever the user spoke in a large call after another
user had spoken the event handlers for the "speaking" event were
duplicated, and each handler execution reset the background blur.
Eventually there were so many event handlers for the "speaking" event
that stopping and starting again the background blur so many times at
once temporary ate all the available memory, even if the objects would
have been garbage collected and the memory freed in a normal way later.
Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
Loading
Please register or sign in to comment