李勇

1.修改MS和MCU默认选点的逻辑,如果测速失败的时候,默认选择列表中的第一个地址,不再随机选择

@@ -58,7 +58,7 @@ export default class MessageEntrance extends Emiter { @@ -58,7 +58,7 @@ export default class MessageEntrance extends Emiter {
58 constructor() { 58 constructor() {
59 super(); 59 super();
60 //sdk 信息 60 //sdk 信息
61 - GlobalConfig.sdkVersion = "v1.82.11.20170829"; 61 + GlobalConfig.sdkVersion = "v1.83.2.20170831";
62 loger.warn("sdkVersion:" + GlobalConfig.sdkVersion); 62 loger.warn("sdkVersion:" + GlobalConfig.sdkVersion);
63 63
64 //设置 64 //设置
@@ -1682,6 +1682,9 @@ export default class MessageEntrance extends Emiter { @@ -1682,6 +1682,9 @@ export default class MessageEntrance extends Emiter {
1682 if (GlobalConfig.mcuListFinal && GlobalConfig.mcuListFinal.length > 0) { 1682 if (GlobalConfig.mcuListFinal && GlobalConfig.mcuListFinal.length > 0) {
1683 //还未开始选点之前随机选择一个 1683 //还未开始选点之前随机选择一个
1684 let index = parseInt(Math.random() * GlobalConfig.mcuListFinal.length); 1684 let index = parseInt(Math.random() * GlobalConfig.mcuListFinal.length);
  1685 + if(!GlobalConfig.MCUServerIP){
  1686 + index=0;
  1687 + }
1685 GlobalConfig.MCUServerIP = GlobalConfig.mcuListFinal[index].ip || ""; 1688 GlobalConfig.MCUServerIP = GlobalConfig.mcuListFinal[index].ip || "";
1686 GlobalConfig.MCUServerPort = GlobalConfig.mcuListFinal[index].port || ""; 1689 GlobalConfig.MCUServerPort = GlobalConfig.mcuListFinal[index].port || "";
1687 } 1690 }
@@ -1690,6 +1693,9 @@ export default class MessageEntrance extends Emiter { @@ -1690,6 +1693,9 @@ export default class MessageEntrance extends Emiter {
1690 if (GlobalConfig.rsPullListFinal && GlobalConfig.rsPullListFinal.length > 0) { 1693 if (GlobalConfig.rsPullListFinal && GlobalConfig.rsPullListFinal.length > 0) {
1691 //还未开始选点之前随机选择一个 1694 //还未开始选点之前随机选择一个
1692 let index = parseInt(Math.random() * GlobalConfig.rsPullListFinal.length); 1695 let index = parseInt(Math.random() * GlobalConfig.rsPullListFinal.length);
  1696 + if(!GlobalConfig.RS_RECORD_PLAY_IP){
  1697 + index=0;
  1698 + }
1693 GlobalConfig.RS_RECORD_PLAY_IP = GlobalConfig.rsPullListFinal[index].ip || ""; 1699 GlobalConfig.RS_RECORD_PLAY_IP = GlobalConfig.rsPullListFinal[index].ip || "";
1694 GlobalConfig.RS_RECORD_PLAY_PORT = GlobalConfig.rsPullListFinal[index].port || ""; 1700 GlobalConfig.RS_RECORD_PLAY_PORT = GlobalConfig.rsPullListFinal[index].port || "";
1695 } 1701 }
@@ -1698,6 +1704,9 @@ export default class MessageEntrance extends Emiter { @@ -1698,6 +1704,9 @@ export default class MessageEntrance extends Emiter {
1698 if (GlobalConfig.msListFinal && GlobalConfig.msListFinal.length > 0) { 1704 if (GlobalConfig.msListFinal && GlobalConfig.msListFinal.length > 0) {
1699 //还未开始选点之前随机选择一个 1705 //还未开始选点之前随机选择一个
1700 let index = parseInt(Math.random() * GlobalConfig.msListFinal.length); 1706 let index = parseInt(Math.random() * GlobalConfig.msListFinal.length);
  1707 + if(!GlobalConfig.MS_PUBLISH_IP){
  1708 + index=0;
  1709 + }
1701 GlobalConfig.MS_PUBLISH_IP = GlobalConfig.msListFinal[index].ip || ""; 1710 GlobalConfig.MS_PUBLISH_IP = GlobalConfig.msListFinal[index].ip || "";
1702 GlobalConfig.MS_PUBLISH_PORT = GlobalConfig.msListFinal[index].port || ""; 1711 GlobalConfig.MS_PUBLISH_PORT = GlobalConfig.msListFinal[index].port || "";
1703 } 1712 }
@@ -1706,6 +1715,9 @@ export default class MessageEntrance extends Emiter { @@ -1706,6 +1715,9 @@ export default class MessageEntrance extends Emiter {
1706 if (GlobalConfig.rtmpPullListFinal && GlobalConfig.rtmpPullListFinal.length > 0) { 1715 if (GlobalConfig.rtmpPullListFinal && GlobalConfig.rtmpPullListFinal.length > 0) {
1707 // //还未开始选点之前随机选择一个 1716 // //还未开始选点之前随机选择一个
1708 let index = parseInt(Math.random() * GlobalConfig.rtmpPullListFinal.length); 1717 let index = parseInt(Math.random() * GlobalConfig.rtmpPullListFinal.length);
  1718 + if(!GlobalConfig.MS_PLAY_RTMP_IP){
  1719 + index=0;
  1720 + }
1709 GlobalConfig.MS_PLAY_RTMP_IP = GlobalConfig.rtmpPullListFinal[index].ip || ""; 1721 GlobalConfig.MS_PLAY_RTMP_IP = GlobalConfig.rtmpPullListFinal[index].ip || "";
1710 GlobalConfig.MS_PLAY_RTMP_PORT = GlobalConfig.rtmpPullListFinal[index].port || ""; 1722 GlobalConfig.MS_PLAY_RTMP_PORT = GlobalConfig.rtmpPullListFinal[index].port || "";
1711 } else { 1723 } else {
@@ -1718,6 +1730,9 @@ export default class MessageEntrance extends Emiter { @@ -1718,6 +1730,9 @@ export default class MessageEntrance extends Emiter {
1718 if (GlobalConfig.hlsPullListFinal && GlobalConfig.hlsPullListFinal.length > 0) { 1730 if (GlobalConfig.hlsPullListFinal && GlobalConfig.hlsPullListFinal.length > 0) {
1719 //有单独的hls拉流地址 1731 //有单独的hls拉流地址
1720 let index = parseInt(Math.random() * GlobalConfig.hlsPullListFinal.length); 1732 let index = parseInt(Math.random() * GlobalConfig.hlsPullListFinal.length);
  1733 + if(!GlobalConfig.MS_PLAY_HLS_IP){
  1734 + index=0;
  1735 + }
1721 GlobalConfig.MS_PLAY_HLS_IP = GlobalConfig.hlsPullListFinal[index].ip || ""; 1736 GlobalConfig.MS_PLAY_HLS_IP = GlobalConfig.hlsPullListFinal[index].ip || "";
1722 GlobalConfig.MS_PLAY_HLS_PORT = GlobalConfig.hlsPullListFinal[index].port || ""; 1737 GlobalConfig.MS_PLAY_HLS_PORT = GlobalConfig.hlsPullListFinal[index].port || "";
1723 } else { 1738 } else {
@@ -3,7 +3,6 @@ @@ -3,7 +3,6 @@
3 * */ 3 * */
4 import Loger from 'Loger'; 4 import Loger from 'Loger';
5 import ApeConsts from "apes/ApeConsts"; 5 import ApeConsts from "apes/ApeConsts";
6 -  
7 let loger = Loger.getLoger('GlobalConfig'); 6 let loger = Loger.getLoger('GlobalConfig');
8 import EngineUtils from 'EngineUtils'; 7 import EngineUtils from 'EngineUtils';
9 8
@@ -241,31 +240,6 @@ class GlobalConfig { @@ -241,31 +240,6 @@ class GlobalConfig {
241 static setMsList(_data) { 240 static setMsList(_data) {
242 if (_data == null) return; 241 if (_data == null) return;
243 this.msList = _data; 242 this.msList = _data;
244 - //MSlist列表中的地址需要进行筛选,目前有的站点播流和推流需要分开  
245 - /* if (GlobalConfig.siteId == GlobalConfig.siteId_letv) {  
246 - this.msList = [];  
247 - this.rtmpPullListFinal = [];  
248 - this.hlsListFinal = [];  
249 - let len = _data.length;  
250 - for (let i = 0; i < len; i++) {  
251 - let item = _data[i];  
252 - if (item && item.ip) {  
253 - if (item.ip.indexOf('pull.') >= 0) {  
254 - this.rtmpPullListFinal.push(item);  
255 - } else if (item.ip.indexOf('lehls.') >= 0) {  
256 - this.hlsListFinal.push(item);  
257 - } else {  
258 - this.msList.push(item);  
259 - }  
260 - }  
261 - }  
262 - loger.log("msListAll->", _data);  
263 - loger.log("msList->", this.msList);  
264 - loger.log("pullList->", this.rtmpPullListFinal);  
265 - loger.log("hlsList->", this.hlsListFinal);  
266 - } else {  
267 - this.msList = _data;  
268 - }*/  
269 } 243 }
270 static getMsList() { 244 static getMsList() {
271 return this.msList; 245 return this.msList;
@@ -70,30 +70,29 @@ class ShareApe extends Emiter { @@ -70,30 +70,29 @@ class ShareApe extends Emiter {
70 // 屏幕共享开始 70 // 屏幕共享开始
71 this.shareScreen.on(ShareScreen.SS_START, () => { 71 this.shareScreen.on(ShareScreen.SS_START, () => {
72 //调用startShareScreen 成功 72 //调用startShareScreen 成功
73 - console.log('屏幕共享开始开启'); 73 + loger.log('屏幕共享开始开启');
74 this._emit(MessageTypes.PUBLISH_SCREEN_SHARE_SUCCESS); 74 this._emit(MessageTypes.PUBLISH_SCREEN_SHARE_SUCCESS);
75 }) 75 })
76 // 屏幕共享关闭 76 // 屏幕共享关闭
77 this.shareScreen.on(ShareScreen.SS_STOP, () => { 77 this.shareScreen.on(ShareScreen.SS_STOP, () => {
78 //调用startShareScreen 失败 78 //调用startShareScreen 失败
79 - console.log('屏幕共享开启失败'); 79 + loger.log('屏幕共享开启失败');
80 this._emit(MessageTypes.PUBLISH_SCREEN_SHARE_FAILE); 80 this._emit(MessageTypes.PUBLISH_SCREEN_SHARE_FAILE);
81 }) 81 })
82 82
83 // 发生错误 -- 无法连接本地服务 83 // 发生错误 -- 无法连接本地服务
84 this.shareScreen.on(ShareScreen.ERROR, () => { 84 this.shareScreen.on(ShareScreen.ERROR, () => {
85 - console.log('无法连接本地服务-ERROR'); 85 + loger.log('无法连接本地服务-ERROR');
86 /* this.isConnect=false; 86 /* this.isConnect=false;
87 this._emit(MessageTypes.PUBLISH_SCREEN_SHARE_DISCONNECT); 87 this._emit(MessageTypes.PUBLISH_SCREEN_SHARE_DISCONNECT);
88 this.reConnectTimer=setTimeout(()=>{ 88 this.reConnectTimer=setTimeout(()=>{
89 this.startConnectSocket(); 89 this.startConnectSocket();
90 },1400);*/ 90 },1400);*/
91 -  
92 }) 91 })
93 92
94 // 服务关闭 这个监听暂时不需要,使用ERROR监听即可 93 // 服务关闭 这个监听暂时不需要,使用ERROR监听即可
95 this.shareScreen.on(ShareScreen.CLOSE, () => { 94 this.shareScreen.on(ShareScreen.CLOSE, () => {
96 - console.log('屏幕共享服务-CLOSE->重连'); 95 + loger.log('屏幕共享服务-CLOSE->重连');
97 //1秒后继续重连 96 //1秒后继续重连
98 this.isConnect = false; 97 this.isConnect = false;
99 this._emit(MessageTypes.PUBLISH_SCREEN_SHARE_DISCONNECT); 98 this._emit(MessageTypes.PUBLISH_SCREEN_SHARE_DISCONNECT);
@@ -104,7 +103,7 @@ class ShareApe extends Emiter { @@ -104,7 +103,7 @@ class ShareApe extends Emiter {
104 103
105 // 服务开启 104 // 服务开启
106 this.shareScreen.on(ShareScreen.OPEN, () => { 105 this.shareScreen.on(ShareScreen.OPEN, () => {
107 - console.log('屏幕共享服务开启-OPEN'); 106 + loger.log('屏幕共享服务开启-OPEN');
108 this.isConnect = true; 107 this.isConnect = true;
109 this._emit(MessageTypes.PUBLISH_SCREEN_SHARE_CONNECTED); 108 this._emit(MessageTypes.PUBLISH_SCREEN_SHARE_CONNECTED);
110 //连接成功 109 //连接成功
@@ -130,6 +129,7 @@ class ShareApe extends Emiter { @@ -130,6 +129,7 @@ class ShareApe extends Emiter {
130 } else { 129 } else {
131 this.fullIpPort = GlobalConfig.websocketProtocol + this.ip; 130 this.fullIpPort = GlobalConfig.websocketProtocol + this.ip;
132 } 131 }
  132 + loger.log("屏幕共享连接:",GlobalConfig.isHttps,this.port,GlobalConfig.websocketProtocol,this.fullIpPort);
133 if (GlobalConfig.isHttps == true) { 133 if (GlobalConfig.isHttps == true) {
134 //https的时候替换所有80端口 134 //https的时候替换所有80端口
135 this.fullIpPort = GlobalConfig.replacePort(this.fullIpPort, ":80", ""); 135 this.fullIpPort = GlobalConfig.replacePort(this.fullIpPort, ":80", "");
@@ -151,18 +151,9 @@ class ShareApe extends Emiter { @@ -151,18 +151,9 @@ class ShareApe extends Emiter {
151 if (_result) { 151 if (_result) {
152 this.publishUrl = _result.publishUrl || ''; 152 this.publishUrl = _result.publishUrl || '';
153 this.streamId = _result.streamId || ''; 153 this.streamId = _result.streamId || '';
154 - /* this.port=_result.port;  
155 - if(!this.port){  
156 - if(GlobalConfig.isHttps){  
157 - this.port= this.defaultWssPort;  
158 - }else {  
159 - this.port= this.defaultWsPort;  
160 - }  
161 - }  
162 -  
163 - this.ip=_result.ip||this.defaultIp;*/  
164 } 154 }
165 clearTimeout(this.reConnectTimer); 155 clearTimeout(this.reConnectTimer);
  156 +
166 if (!this.isConnect) { 157 if (!this.isConnect) {
167 //还没有连接,需要先连接 158 //还没有连接,需要先连接
168 this.startConnectSocket() 159 this.startConnectSocket()
@@ -449,7 +449,7 @@ class VideoApe extends Ape { @@ -449,7 +449,7 @@ class VideoApe extends Ape {
449 adapterPdu.type = pdu.RCPDU_REG_ADAPTER; 449 adapterPdu.type = pdu.RCPDU_REG_ADAPTER;
450 adapterPdu.item.push(adapterItemPdu); 450 adapterPdu.item.push(adapterItemPdu);
451 451
452 - loger.log("发送更新VIDEO.itemIdx=" + tableItemPdu.itemIdx); 452 + loger.log("发送更新VIDEO " + tableItemPdu.itemIdx);
453 this.sendUniform(adapterPdu, true); 453 this.sendUniform(adapterPdu, true);
454 } 454 }
455 455