mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
P2P-over-group experiment
This commit is contained in:
parent
4ac6d40d44
commit
1bcc21aedb
@ -36,8 +36,6 @@ public final class PresentationCallImpl: PresentationCall {
|
|||||||
public let preferredVideoCodec: String?
|
public let preferredVideoCodec: String?
|
||||||
public let peer: EnginePeer?
|
public let peer: EnginePeer?
|
||||||
|
|
||||||
private let isExpectedToBeConference: Bool
|
|
||||||
|
|
||||||
private let serializedData: String?
|
private let serializedData: String?
|
||||||
private let dataSaving: VoiceCallDataSaving
|
private let dataSaving: VoiceCallDataSaving
|
||||||
private let proxyServer: ProxyServerSettings?
|
private let proxyServer: ProxyServerSettings?
|
||||||
@ -213,8 +211,6 @@ public final class PresentationCallImpl: PresentationCall {
|
|||||||
self.currentNetworkType = currentNetworkType
|
self.currentNetworkType = currentNetworkType
|
||||||
self.updatedNetworkType = updatedNetworkType
|
self.updatedNetworkType = updatedNetworkType
|
||||||
|
|
||||||
self.isExpectedToBeConference = self.context.sharedContext.immediateExperimentalUISettings.conferenceCalls
|
|
||||||
|
|
||||||
var didReceiveAudioOutputs = false
|
var didReceiveAudioOutputs = false
|
||||||
|
|
||||||
var callSessionState: Signal<CallSession, NoError> = .complete()
|
var callSessionState: Signal<CallSession, NoError> = .complete()
|
||||||
@ -326,18 +322,6 @@ public final class PresentationCallImpl: PresentationCall {
|
|||||||
self.proximityManagerIndex = DeviceProximityManager.shared().add { _ in
|
self.proximityManagerIndex = DeviceProximityManager.shared().add { _ in
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if self.isExpectedToBeConference {
|
|
||||||
self.conferenceSignalingDataDisposable = self.context.account.callSessionManager.beginReceivingCallSignalingData(internalId: self.internalId, { [weak self] dataList in
|
|
||||||
Queue.mainQueue().async {
|
|
||||||
guard let self else {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
self.processConferenceSignalingData(dataList: dataList)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
deinit {
|
deinit {
|
||||||
@ -554,6 +538,14 @@ public final class PresentationCallImpl: PresentationCall {
|
|||||||
presentationState = PresentationCallState(state: .requesting(ringing), videoState: mappedVideoState, remoteVideoState: mappedRemoteVideoState, remoteAudioState: mappedRemoteAudioState, remoteBatteryLevel: mappedRemoteBatteryLevel)
|
presentationState = PresentationCallState(state: .requesting(ringing), videoState: mappedVideoState, remoteVideoState: mappedRemoteVideoState, remoteAudioState: mappedRemoteAudioState, remoteBatteryLevel: mappedRemoteBatteryLevel)
|
||||||
case let .active(_, _, keyVisualHash, _, _, _, _, _, _), let .switchedToConference(_, keyVisualHash, _):
|
case let .active(_, _, keyVisualHash, _, _, _, _, _, _), let .switchedToConference(_, keyVisualHash, _):
|
||||||
self.callWasActive = true
|
self.callWasActive = true
|
||||||
|
|
||||||
|
var isConference = false
|
||||||
|
if case let .active(_, _, _, _, _, version, _, _, _) = sessionState.state {
|
||||||
|
isConference = version == "13.0.0"
|
||||||
|
} else if case .switchedToConference = sessionState.state {
|
||||||
|
isConference = true
|
||||||
|
}
|
||||||
|
|
||||||
if let callContextState = callContextState {
|
if let callContextState = callContextState {
|
||||||
switch callContextState.state {
|
switch callContextState.state {
|
||||||
case .initializing:
|
case .initializing:
|
||||||
@ -580,7 +572,7 @@ public final class PresentationCallImpl: PresentationCall {
|
|||||||
}
|
}
|
||||||
presentationState = PresentationCallState(state: .reconnecting(timestamp, reception, keyVisualHash), videoState: mappedVideoState, remoteVideoState: mappedRemoteVideoState, remoteAudioState: mappedRemoteAudioState, remoteBatteryLevel: mappedRemoteBatteryLevel)
|
presentationState = PresentationCallState(state: .reconnecting(timestamp, reception, keyVisualHash), videoState: mappedVideoState, remoteVideoState: mappedRemoteVideoState, remoteAudioState: mappedRemoteAudioState, remoteBatteryLevel: mappedRemoteBatteryLevel)
|
||||||
}
|
}
|
||||||
} else if !self.isExpectedToBeConference {
|
} else if !isConference {
|
||||||
presentationState = PresentationCallState(state: .connecting(keyVisualHash), videoState: mappedVideoState, remoteVideoState: mappedRemoteVideoState, remoteAudioState: mappedRemoteAudioState, remoteBatteryLevel: mappedRemoteBatteryLevel)
|
presentationState = PresentationCallState(state: .connecting(keyVisualHash), videoState: mappedVideoState, remoteVideoState: mappedRemoteVideoState, remoteAudioState: mappedRemoteAudioState, remoteBatteryLevel: mappedRemoteBatteryLevel)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -668,8 +660,7 @@ public final class PresentationCallImpl: PresentationCall {
|
|||||||
conferenceCall.hasActiveIncomingData
|
conferenceCall.hasActiveIncomingData
|
||||||
)
|
)
|
||||||
|> map { remoteConferenceIsConnected, hasActiveIncomingData -> Bool in
|
|> map { remoteConferenceIsConnected, hasActiveIncomingData -> Bool in
|
||||||
//return remoteConferenceIsConnected || hasActiveIncomingData
|
return remoteConferenceIsConnected || hasActiveIncomingData
|
||||||
return true
|
|
||||||
}
|
}
|
||||||
|> distinctUntilChanged
|
|> distinctUntilChanged
|
||||||
|
|
||||||
@ -764,7 +755,7 @@ public final class PresentationCallImpl: PresentationCall {
|
|||||||
}
|
}
|
||||||
if !self.didDropCall {
|
if !self.didDropCall {
|
||||||
self.didDropCall = true
|
self.didDropCall = true
|
||||||
self.callSessionManager.drop(internalId: self.internalId, reason: .disconnect, debugLog: .single(nil))
|
self.callSessionManager.drop(internalId: self.internalId, reason: .hangUp, debugLog: .single(nil))
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -805,13 +796,25 @@ public final class PresentationCallImpl: PresentationCall {
|
|||||||
self.audioSessionShouldBeActive.set(true)
|
self.audioSessionShouldBeActive.set(true)
|
||||||
}
|
}
|
||||||
case let .active(id, key, _, connections, maxLayer, version, customParameters, allowsP2P, conferenceCall):
|
case let .active(id, key, _, connections, maxLayer, version, customParameters, allowsP2P, conferenceCall):
|
||||||
if conferenceCall == nil, self.isExpectedToBeConference {
|
if conferenceCall == nil, version == "13.0.0" {
|
||||||
self.createConferenceIfPossible()
|
self.createConferenceIfPossible()
|
||||||
}
|
}
|
||||||
|
|
||||||
self.audioSessionShouldBeActive.set(true)
|
self.audioSessionShouldBeActive.set(true)
|
||||||
|
|
||||||
if self.isExpectedToBeConference || conferenceCallData != nil {
|
if version == "13.0.0" && self.conferenceSignalingDataDisposable == nil {
|
||||||
|
self.conferenceSignalingDataDisposable = self.context.account.callSessionManager.beginReceivingCallSignalingData(internalId: self.internalId, { [weak self] dataList in
|
||||||
|
Queue.mainQueue().async {
|
||||||
|
guard let self else {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
self.processConferenceSignalingData(dataList: dataList)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
if version == "13.0.0" || conferenceCallData != nil {
|
||||||
if sessionState.isOutgoing {
|
if sessionState.isOutgoing {
|
||||||
self.callKitIntegration?.reportOutgoingCallConnected(uuid: sessionState.id, at: Date())
|
self.callKitIntegration?.reportOutgoingCallConnected(uuid: sessionState.id, at: Date())
|
||||||
}
|
}
|
||||||
@ -1112,9 +1115,9 @@ public final class PresentationCallImpl: PresentationCall {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private func sendConferenceSignalingMessage(dict: [String: Any]) {
|
private func sendConferenceSignalingMessage(dict: [String: Any]) {
|
||||||
/*if let data = try? JSONSerialization.data(withJSONObject: dict) {
|
if let data = try? JSONSerialization.data(withJSONObject: dict) {
|
||||||
self.context.account.callSessionManager.sendSignalingData(internalId: self.internalId, data: data)
|
self.context.account.callSessionManager.sendSignalingData(internalId: self.internalId, data: data)
|
||||||
}*/
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private func updateIsAudioSessionActive(_ value: Bool) {
|
private func updateIsAudioSessionActive(_ value: Bool) {
|
||||||
|
@ -1712,9 +1712,6 @@ public final class PresentationGroupCallImpl: PresentationGroupCall {
|
|||||||
|
|
||||||
var encryptionKey: Data?
|
var encryptionKey: Data?
|
||||||
encryptionKey = self.encryptionKey?.key
|
encryptionKey = self.encryptionKey?.key
|
||||||
if "".isEmpty {
|
|
||||||
encryptionKey = nil
|
|
||||||
}
|
|
||||||
|
|
||||||
genericCallContext = .call(OngoingGroupCallContext(audioSessionActive: self.audioSessionActive.get(), video: self.videoCapturer, requestMediaChannelDescriptions: { [weak self] ssrcs, completion in
|
genericCallContext = .call(OngoingGroupCallContext(audioSessionActive: self.audioSessionActive.get(), video: self.videoCapturer, requestMediaChannelDescriptions: { [weak self] ssrcs, completion in
|
||||||
let disposable = MetaDisposable()
|
let disposable = MetaDisposable()
|
||||||
|
@ -1 +1 @@
|
|||||||
Subproject commit ab50f4e095d5793c39dc54b740a982fc3ba27ea5
|
Subproject commit b872bbfe2ad48d07d8388905bb0bfd592e3068b1
|
Loading…
x
Reference in New Issue
Block a user