Use targetTimestamp in SDDisplayLink

This commit is contained in:
Michael Thomas 2021-10-05 15:51:36 -04:00
parent d636743952
commit 19540b3596
1 changed files with 6 additions and 1 deletions

View File

@ -89,7 +89,12 @@ static CVReturn DisplayLinkCallback(CVDisplayLinkRef displayLink, const CVTimeSt
#elif SD_IOS || SD_TV
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
NSTimeInterval duration = self.displayLink.duration * self.displayLink.frameInterval;
NSTimeInterval duration = 0;
if (@available(iOS 10.0, *)) {
duration = self.displayLink.targetTimestamp - CACurrentMediaTime();
} else {
duration = self.displayLink.duration * self.displayLink.frameInterval;
}
#pragma clang diagnostic pop
#else
NSTimeInterval duration = 0;