Skip to content

Commit 8f7ed50

Browse files
committed
Update our time scale logic to better reflect a semantic that OTIO expects.
1 parent 45fcddd commit 8f7ed50

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Sources/OpenTimelineIO-AVFoundation/AVFoundation-Extensions/AVComposition.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,13 @@ public extension AVComposition
3636
// So some integrations presume the rate of the global start time
3737
// implies the frame rate of the sequence or project
3838

39-
let minFrameDuration = self.tracks(withMediaType: .video).reduce(.positiveInfinity) { min($0, $1.minFrameDuration) }
39+
let maxNominalFrameRate = self.tracks(withMediaType: .video).reduce(Float.zero) { max($0, $1.nominalFrameRate) }
4040

4141
let globalStartTime:RationalTime
4242

43-
if minFrameDuration.isValid && minFrameDuration != .positiveInfinity
43+
if maxNominalFrameRate != .zero
4444
{
45-
globalStartTime = config.globalStartTime.rescaled(to: Double(minFrameDuration.timescale) )
45+
globalStartTime = config.globalStartTime.rescaled(to: Double(maxNominalFrameRate) )
4646
}
4747
else
4848
{

0 commit comments

Comments
 (0)