mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-07-23 03:31:09 +00:00
Merge branch 'master' of gitlab.com:peter-iakovlev/telegram-ios
This commit is contained in:
commit
aa892f0bb5
@ -816,7 +816,7 @@ private final class MediaPlayerContext {
|
||||
rate = 0.0
|
||||
print("bufferingProgress = \(progress)")
|
||||
|
||||
let tickTimer = SwiftSignalKit.Timer(timeout: 0.1, repeat: false, completion: { [weak self] in
|
||||
let tickTimer = SwiftSignalKit.Timer(timeout: 0.3, repeat: false, completion: { [weak self] in
|
||||
self?.tick()
|
||||
}, queue: self.queue)
|
||||
self.tickTimer = tickTimer
|
||||
|
@ -37,6 +37,7 @@ public final class MediaTrackFrameBuffer {
|
||||
private var frames: [MediaTrackDecodableFrame] = []
|
||||
private var endOfStream = false
|
||||
private var bufferedUntilTime: CMTime?
|
||||
private var isWaitingForLowWaterDuration: Bool = false
|
||||
|
||||
init(frameSource: MediaFrameSource, decoder: MediaTrackFrameDecoder, type: MediaTrackFrameType, duration: CMTime, rotationAngle: Double, aspect: Double, stallDuration: Double = 1.0, lowWaterDuration: Double = 2.0, highWaterDuration: Double = 3.0) {
|
||||
self.frameSource = frameSource
|
||||
@ -97,6 +98,7 @@ public final class MediaTrackFrameBuffer {
|
||||
|
||||
private func endOfStreamReached() {
|
||||
self.endOfStream = true
|
||||
self.isWaitingForLowWaterDuration = false
|
||||
self.statusUpdated()
|
||||
}
|
||||
|
||||
@ -130,15 +132,17 @@ public final class MediaTrackFrameBuffer {
|
||||
generateUntil += delayIncrement
|
||||
}
|
||||
|
||||
if bufferedDuration > self.stallDuration {
|
||||
if bufferedDuration > self.stallDuration && !self.isWaitingForLowWaterDuration {
|
||||
if traceEvents {
|
||||
print("buffered1 duration: \(bufferedDuration), wait until \(timestamp) + \(self.highWaterDuration - bufferedDuration)")
|
||||
}
|
||||
return .full(until: timestamp + self.highWaterDuration)
|
||||
} else {
|
||||
return .buffering(progress: max(0.0, bufferedDuration / self.stallDuration))
|
||||
self.isWaitingForLowWaterDuration = true
|
||||
return .buffering(progress: max(0.0, bufferedDuration / self.lowWaterDuration))
|
||||
}
|
||||
} else {
|
||||
self.isWaitingForLowWaterDuration = false
|
||||
if traceEvents {
|
||||
print("buffered2 duration: \(bufferedDuration), wait until \(timestamp) + \(bufferedDuration - self.lowWaterDuration)")
|
||||
}
|
||||
|
@ -1637,7 +1637,7 @@ func keepPollingChannel(postbox: Postbox, network: Network, peerId: PeerId, stat
|
||||
|> restart
|
||||
|
||||
return signal
|
||||
|> delay(5.0, queue: .concurrentDefaultQueue())
|
||||
|> delay(1.0, queue: .concurrentDefaultQueue())
|
||||
}
|
||||
|
||||
private func resetChannels(network: Network, peers: [Peer], state: AccountMutableState) -> Signal<AccountMutableState, NoError> {
|
||||
|
Loading…
x
Reference in New Issue
Block a user