Browse Source

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

huangxiaodong 1 month ago
parent
commit
76ab58cf47
1 changed files with 15 additions and 0 deletions
  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;