mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-22 22:25:57 +00:00
Video call improvements
This commit is contained in:
@@ -17,45 +17,14 @@ private func callKitIntegrationIfEnabled(_ integration: CallKitIntegration?, set
|
||||
return enabled ? integration : nil
|
||||
}
|
||||
|
||||
private func auxiliaryServers(appConfiguration: AppConfiguration) -> [CallAuxiliaryServer] {
|
||||
private func shouldEnableStunMarking(appConfiguration: AppConfiguration) -> Bool {
|
||||
guard let data = appConfiguration.data else {
|
||||
return []
|
||||
return true
|
||||
}
|
||||
guard let servers = data["rtc_servers"] as? [[String: Any]] else {
|
||||
return []
|
||||
guard let enableStunMarking = data["voip_enable_stun_marking"] as? Bool else {
|
||||
return true
|
||||
}
|
||||
var result: [CallAuxiliaryServer] = []
|
||||
for server in servers {
|
||||
guard let host = server["host"] as? String else {
|
||||
continue
|
||||
}
|
||||
guard let portString = server["port"] as? String else {
|
||||
continue
|
||||
}
|
||||
guard let username = server["username"] as? String else {
|
||||
continue
|
||||
}
|
||||
guard let password = server["password"] as? String else {
|
||||
continue
|
||||
}
|
||||
guard let port = Int(portString) else {
|
||||
continue
|
||||
}
|
||||
result.append(CallAuxiliaryServer(
|
||||
host: host,
|
||||
port: port,
|
||||
connection: .stun
|
||||
))
|
||||
result.append(CallAuxiliaryServer(
|
||||
host: host,
|
||||
port: port,
|
||||
connection: .turn(
|
||||
username: username,
|
||||
password: password
|
||||
)
|
||||
))
|
||||
}
|
||||
return result
|
||||
return enableStunMarking
|
||||
}
|
||||
|
||||
private enum CurrentCall {
|
||||
@@ -309,11 +278,12 @@ public final class PresentationCallManagerImpl: PresentationCallManager {
|
||||
isOutgoing: false,
|
||||
peer: firstState.1,
|
||||
proxyServer: strongSelf.proxyServer,
|
||||
auxiliaryServers: auxiliaryServers(appConfiguration: appConfiguration),
|
||||
auxiliaryServers: [],
|
||||
currentNetworkType: firstState.4,
|
||||
updatedNetworkType: firstState.0.networkType,
|
||||
startWithVideo: firstState.2.isVideo,
|
||||
isVideoPossible: firstState.2.isVideoPossible,
|
||||
enableStunMarking: shouldEnableStunMarking(appConfiguration: appConfiguration),
|
||||
preferredVideoCodec: experimentalSettings.preferredVideoCodec
|
||||
)
|
||||
strongSelf.updateCurrentCall(call)
|
||||
@@ -551,11 +521,12 @@ public final class PresentationCallManagerImpl: PresentationCallManager {
|
||||
isOutgoing: true,
|
||||
peer: nil,
|
||||
proxyServer: strongSelf.proxyServer,
|
||||
auxiliaryServers: auxiliaryServers(appConfiguration: appConfiguration),
|
||||
auxiliaryServers: [],
|
||||
currentNetworkType: currentNetworkType,
|
||||
updatedNetworkType: account.networkType,
|
||||
startWithVideo: isVideo,
|
||||
isVideoPossible: isVideoPossible,
|
||||
enableStunMarking: shouldEnableStunMarking(appConfiguration: appConfiguration),
|
||||
preferredVideoCodec: experimentalSettings.preferredVideoCodec
|
||||
)
|
||||
strongSelf.updateCurrentCall(call)
|
||||
|
||||
Reference in New Issue
Block a user