There was an error while loading. Please reload this page.
2 parents 2c9d413 + 5324590 commit 0009c2aCopy full SHA for 0009c2a
1 file changed
Sources/KSPlayer/MEPlayer/FFmpegAssetTrack.swift
@@ -168,7 +168,14 @@ public class FFmpegAssetTrack: MediaPlayerTrack {
168
dovi = sideData.data.withMemoryRebound(to: DOVIDecoderConfigurationRecord.self, capacity: 1) { $0 }.pointee
169
} else if sideData.type == AV_PKT_DATA_DISPLAYMATRIX {
170
let matrix = sideData.data.withMemoryRebound(to: Int32.self, capacity: 1) { $0 }
171
- rotation = Int16(Int(-av_display_rotation_get(matrix)) % 360)
+ let rawRotation = -av_display_rotation_get(matrix)
172
+ if rawRotation.isFinite {
173
+ let degrees = Int(rawRotation.rounded())
174
+ let normalized = ((degrees % 360) + 360) % 360
175
+ rotation = Int16(normalized)
176
+ } else {
177
+ rotation = 0
178
+ }
179
}
180
181
0 commit comments