Fix VLC resume audio lag

This commit is contained in:
dirtydishes 2026-05-27 00:46:29 -04:00
parent f0226c651d
commit ed7a242a47
4 changed files with 409 additions and 4 deletions

View file

@ -75,6 +75,26 @@ enum NativePlaybackAudioSessionPolicy {
}
}
enum NativePlaybackResumePolicy {
static let freezeInterval: TimeInterval = 0.08
static let maximumFreezeDuration: TimeInterval = 1.2
static let maximumAllowedSilentAdvance: Int32 = 120
static func shouldHoldVideoAtPausedTime(
elapsedSinceResume: TimeInterval,
hasObservedAudioOutput: Bool,
mediaAdvanceMilliseconds: Int32
) -> Bool {
guard !hasObservedAudioOutput else {
return false
}
guard elapsedSinceResume < maximumFreezeDuration else {
return false
}
return mediaAdvanceMilliseconds > maximumAllowedSilentAdvance
}
}
enum NativePlaybackError: LocalizedError {
case backendUnavailable
case startupTimedOut