mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-07-23 11:41:13 +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
|
rate = 0.0
|
||||||
print("bufferingProgress = \(progress)")
|
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()
|
self?.tick()
|
||||||
}, queue: self.queue)
|
}, queue: self.queue)
|
||||||
self.tickTimer = tickTimer
|
self.tickTimer = tickTimer
|
||||||
|
@ -37,6 +37,7 @@ public final class MediaTrackFrameBuffer {
|
|||||||
private var frames: [MediaTrackDecodableFrame] = []
|
private var frames: [MediaTrackDecodableFrame] = []
|
||||||
private var endOfStream = false
|
private var endOfStream = false
|
||||||
private var bufferedUntilTime: CMTime?
|
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) {
|
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
|
self.frameSource = frameSource
|
||||||
@ -97,6 +98,7 @@ public final class MediaTrackFrameBuffer {
|
|||||||
|
|
||||||
private func endOfStreamReached() {
|
private func endOfStreamReached() {
|
||||||
self.endOfStream = true
|
self.endOfStream = true
|
||||||
|
self.isWaitingForLowWaterDuration = false
|
||||||
self.statusUpdated()
|
self.statusUpdated()
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -130,15 +132,17 @@ public final class MediaTrackFrameBuffer {
|
|||||||
generateUntil += delayIncrement
|
generateUntil += delayIncrement
|
||||||
}
|
}
|
||||||
|
|
||||||
if bufferedDuration > self.stallDuration {
|
if bufferedDuration > self.stallDuration && !self.isWaitingForLowWaterDuration {
|
||||||
if traceEvents {
|
if traceEvents {
|
||||||
print("buffered1 duration: \(bufferedDuration), wait until \(timestamp) + \(self.highWaterDuration - bufferedDuration)")
|
print("buffered1 duration: \(bufferedDuration), wait until \(timestamp) + \(self.highWaterDuration - bufferedDuration)")
|
||||||
}
|
}
|
||||||
return .full(until: timestamp + self.highWaterDuration)
|
return .full(until: timestamp + self.highWaterDuration)
|
||||||
} else {
|
} else {
|
||||||
return .buffering(progress: max(0.0, bufferedDuration / self.stallDuration))
|
self.isWaitingForLowWaterDuration = true
|
||||||
|
return .buffering(progress: max(0.0, bufferedDuration / self.lowWaterDuration))
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
self.isWaitingForLowWaterDuration = false
|
||||||
if traceEvents {
|
if traceEvents {
|
||||||
print("buffered2 duration: \(bufferedDuration), wait until \(timestamp) + \(bufferedDuration - self.lowWaterDuration)")
|
print("buffered2 duration: \(bufferedDuration), wait until \(timestamp) + \(bufferedDuration - self.lowWaterDuration)")
|
||||||
}
|
}
|
||||||
|
@ -1637,7 +1637,7 @@ func keepPollingChannel(postbox: Postbox, network: Network, peerId: PeerId, stat
|
|||||||
|> restart
|
|> restart
|
||||||
|
|
||||||
return signal
|
return signal
|
||||||
|> delay(5.0, queue: .concurrentDefaultQueue())
|
|> delay(1.0, queue: .concurrentDefaultQueue())
|
||||||
}
|
}
|
||||||
|
|
||||||
private func resetChannels(network: Network, peers: [Peer], state: AccountMutableState) -> Signal<AccountMutableState, NoError> {
|
private func resetChannels(network: Network, peers: [Peer], state: AccountMutableState) -> Signal<AccountMutableState, NoError> {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user