Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
shogo4405 committed Nov 13, 2024
1 parent 4bf5274 commit 3153c23
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions Sources/Screen/Screen.swift
Original file line number Diff line number Diff line change
Expand Up @@ -180,10 +180,9 @@ extension Screen: ChoreographerDelegate {
if let dictionary = CVBufferGetAttachments(pixelBuffer, .shouldNotPropagate) {
CVBufferSetAttachments(pixelBuffer, dictionary, .shouldPropagate)
}
let now = videoPresentationTimeStamp == .invalid ?
CMTime(seconds: timestamp, preferredTimescale: 1000000000) :
videoPresentationTimeStamp
let now = makePresentationTimeStamp(timestamp)
guard currentPresentationTimeStamp < now else {
print("⚠️", currentPresentationTimeStamp, now)
return
}
var timingInfo = CMSampleTimingInfo(
Expand All @@ -206,4 +205,10 @@ extension Screen: ChoreographerDelegate {
}
currentPresentationTimeStamp = now
}

private func makePresentationTimeStamp(_ timestamp: TimeInterval) -> CMTime {
return videoPresentationTimeStamp == .invalid ?
CMTime(seconds: timestamp, preferredTimescale: 1000000000) :
videoPresentationTimeStamp
}
}

0 comments on commit 3153c23

Please sign in to comment.