From 2ee767ffedddd9375c8d2e3451ee59f6e198e2a7 Mon Sep 17 00:00:00 2001 From: Simo Kinnunen Date: Mon, 14 Sep 2015 20:33:29 +0900 Subject: [PATCH] Don't send manual onStart() if frameproducer's not ready. --- lib/units/device/plugins/screen/stream.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/lib/units/device/plugins/screen/stream.js b/lib/units/device/plugins/screen/stream.js index 783296d8..771fe28a 100644 --- a/lib/units/device/plugins/screen/stream.js +++ b/lib/units/device/plugins/screen/stream.js @@ -456,7 +456,16 @@ module.exports = syrup.serial() }) broadcastSet.on('insert', function(id) { - broadcastSet.get(id).onStart(frameProducer) + // If two clients join a session in the middle, one of them + // may not release the initial size because the projection + // doesn't necessarily change, and the producer doesn't Getting + // restarted. Therefore we have to call onStart() manually + // if the producer is already up and running. + switch (frameProducer.runningState) { + case FrameProducer.STATE_STARTED: + broadcastSet.get(id).onStart(frameProducer) + break + } }) display.on('rotationChange', function(newRotation) {