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 enableQuickReactionSwitch(Bool)
case disableReloginTokens(Bool)
case voiceConference
case liveStreamV2(Bool)
case preferredVideoCodec(Int, String, String?, Bool)
case disableVideoAspectScaling(Bool)
case enableNetworkFramework(Bool)
@ -127,7 +127,7 @@ private enum DebugControllerEntry: ItemListNodeEntry {
return DebugControllerSection.web.rawValue
case .keepChatNavigationStack, .skipReadHistory, .dustEffect, .crashOnSlowQueries, .crashOnMemoryPressure:
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
case .logTranslationRecognition, .resetTranslationStates:
return DebugControllerSection.translation.rawValue
@ -240,7 +240,7 @@ private enum DebugControllerEntry: ItemListNodeEntry {
return 49
case .enableQuickReactionSwitch:
return 50
case .voiceConference:
case .liveStreamV2:
return 51
case let .preferredVideoCodec(index, _, _, _):
return 52 + index
@ -1312,11 +1312,15 @@ private enum DebugControllerEntry: ItemListNodeEntry {
})
}).start()
})
case .voiceConference:
return ItemListDisclosureItem(presentationData: presentationData, title: "Voice Conference (Test)", label: "", sectionId: self.section, style: .blocks, action: {
guard let _ = arguments.context else {
return
}
case let .liveStreamV2(value):
return ItemListSwitchItem(presentationData: presentationData, title: "Live Stream V2", value: value, sectionId: self.section, style: .blocks, updated: { value in
let _ = arguments.sharedContext.accountManager.transaction ({ transaction in
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):
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(.enableQuickReactionSwitch(!experimentalSettings.disableQuickReaction))
entries.append(.liveStreamV2(experimentalSettings.liveStreamV2))
}
let codecs: [(String, String?)] = [

View File

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

View File

@ -57,6 +57,7 @@ public struct ExperimentalUISettings: Codable, Equatable {
public var callV2: Bool
public var allowWebViewInspection: Bool
public var disableReloginTokens: Bool
public var liveStreamV2: Bool
public static var defaultSettings: ExperimentalUISettings {
return ExperimentalUISettings(
@ -91,7 +92,8 @@ public struct ExperimentalUISettings: Codable, Equatable {
dustEffect: false,
callV2: false,
allowWebViewInspection: false,
disableReloginTokens: false
disableReloginTokens: false,
liveStreamV2: false
)
}
@ -127,7 +129,8 @@ public struct ExperimentalUISettings: Codable, Equatable {
dustEffect: Bool,
callV2: Bool,
allowWebViewInspection: Bool,
disableReloginTokens: Bool
disableReloginTokens: Bool,
liveStreamV2: Bool
) {
self.keepChatNavigationStack = keepChatNavigationStack
self.skipReadHistory = skipReadHistory
@ -161,6 +164,7 @@ public struct ExperimentalUISettings: Codable, Equatable {
self.callV2 = callV2
self.allowWebViewInspection = allowWebViewInspection
self.disableReloginTokens = disableReloginTokens
self.liveStreamV2 = liveStreamV2
}
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.allowWebViewInspection = try container.decodeIfPresent(Bool.self, forKey: "allowWebViewInspection") ?? 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 {
@ -235,6 +240,7 @@ public struct ExperimentalUISettings: Codable, Equatable {
try container.encode(self.callV2, forKey: "callV2")
try container.encode(self.allowWebViewInspection, forKey: "allowWebViewInspection")
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?
#if DEBUG
private let debugDumpDirectory: EngineTempBox.Directory?
private var debugDumpDirectory: EngineTempBox.Directory?
#endif
init(queue: Queue, engine: TelegramEngine, callId: Int64, accessHash: Int64, isExternalStream: Bool) {
@ -67,8 +67,8 @@ final class NetworkBroadcastPartSource: BroadcastPartSource {
self.accessHash = accessHash
self.isExternalStream = isExternalStream
#if DEBUG && true
self.debugDumpDirectory = EngineTempBox.shared.tempDirectory()
#if DEBUG
//self.debugDumpDirectory = EngineTempBox.shared.tempDirectory()
#endif
}

View File

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