[WIP] Video chats

This commit is contained in:
Isaac
2024-08-27 21:18:57 +08:00
parent b1c3aeda82
commit f21f7f66f7
8 changed files with 633 additions and 95 deletions

View File

@@ -664,6 +664,7 @@ public final class PresentationGroupCallImpl: PresentationGroupCall {
private var ssrcMapping: [UInt32: SsrcMapping] = [:]
private var requestedVideoChannels: [OngoingGroupCallContext.VideoChannel] = []
private var suspendVideoChannelRequests: Bool = false
private var pendingVideoSubscribers = Bag<(String, MetaDisposable, (OngoingGroupCallContext.VideoFrameData) -> Void)>()
private var summaryInfoState = Promise<SummaryInfoState?>(nil)
@@ -1699,7 +1700,7 @@ public final class PresentationGroupCallImpl: PresentationGroupCall {
self.genericCallContext = genericCallContext
self.stateVersionValue += 1
genericCallContext.setRequestedVideoChannels(self.requestedVideoChannels)
genericCallContext.setRequestedVideoChannels(self.suspendVideoChannelRequests ? [] : self.requestedVideoChannels)
self.connectPendingVideoSubscribers()
}
@@ -3090,11 +3091,21 @@ public final class PresentationGroupCallImpl: PresentationGroupCall {
maxQuality: mappedMaxQuality
)
}
if let genericCallContext = self.genericCallContext {
if let genericCallContext = self.genericCallContext, !self.suspendVideoChannelRequests {
genericCallContext.setRequestedVideoChannels(self.requestedVideoChannels)
}
}
public func setSuspendVideoChannelRequests(_ value: Bool) {
if self.suspendVideoChannelRequests != value {
self.suspendVideoChannelRequests = value
if let genericCallContext = self.genericCallContext {
genericCallContext.setRequestedVideoChannels(self.suspendVideoChannelRequests ? [] : self.requestedVideoChannels)
}
}
}
public func setCurrentAudioOutput(_ output: AudioSessionOutput) {
guard self.currentSelectedAudioOutputValue != output else {
return