Experimental streaming impl

This commit is contained in:
Isaac 2024-06-27 09:38:58 +02:00
parent cecea57a24
commit 8b941d4eb8
5 changed files with 25 additions and 24 deletions

View File

@ -102,7 +102,7 @@ private enum DebugControllerEntry: ItemListNodeEntry {
case playlistPlayback(Bool) case playlistPlayback(Bool)
case enableQuickReactionSwitch(Bool) case enableQuickReactionSwitch(Bool)
case disableReloginTokens(Bool) case disableReloginTokens(Bool)
case voiceConference case liveStreamV2(Bool)
case preferredVideoCodec(Int, String, String?, Bool) case preferredVideoCodec(Int, String, String?, Bool)
case disableVideoAspectScaling(Bool) case disableVideoAspectScaling(Bool)
case enableNetworkFramework(Bool) case enableNetworkFramework(Bool)
@ -127,7 +127,7 @@ private enum DebugControllerEntry: ItemListNodeEntry {
return DebugControllerSection.web.rawValue return DebugControllerSection.web.rawValue
case .keepChatNavigationStack, .skipReadHistory, .dustEffect, .crashOnSlowQueries, .crashOnMemoryPressure: case .keepChatNavigationStack, .skipReadHistory, .dustEffect, .crashOnSlowQueries, .crashOnMemoryPressure:
return DebugControllerSection.experiments.rawValue return DebugControllerSection.experiments.rawValue
case .clearTips, .resetNotifications, .crash, .fillLocalSavedMessageCache, .resetDatabase, .resetDatabaseAndCache, .resetHoles, .resetTagHoles, .reindexUnread, .resetCacheIndex, .reindexCache, .resetBiometricsData, .optimizeDatabase, .photoPreview, .knockoutWallpaper, .storiesExperiment, .storiesJpegExperiment, .playlistPlayback, .enableQuickReactionSwitch, .voiceConference, .experimentalCompatibility, .enableDebugDataDisplay, .acceleratedStickers, .browserExperiment, .localTranscription, .enableReactionOverrides, .restorePurchases, .disableReloginTokens: case .clearTips, .resetNotifications, .crash, .fillLocalSavedMessageCache, .resetDatabase, .resetDatabaseAndCache, .resetHoles, .resetTagHoles, .reindexUnread, .resetCacheIndex, .reindexCache, .resetBiometricsData, .optimizeDatabase, .photoPreview, .knockoutWallpaper, .storiesExperiment, .storiesJpegExperiment, .playlistPlayback, .enableQuickReactionSwitch, .experimentalCompatibility, .enableDebugDataDisplay, .acceleratedStickers, .browserExperiment, .localTranscription, .enableReactionOverrides, .restorePurchases, .disableReloginTokens, .liveStreamV2:
return DebugControllerSection.experiments.rawValue return DebugControllerSection.experiments.rawValue
case .logTranslationRecognition, .resetTranslationStates: case .logTranslationRecognition, .resetTranslationStates:
return DebugControllerSection.translation.rawValue return DebugControllerSection.translation.rawValue
@ -240,7 +240,7 @@ private enum DebugControllerEntry: ItemListNodeEntry {
return 49 return 49
case .enableQuickReactionSwitch: case .enableQuickReactionSwitch:
return 50 return 50
case .voiceConference: case .liveStreamV2:
return 51 return 51
case let .preferredVideoCodec(index, _, _, _): case let .preferredVideoCodec(index, _, _, _):
return 52 + index return 52 + index
@ -1312,11 +1312,15 @@ private enum DebugControllerEntry: ItemListNodeEntry {
}) })
}).start() }).start()
}) })
case .voiceConference: case let .liveStreamV2(value):
return ItemListDisclosureItem(presentationData: presentationData, title: "Voice Conference (Test)", label: "", sectionId: self.section, style: .blocks, action: { return ItemListSwitchItem(presentationData: presentationData, title: "Live Stream V2", value: value, sectionId: self.section, style: .blocks, updated: { value in
guard let _ = arguments.context else { let _ = arguments.sharedContext.accountManager.transaction ({ transaction in
return transaction.updateSharedData(ApplicationSpecificSharedDataKeys.experimentalUISettings, { settings in
} var settings = settings?.get(ExperimentalUISettings.self) ?? ExperimentalUISettings.defaultSettings
settings.liveStreamV2 = value
return PreferencesEntry(settings)
})
}).start()
}) })
case let .preferredVideoCodec(_, title, value, isSelected): case let .preferredVideoCodec(_, title, value, isSelected):
return ItemListCheckboxItem(presentationData: presentationData, title: title, style: .right, checked: isSelected, zeroSeparatorInsets: false, sectionId: self.section, action: { return ItemListCheckboxItem(presentationData: presentationData, title: title, style: .right, checked: isSelected, zeroSeparatorInsets: false, sectionId: self.section, action: {
@ -1468,6 +1472,7 @@ private func debugControllerEntries(sharedContext: SharedAccountContext, present
} }
entries.append(.playlistPlayback(experimentalSettings.playlistPlayback)) entries.append(.playlistPlayback(experimentalSettings.playlistPlayback))
entries.append(.enableQuickReactionSwitch(!experimentalSettings.disableQuickReaction)) entries.append(.enableQuickReactionSwitch(!experimentalSettings.disableQuickReaction))
entries.append(.liveStreamV2(experimentalSettings.liveStreamV2))
} }
let codecs: [(String, String?)] = [ let codecs: [(String, String?)] = [

View File

@ -1637,7 +1637,7 @@ public final class PresentationGroupCallImpl: PresentationGroupCall {
if let current = self.genericCallContext { if let current = self.genericCallContext {
genericCallContext = current genericCallContext = current
} else { } else {
if self.isStream, !"".isEmpty { if self.isStream, self.accountContext.sharedContext.immediateExperimentalUISettings.liveStreamV2 {
genericCallContext = .mediaStream(WrappedMediaStreamingContext(rejoinNeeded: { [weak self] in genericCallContext = .mediaStream(WrappedMediaStreamingContext(rejoinNeeded: { [weak self] in
Queue.mainQueue().async { Queue.mainQueue().async {
guard let strongSelf = self else { guard let strongSelf = self else {

View File

@ -57,6 +57,7 @@ public struct ExperimentalUISettings: Codable, Equatable {
public var callV2: Bool public var callV2: Bool
public var allowWebViewInspection: Bool public var allowWebViewInspection: Bool
public var disableReloginTokens: Bool public var disableReloginTokens: Bool
public var liveStreamV2: Bool
public static var defaultSettings: ExperimentalUISettings { public static var defaultSettings: ExperimentalUISettings {
return ExperimentalUISettings( return ExperimentalUISettings(
@ -91,7 +92,8 @@ public struct ExperimentalUISettings: Codable, Equatable {
dustEffect: false, dustEffect: false,
callV2: false, callV2: false,
allowWebViewInspection: false, allowWebViewInspection: false,
disableReloginTokens: false disableReloginTokens: false,
liveStreamV2: false
) )
} }
@ -127,7 +129,8 @@ public struct ExperimentalUISettings: Codable, Equatable {
dustEffect: Bool, dustEffect: Bool,
callV2: Bool, callV2: Bool,
allowWebViewInspection: Bool, allowWebViewInspection: Bool,
disableReloginTokens: Bool disableReloginTokens: Bool,
liveStreamV2: Bool
) { ) {
self.keepChatNavigationStack = keepChatNavigationStack self.keepChatNavigationStack = keepChatNavigationStack
self.skipReadHistory = skipReadHistory self.skipReadHistory = skipReadHistory
@ -161,6 +164,7 @@ public struct ExperimentalUISettings: Codable, Equatable {
self.callV2 = callV2 self.callV2 = callV2
self.allowWebViewInspection = allowWebViewInspection self.allowWebViewInspection = allowWebViewInspection
self.disableReloginTokens = disableReloginTokens self.disableReloginTokens = disableReloginTokens
self.liveStreamV2 = liveStreamV2
} }
public init(from decoder: Decoder) throws { public init(from decoder: Decoder) throws {
@ -198,6 +202,7 @@ public struct ExperimentalUISettings: Codable, Equatable {
self.callV2 = try container.decodeIfPresent(Bool.self, forKey: "callV2") ?? false self.callV2 = try container.decodeIfPresent(Bool.self, forKey: "callV2") ?? false
self.allowWebViewInspection = try container.decodeIfPresent(Bool.self, forKey: "allowWebViewInspection") ?? false self.allowWebViewInspection = try container.decodeIfPresent(Bool.self, forKey: "allowWebViewInspection") ?? false
self.disableReloginTokens = try container.decodeIfPresent(Bool.self, forKey: "disableReloginTokens") ?? false self.disableReloginTokens = try container.decodeIfPresent(Bool.self, forKey: "disableReloginTokens") ?? false
self.liveStreamV2 = try container.decodeIfPresent(Bool.self, forKey: "liveStreamV2") ?? false
} }
public func encode(to encoder: Encoder) throws { public func encode(to encoder: Encoder) throws {
@ -235,6 +240,7 @@ public struct ExperimentalUISettings: Codable, Equatable {
try container.encode(self.callV2, forKey: "callV2") try container.encode(self.callV2, forKey: "callV2")
try container.encode(self.allowWebViewInspection, forKey: "allowWebViewInspection") try container.encode(self.allowWebViewInspection, forKey: "allowWebViewInspection")
try container.encode(self.disableReloginTokens, forKey: "disableReloginTokens") try container.encode(self.disableReloginTokens, forKey: "disableReloginTokens")
try container.encode(self.liveStreamV2, forKey: "liveStreamV2")
} }
} }

View File

@ -57,7 +57,7 @@ final class NetworkBroadcastPartSource: BroadcastPartSource {
private var dataSource: AudioBroadcastDataSource? private var dataSource: AudioBroadcastDataSource?
#if DEBUG #if DEBUG
private let debugDumpDirectory: EngineTempBox.Directory? private var debugDumpDirectory: EngineTempBox.Directory?
#endif #endif
init(queue: Queue, engine: TelegramEngine, callId: Int64, accessHash: Int64, isExternalStream: Bool) { init(queue: Queue, engine: TelegramEngine, callId: Int64, accessHash: Int64, isExternalStream: Bool) {
@ -67,8 +67,8 @@ final class NetworkBroadcastPartSource: BroadcastPartSource {
self.accessHash = accessHash self.accessHash = accessHash
self.isExternalStream = isExternalStream self.isExternalStream = isExternalStream
#if DEBUG && true #if DEBUG
self.debugDumpDirectory = EngineTempBox.shared.tempDirectory() //self.debugDumpDirectory = EngineTempBox.shared.tempDirectory()
#endif #endif
} }

View File

@ -1,10 +0,0 @@
import Foundation
import SwiftSignalKit
import TgVoipWebrtc
import TelegramCore
public final class LiveStreamController {
public init(network: Network) {
}
}