Video Stickers Fixes

This commit is contained in:
Ilya Laktyushin
2022-01-29 17:25:22 +03:00
parent a506cbf7cf
commit d1802a460e
4 changed files with 39 additions and 20 deletions

View File

@@ -58,12 +58,16 @@ public final class SoftwareVideoSource {
fileprivate let fd: Int32?
fileprivate let size: Int32
private let hintVP9: Bool
private var enqueuedFrames: [(MediaTrackFrame, CGFloat, CGFloat, Bool)] = []
private var hasReadToEnd: Bool = false
public init(path: String, hintVP9: Bool) {
let _ = FFMpegMediaFrameSourceContextHelpers.registerFFMpegGlobals
self.hintVP9 = hintVP9
var s = stat()
stat(path, &s)
self.size = Int32(s.st_size)
@@ -224,7 +228,7 @@ public final class SoftwareVideoSource {
if let maxPts = maxPts, CMTimeCompare(decodableFrame.pts, maxPts) < 0 {
ptsOffset = maxPts
}
result = (videoStream.decoder.decode(frame: decodableFrame, ptsOffset: ptsOffset), CGFloat(videoStream.rotationAngle), CGFloat(videoStream.aspect), loop)
result = (videoStream.decoder.decode(frame: decodableFrame, ptsOffset: ptsOffset, forceARGB: self.hintVP9), CGFloat(videoStream.rotationAngle), CGFloat(videoStream.aspect), loop)
} else {
result = (nil, CGFloat(videoStream.rotationAngle), CGFloat(videoStream.aspect), loop)
}