diff --git a/.bazelrc b/.bazelrc index 55d4d3adf2..2c58590827 100644 --- a/.bazelrc +++ b/.bazelrc @@ -9,4 +9,5 @@ build --strategy=SwiftCompile=local build --features=debug_prefix_map_pwd_is_dot build --features=swift.cacheable_swiftmodules build --features=swift.debug_prefix_map +build --features=swift.enable_vfsoverlays diff --git a/.gitmodules b/.gitmodules index 408376ccba..3ea55256ad 100644 --- a/.gitmodules +++ b/.gitmodules @@ -4,7 +4,7 @@ url=../rlottie.git [submodule "build-system/bazel-rules/rules_apple"] path = build-system/bazel-rules/rules_apple - url=https://github.com/ali-fareed/rules_apple.git +url=https://github.com/bazelbuild/rules_apple.git [submodule "build-system/bazel-rules/rules_swift"] path = build-system/bazel-rules/rules_swift url = https://github.com/bazelbuild/rules_swift.git diff --git a/build-system/bazel-rules/rules_apple b/build-system/bazel-rules/rules_apple index 6e1f592277..748e7e2b1e 160000 --- a/build-system/bazel-rules/rules_apple +++ b/build-system/bazel-rules/rules_apple @@ -1 +1 @@ -Subproject commit 6e1f592277650a2727b6e84705ec1a2dc17764fa +Subproject commit 748e7e2b1ee5e8976ba873394cbd5e32b61818c7 diff --git a/build-system/bazel-rules/rules_swift b/build-system/bazel-rules/rules_swift index bbe187c4b1..6408d85da7 160000 --- a/build-system/bazel-rules/rules_swift +++ b/build-system/bazel-rules/rules_swift @@ -1 +1 @@ -Subproject commit bbe187c4b1f55c0974a0da345e5e313eaed37c05 +Subproject commit 6408d85da799ec2af053c4e2883dce3ce6d30f08 diff --git a/submodules/Display/Source/ListView.swift b/submodules/Display/Source/ListView.swift index 100108265c..d665bd9310 100644 --- a/submodules/Display/Source/ListView.swift +++ b/submodules/Display/Source/ListView.swift @@ -4278,3 +4278,7 @@ private func findAccessibilityFocus(_ node: ASDisplayNode) -> Bool { } return false } + +public func randomfqweeqwf() { + print("t") +} diff --git a/submodules/TelegramUI/Sources/MultiplexedSoftwareVideoSourceManager.swift b/submodules/TelegramUI/Sources/MultiplexedSoftwareVideoSourceManager.swift deleted file mode 100644 index 8ab299393c..0000000000 --- a/submodules/TelegramUI/Sources/MultiplexedSoftwareVideoSourceManager.swift +++ /dev/null @@ -1,118 +0,0 @@ -import Foundation -import UIKit -import Postbox -import TelegramCore -import SyncCore -import SwiftSignalKit -import CoreMedia -import UniversalMediaPlayer - -private final class RunningSoftwareVideoSource { - let fetchDisposable: Disposable - let fetchStatusDisposable: Disposable - - var source: SoftwareVideoSource? - var beginTime: Double? - var frame: MediaTrackFrame? - - init(fetchDisposable: Disposable, fetchStatusDisposable: Disposable) { - self.fetchDisposable = fetchDisposable - self.fetchStatusDisposable = fetchStatusDisposable - } - - deinit { - self.fetchDisposable.dispose() - self.fetchStatusDisposable.dispose() - } -} - -final class MultiplexedSoftwareVideoSourceManager { - private let queue: Queue - private let account: Account - private var videoSources: [MediaId: RunningSoftwareVideoSource] = [:] - private(set) var immediateVideoFrames: [MediaId: MediaTrackFrame] = [:] - - private var updatingAt: Double? - - var updateFrame: ((MediaId, MediaTrackFrame) -> Void)? - - init(queue: Queue, account: Account) { - self.queue = queue - self.account = account - } - - func updateVisibleItems(_ media: [TelegramMediaFile]) { - self.queue.async { - var dict: [MediaId: TelegramMediaFile] = [:] - for file in media { - dict[file.fileId] = file - } - - var removeIds: [MediaId] = [] - for id in self.videoSources.keys { - if dict[id] == nil { - removeIds.append(id) - } - } - - for id in removeIds { - self.videoSources.removeValue(forKey: id) - } - - for (id, file) in dict { - if self.videoSources[id] == nil { - self.videoSources[id] = RunningSoftwareVideoSource(fetchDisposable: (self.account.postbox.mediaBox.resourceData(file.resource) |> deliverOn(self.queue)).start(next: { [weak self] data in - if let strongSelf = self, let context = strongSelf.videoSources[id] { - if data.complete { - context.source = SoftwareVideoSource(path: data.path) - } - } - }), fetchStatusDisposable: fetchedMediaResource(mediaBox: self.account.postbox.mediaBox, reference: AnyMediaReference.standalone(media: file).resourceReference(file.resource)).start()) - } - } - } - } - - func update(at timestamp: Double) { - assert(Queue.mainQueue().isCurrent()) - let begin = self.updatingAt == nil - self.updatingAt = timestamp - if begin { - self.queue.async { - var immediateVideoFrames: [MediaId: MediaTrackFrame] = [:] - loop: for (id, source) in self.videoSources { - if let context = source.source { - if let beginTime = source.beginTime, let currentFrame = source.frame { - let framePosition = currentFrame.position.seconds - let frameDuration = currentFrame.duration.seconds - - if false && beginTime + framePosition + frameDuration > timestamp { - immediateVideoFrames[id] = currentFrame - continue loop - } - } - - /*if let frame = context.readFrame(maxPts: nil) { - if source.frame == nil || CMTimeCompare(source.frame!.position, frame.position) > 0 { - source.beginTime = timestamp - } - source.frame = frame - immediateVideoFrames[id] = frame - self.updateFrame?(id, frame) - }*/ - } - } - - Queue.mainQueue().async { - self.immediateVideoFrames = immediateVideoFrames - if let updatingAt = self.updatingAt, !updatingAt.isEqual(to: timestamp) { - self.updatingAt = nil - self.update(at: updatingAt) - } else { - self.updatingAt = nil - } - } - } - } - } -} diff --git a/submodules/TelegramUI/Sources/SoftwareVideoLayerFrameManager.swift b/submodules/TelegramUI/Sources/SoftwareVideoLayerFrameManager.swift index eefc709bef..9060e0dfea 100644 --- a/submodules/TelegramUI/Sources/SoftwareVideoLayerFrameManager.swift +++ b/submodules/TelegramUI/Sources/SoftwareVideoLayerFrameManager.swift @@ -61,6 +61,17 @@ final class SoftwareVideoLayerFrameManager { } func start() { + func stringForResource(_ resource: MediaResource?) -> String { + guard let resource = resource else { + return "" + } + if let resource = resource as? WebFileReferenceMediaResource { + return resource.url + } else { + return resource.id.uniqueId + } + } + Logger.shared.log("SoftwareVideo", "load video from \(stringForResource(self.resource)) or \(stringForResource(self.secondaryResource))") let secondarySignal: Signal if let secondaryResource = self.secondaryResource { secondarySignal = self.account.postbox.mediaBox.resourceData(secondaryResource, option: .complete(waitUntilFetchStatus: false)) @@ -90,7 +101,8 @@ final class SoftwareVideoLayerFrameManager { } |> take(1) - self.dataDisposable.set((firstReady |> deliverOn(applyQueue)).start(next: { [weak self] path in + self.dataDisposable.set((firstReady + |> deliverOn(applyQueue)).start(next: { [weak self] path in if let strongSelf = self { let _ = strongSelf.source.swap(SoftwareVideoSource(path: path)) }