This commit is contained in:
Ali 2021-03-16 20:05:11 +04:00
parent 5f8bd57ca2
commit f260e8e550
3 changed files with 36 additions and 7 deletions

View File

@ -109,16 +109,25 @@ private func peerIdsRequiringLocalChatStateFromUpdateGroups(_ groups: [UpdateGro
for group in groups {
peerIds.formUnion(peerIdsRequiringLocalChatStateFromUpdates(group.updates))
/*for chat in group.chats {
if let channel = parseTelegramGroupOrChannel(chat: chat) as? TelegramChannel {
var channelUpdates = Set<PeerId>()
for update in group.updates {
switch update {
case let .updateChannel(channelId):
channelUpdates.insert(PeerId(namespace: Namespaces.Peer.CloudChannel, id: channelId))
default:
break
}
}
for chat in group.chats {
if let channel = parseTelegramGroupOrChannel(chat: chat) as? TelegramChannel, channelUpdates.contains(channel.id) {
if let accessHash = channel.accessHash, case .personal = accessHash {
if case .member = channel.participationStatus {
peerIds.insert(channel.id)
}
}
}
}*/
}
switch group {
case let .ensurePeerHasLocalState(peerId):

View File

@ -38,12 +38,23 @@ private final class NetworkBroadcastPartSource: BroadcastPartSource {
private let callId: Int64
private let accessHash: Int64
private var dataSource: AudioBroadcastDataSource?
#if DEBUG
private let debugDumpDirectory: TempBoxDirectory?
#endif
init(queue: Queue, account: Account, callId: Int64, accessHash: Int64) {
self.queue = queue
self.account = account
self.callId = callId
self.accessHash = accessHash
#if DEBUG
self.debugDumpDirectory = nil
/*let debugDumpDirectory = TempBox.shared.tempDirectory()
self.debugDumpDirectory = debugDumpDirectory
print("Debug streaming dump path: \(debugDumpDirectory.path)")*/
#endif
}
func requestPart(timestampMilliseconds: Int64, durationMilliseconds: Int64, completion: @escaping (OngoingGroupCallBroadcastPart) -> Void, rejoinNeeded: @escaping () -> Void) -> Disposable {
@ -60,8 +71,7 @@ private final class NetworkBroadcastPartSource: BroadcastPartSource {
} else {
dataSource = getAudioBroadcastDataSource(account: self.account, callId: self.callId, accessHash: self.accessHash)
}
let account = self.account
let callId = self.callId
let accessHash = self.accessHash
@ -79,6 +89,10 @@ private final class NetworkBroadcastPartSource: BroadcastPartSource {
}
}
|> deliverOn(self.queue)
#if DEBUG
let debugDumpDirectory = self.debugDumpDirectory
#endif
return signal.start(next: { result in
guard let result = result else {
@ -88,6 +102,12 @@ private final class NetworkBroadcastPartSource: BroadcastPartSource {
let part: OngoingGroupCallBroadcastPart
switch result.status {
case let .data(dataValue):
#if DEBUG
if let debugDumpDirectory = debugDumpDirectory {
let _ = try? dataValue.write(to: URL(fileURLWithPath: debugDumpDirectory.path + "/" + "\(timestampIdMilliseconds).ogg"))
}
#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())

@ -1 +1 @@
Subproject commit 1c16a122c5cad736c4545fd1e37539adc4c4cb52
Subproject commit e80667a343b62f6b8b2c3e0a828222096a497990