浏览代码

1.修复最佳机房下线后 新的机房ping的时间较长 没有切换到新机房的问题

huangxiaodong 1 月之前
父节点
当前提交
76ab58cf47
共有 1 个文件被更改,包括 15 次插入0 次删除
  1. 15 0
      创维盒子/code/webRtc/webRtcPingManager/webRtcPingManager.m

+ 15 - 0
创维盒子/code/webRtc/webRtcPingManager/webRtcPingManager.m

@@ -155,7 +155,22 @@
         
         webrtcServerModel*preBestModel = ksharedAppDelegate.bestWebrtcServerModel;
         
+        //判断原来最佳机房是否还在线
+        BOOL isBestOnLinnType  = NO;
         NSArray<webrtcServerModel>* webrtcServerList = ksharedAppDelegate.DeviceWebRtcMsgMod.data.webrtcServerList;
+        
+        for (webrtcServerModel*model in webrtcServerList) {
+            if ([model.turnIp isEqualToString:preBestModel.turnIp]) {
+                isBestOnLinnType = YES;
+                break;
+            }
+        }
+        
+        if (!isBestOnLinnType) {
+            ksharedAppDelegate.bestWebrtcServerModel = webrtcServerList.firstObject;
+        }
+        
+        
         if (!webrtcServerList || webrtcServerList.count > pingRoomIndex) {
             webrtcServerModel *model = webrtcServerList[pingRoomIndex];
             model.delayedms = averageDelayedms;