mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-10-09 03:20:48 +00:00
Support updated tgcalls
This commit is contained in:
parent
8086ea1ecb
commit
01709f6e55
@ -443,6 +443,7 @@
|
||||
"DialogList.TabTitle" = "Chats";
|
||||
"DialogList.Title" = "Chats";
|
||||
"DialogList.SearchLabel" = "Search for messages or users";
|
||||
"DialogList.SearchLabelCompact" = "Search";
|
||||
"DialogList.NoMessagesTitle" = "You have no conversations yet";
|
||||
"DialogList.NoMessagesText" = "Start messaging by pressing the pencil button in the top right corner or go to the Contacts section.";
|
||||
"DialogList.SingleTypingSuffix" = "%@ is typing";
|
||||
|
@ -1511,12 +1511,12 @@ public final class PresentationGroupCallImpl: PresentationGroupCall {
|
||||
switch joinCallResult.connectionMode {
|
||||
case .rtc:
|
||||
strongSelf.currentConnectionMode = .rtc
|
||||
strongSelf.genericCallContext?.setConnectionMode(.rtc, keepBroadcastConnectedIfWasEnabled: false)
|
||||
strongSelf.genericCallContext?.setConnectionMode(.rtc, keepBroadcastConnectedIfWasEnabled: false, isUnifiedBroadcast: false)
|
||||
strongSelf.genericCallContext?.setJoinResponse(payload: clientParams)
|
||||
case let .broadcast(isExternalStream):
|
||||
strongSelf.currentConnectionMode = .broadcast
|
||||
strongSelf.genericCallContext?.setAudioStreamData(audioStreamData: OngoingGroupCallContext.AudioStreamData(engine: strongSelf.accountContext.engine, callId: callInfo.id, accessHash: callInfo.accessHash, isExternalStream: isExternalStream))
|
||||
strongSelf.genericCallContext?.setConnectionMode(.broadcast, keepBroadcastConnectedIfWasEnabled: false)
|
||||
strongSelf.genericCallContext?.setConnectionMode(.broadcast, keepBroadcastConnectedIfWasEnabled: false, isUnifiedBroadcast: isExternalStream)
|
||||
}
|
||||
|
||||
strongSelf.updateSessionState(internalState: .established(info: joinCallResult.callInfo, connectionMode: joinCallResult.connectionMode, clientParams: clientParams, localSsrc: ssrc, initialState: joinCallResult.state), audioSessionControl: strongSelf.audioSessionControl)
|
||||
@ -1784,15 +1784,25 @@ public final class PresentationGroupCallImpl: PresentationGroupCall {
|
||||
}
|
||||
}
|
||||
|
||||
let chatPeer = self.accountContext.account.postbox.peerView(id: self.peerId)
|
||||
|> map { view -> Peer? in
|
||||
if let peer = peerViewMainPeer(view) {
|
||||
return peer
|
||||
} else {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
self.participantsContextStateDisposable.set(combineLatest(queue: .mainQueue(),
|
||||
participantsContext.state,
|
||||
participantsContext.activeSpeakers,
|
||||
self.speakingParticipantsContext.get(),
|
||||
adminIds,
|
||||
myPeer,
|
||||
chatPeer,
|
||||
accountContext.account.postbox.peerView(id: peerId),
|
||||
self.isReconnectingAsSpeakerPromise.get()
|
||||
).start(next: { [weak self] state, activeSpeakers, speakingParticipants, adminIds, myPeerAndCachedData, view, isReconnectingAsSpeaker in
|
||||
).start(next: { [weak self] state, activeSpeakers, speakingParticipants, adminIds, myPeerAndCachedData, chatPeer, view, isReconnectingAsSpeaker in
|
||||
guard let strongSelf = self else {
|
||||
return
|
||||
}
|
||||
@ -1874,6 +1884,30 @@ public final class PresentationGroupCallImpl: PresentationGroupCall {
|
||||
participants.sort(by: { GroupCallParticipantsContext.Participant.compare(lhs: $0, rhs: $1, sortAscending: state.sortAscending) })
|
||||
}
|
||||
}
|
||||
|
||||
if let chatPeer = chatPeer, !participants.contains(where: { $0.peer.id == chatPeer.id }) {
|
||||
participants.append(GroupCallParticipantsContext.Participant(
|
||||
peer: chatPeer,
|
||||
ssrc: 100,
|
||||
videoDescription: GroupCallParticipantsContext.Participant.VideoDescription(
|
||||
endpointId: "unified",
|
||||
ssrcGroups: [],
|
||||
audioSsrc: 100,
|
||||
isPaused: false
|
||||
),
|
||||
presentationDescription: nil,
|
||||
joinTimestamp: strongSelf.temporaryJoinTimestamp,
|
||||
raiseHandRating: nil,
|
||||
hasRaiseHand: false,
|
||||
activityTimestamp: nil,
|
||||
activityRank: nil,
|
||||
muteState: GroupCallParticipantsContext.Participant.MuteState(canUnmute: false, mutedByYou: false),
|
||||
volume: nil,
|
||||
about: nil,
|
||||
joinedVideo: false
|
||||
))
|
||||
participants.sort(by: { GroupCallParticipantsContext.Participant.compare(lhs: $0, rhs: $1, sortAscending: state.sortAscending) })
|
||||
}
|
||||
|
||||
var otherParticipantsWithVideo = 0
|
||||
var videoWatchingParticipants = 0
|
||||
@ -2691,7 +2725,7 @@ public final class PresentationGroupCallImpl: PresentationGroupCall {
|
||||
}
|
||||
let clientParams = joinCallResult.jsonParams
|
||||
|
||||
screencastCallContext.setConnectionMode(.rtc, keepBroadcastConnectedIfWasEnabled: false)
|
||||
screencastCallContext.setConnectionMode(.rtc, keepBroadcastConnectedIfWasEnabled: false, isUnifiedBroadcast: false)
|
||||
screencastCallContext.setJoinResponse(payload: clientParams)
|
||||
}, error: { error in
|
||||
guard let _ = self else {
|
||||
@ -2885,7 +2919,7 @@ public final class PresentationGroupCallImpl: PresentationGroupCall {
|
||||
if !self.didInitializeConnectionMode || self.currentConnectionMode != .none {
|
||||
self.didInitializeConnectionMode = true
|
||||
self.currentConnectionMode = .none
|
||||
self.genericCallContext?.setConnectionMode(.none, keepBroadcastConnectedIfWasEnabled: movingFromBroadcastToRtc)
|
||||
self.genericCallContext?.setConnectionMode(.none, keepBroadcastConnectedIfWasEnabled: movingFromBroadcastToRtc, isUnifiedBroadcast: false)
|
||||
}
|
||||
|
||||
self.internalState = .requesting
|
||||
|
@ -863,6 +863,13 @@ public final class GroupCallParticipantsContext {
|
||||
public var ssrcGroups: [SsrcGroup]
|
||||
public var audioSsrc: UInt32?
|
||||
public var isPaused: Bool
|
||||
|
||||
public init(endpointId: String, ssrcGroups: [SsrcGroup], audioSsrc: UInt32?, isPaused: Bool) {
|
||||
self.endpointId = endpointId
|
||||
self.ssrcGroups = ssrcGroups
|
||||
self.audioSsrc = audioSsrc
|
||||
self.isPaused = isPaused
|
||||
}
|
||||
}
|
||||
|
||||
public var peer: Peer
|
||||
|
@ -58,6 +58,8 @@ private final class NetworkBroadcastPartSource: BroadcastPartSource {
|
||||
return self.engine.calls.requestStreamState(callId: self.callId, accessHash: self.accessHash).start(next: { result in
|
||||
if let channel = result?.channels.first {
|
||||
completion(channel.latestTimestamp)
|
||||
} else {
|
||||
completion(0)
|
||||
}
|
||||
})
|
||||
} else {
|
||||
@ -124,6 +126,11 @@ private final class NetworkBroadcastPartSource: BroadcastPartSource {
|
||||
let part: OngoingGroupCallBroadcastPart
|
||||
switch result.status {
|
||||
case let .data(dataValue):
|
||||
/*#if DEBUG
|
||||
let tempFile = EngineTempBox.shared.tempFile(fileName: "part.mp4")
|
||||
let _ = try? dataValue.write(to: URL(fileURLWithPath: tempFile.path))
|
||||
print("Dump stream part: \(tempFile.path)")
|
||||
#endif*/
|
||||
part = OngoingGroupCallBroadcastPart(timestampMilliseconds: timestampIdMilliseconds, responseTimestamp: result.responseTimestamp, status: .success, oggData: dataValue)
|
||||
case .notReady:
|
||||
part = OngoingGroupCallBroadcastPart(timestampMilliseconds: timestampIdMilliseconds, responseTimestamp: result.responseTimestamp, status: .notReady, oggData: Data())
|
||||
@ -606,7 +613,7 @@ public final class OngoingGroupCallContext {
|
||||
self.context.stop()
|
||||
}
|
||||
|
||||
func setConnectionMode(_ connectionMode: ConnectionMode, keepBroadcastConnectedIfWasEnabled: Bool) {
|
||||
func setConnectionMode(_ connectionMode: ConnectionMode, keepBroadcastConnectedIfWasEnabled: Bool, isUnifiedBroadcast: Bool) {
|
||||
let mappedConnectionMode: OngoingCallConnectionMode
|
||||
switch connectionMode {
|
||||
case .none:
|
||||
@ -616,7 +623,7 @@ public final class OngoingGroupCallContext {
|
||||
case .broadcast:
|
||||
mappedConnectionMode = .broadcast
|
||||
}
|
||||
self.context.setConnectionMode(mappedConnectionMode, keepBroadcastConnectedIfWasEnabled: keepBroadcastConnectedIfWasEnabled)
|
||||
self.context.setConnectionMode(mappedConnectionMode, keepBroadcastConnectedIfWasEnabled: keepBroadcastConnectedIfWasEnabled, isUnifiedBroadcast: isUnifiedBroadcast)
|
||||
|
||||
if (mappedConnectionMode != .rtc) {
|
||||
self.joinPayload.set(.never())
|
||||
@ -900,9 +907,9 @@ public final class OngoingGroupCallContext {
|
||||
})
|
||||
}
|
||||
|
||||
public func setConnectionMode(_ connectionMode: ConnectionMode, keepBroadcastConnectedIfWasEnabled: Bool) {
|
||||
public func setConnectionMode(_ connectionMode: ConnectionMode, keepBroadcastConnectedIfWasEnabled: Bool, isUnifiedBroadcast: Bool) {
|
||||
self.impl.with { impl in
|
||||
impl.setConnectionMode(connectionMode, keepBroadcastConnectedIfWasEnabled: keepBroadcastConnectedIfWasEnabled)
|
||||
impl.setConnectionMode(connectionMode, keepBroadcastConnectedIfWasEnabled: keepBroadcastConnectedIfWasEnabled, isUnifiedBroadcast: isUnifiedBroadcast)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -354,7 +354,7 @@ typedef NS_ENUM(int32_t, OngoingGroupCallRequestedVideoQuality) {
|
||||
|
||||
- (void)stop;
|
||||
|
||||
- (void)setConnectionMode:(OngoingCallConnectionMode)connectionMode keepBroadcastConnectedIfWasEnabled:(bool)keepBroadcastConnectedIfWasEnabled;
|
||||
- (void)setConnectionMode:(OngoingCallConnectionMode)connectionMode keepBroadcastConnectedIfWasEnabled:(bool)keepBroadcastConnectedIfWasEnabled isUnifiedBroadcast:(bool)isUnifiedBroadcast;
|
||||
|
||||
- (void)emitJoinPayload:(void (^ _Nonnull)(NSString * _Nonnull, uint32_t))completion;
|
||||
- (void)setJoinResponsePayload:(NSString * _Nonnull)payload;
|
||||
|
@ -1580,7 +1580,7 @@ private:
|
||||
}
|
||||
}
|
||||
|
||||
- (void)setConnectionMode:(OngoingCallConnectionMode)connectionMode keepBroadcastConnectedIfWasEnabled:(bool)keepBroadcastConnectedIfWasEnabled {
|
||||
- (void)setConnectionMode:(OngoingCallConnectionMode)connectionMode keepBroadcastConnectedIfWasEnabled:(bool)keepBroadcastConnectedIfWasEnabled isUnifiedBroadcast:(bool)isUnifiedBroadcast {
|
||||
if (_instance) {
|
||||
tgcalls::GroupConnectionMode mappedConnectionMode;
|
||||
switch (connectionMode) {
|
||||
@ -1601,7 +1601,7 @@ private:
|
||||
break;
|
||||
}
|
||||
}
|
||||
_instance->setConnectionMode(mappedConnectionMode, keepBroadcastConnectedIfWasEnabled);
|
||||
_instance->setConnectionMode(mappedConnectionMode, keepBroadcastConnectedIfWasEnabled, isUnifiedBroadcast);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit 20860ca29147b4faa4f0b75a0da58517d9d4856c
|
||||
Subproject commit 382d1b6756768021274cb1edfc1e144cfb101fb8
|
Loading…
x
Reference in New Issue
Block a user