From 37bb4b82adcbf9daa8ded3fdb939895b45f4fb3b Mon Sep 17 00:00:00 2001 From: George Politis Date: Fri, 28 Nov 2014 17:00:16 +0100 Subject: [PATCH] Fixes issue introduced by 71e290a8ad78daa2873a12fb89148c9cbf08d2c5. simulcastlayerschanged/ing should run if lastN is disabled. --- videolayout.js | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/videolayout.js b/videolayout.js index e6915be0d..f375934a1 100644 --- a/videolayout.js +++ b/videolayout.js @@ -1640,7 +1640,15 @@ var VideoLayout = (function (my) { endpointSimulcastLayers.forEach(function (esl) { var resource = esl.endpoint; - if (lastNCount < 1 || lastNEndpointsCache.indexOf(resource) === -1) { + + // if lastN is enabled *and* the endpoint is *not* in the lastN set, + // then ignore the event (= do not preload anything). + // + // The bridge could probably stop sending this message if it's for + // an endpoint that's not in lastN. + + if (lastNCount != -1 + && (lastNCount < 1 || lastNEndpointsCache.indexOf(resource) === -1)) { return; } @@ -1692,7 +1700,19 @@ var VideoLayout = (function (my) { endpointSimulcastLayers.forEach(function (esl) { var resource = esl.endpoint; - if (lastNCount < 1 || lastNEndpointsCache.indexOf(resource) === -1) { + + // if lastN is enabled *and* the endpoint is *not* in the lastN set, + // then ignore the event (= do not change large video/thumbnail + // SRCs). + // + // Note that even if we ignore the "changing" event in this event + // handler, the bridge must continue sending these events because + // the simulcast code in simulcast.js handles it to know what's + // going to be streamed by the bridge when/if the endpoint gets back + // into the lastN set. + + if (lastNCount != -1 + && (lastNCount < 1 || lastNEndpointsCache.indexOf(resource) === -1)) { return; }