浏览代码

Run simulcastlayerschanged/ing event handlers only if the affected endpoint is in lastN.

master
George Politis 11 年前
父节点
当前提交
71e290a8ad
共有 1 个文件被更改,包括 13 次插入3 次删除
  1. 13
    3
      videolayout.js

+ 13
- 3
videolayout.js 查看文件

1542
 
1542
 
1543
     $(document).bind('simulcastlayerschanging', function (event, endpointSimulcastLayers) {
1543
     $(document).bind('simulcastlayerschanging', function (event, endpointSimulcastLayers) {
1544
         endpointSimulcastLayers.forEach(function (esl) {
1544
         endpointSimulcastLayers.forEach(function (esl) {
1545
+
1546
+            var resource = esl.endpoint;
1547
+            if (lastNCount < 1 || lastNEndpointsCache.indexOf(resource) === -1) {
1548
+                return;
1549
+            }
1550
+
1545
             var primarySSRC = esl.simulcastLayer.primarySSRC;
1551
             var primarySSRC = esl.simulcastLayer.primarySSRC;
1546
 
1552
 
1547
             // Get session and stream from primary ssrc.
1553
             // Get session and stream from primary ssrc.
1589
     $(document).bind('simulcastlayerschanged', function (event, endpointSimulcastLayers) {
1595
     $(document).bind('simulcastlayerschanged', function (event, endpointSimulcastLayers) {
1590
         endpointSimulcastLayers.forEach(function (esl) {
1596
         endpointSimulcastLayers.forEach(function (esl) {
1591
 
1597
 
1598
+            var resource = esl.endpoint;
1599
+            if (lastNCount < 1 || lastNEndpointsCache.indexOf(resource) === -1) {
1600
+                return;
1601
+            }
1602
+
1592
             var primarySSRC = esl.simulcastLayer.primarySSRC;
1603
             var primarySSRC = esl.simulcastLayer.primarySSRC;
1593
 
1604
 
1594
             // Get session and stream from primary ssrc.
1605
             // Get session and stream from primary ssrc.
1644
                     focusedVideoSrc = electedStreamUrl;
1655
                     focusedVideoSrc = electedStreamUrl;
1645
                 }
1656
                 }
1646
 
1657
 
1647
-                var jid = ssrc2jid[primarySSRC];
1648
                 var videoId;
1658
                 var videoId;
1649
-                if(jid == connection.emuc.myroomjid)
1659
+                if(resource == Strophe.getResourceFromJid(connection.emuc.myroomjid))
1650
                 {
1660
                 {
1651
                     videoId = "localVideoContainer";
1661
                     videoId = "localVideoContainer";
1652
                 }
1662
                 }
1653
                 else
1663
                 else
1654
                 {
1664
                 {
1655
-                    videoId = "participant_" + Strophe.getResourceFromJid(jid);
1665
+                    videoId = "participant_" + resource;
1656
                 }
1666
                 }
1657
                 var connectionIndicator = VideoLayout.connectionIndicators[videoId];
1667
                 var connectionIndicator = VideoLayout.connectionIndicators[videoId];
1658
                 if(connectionIndicator)
1668
                 if(connectionIndicator)

正在加载...
取消
保存