demo · v131
scaleResolutionDownBy vs scaleResolutionDownTo
The race condition: source resolution can change mid-call (browser tab resize, OS rotation). By recomputes the absolute target by multiplying. If you set By: 2 intending "640×360 always", a source resize to 1280×720 makes you 640×360 — fine. But if it resizes to 1024×768 (4:3), you get 512×384, which doesn't match the SFU's expected layer.
scaleResolutionDownBy: 2
source
scaled
scaleResolutionDownTo: {640, 360}
source
scaled