add stride_align for onRgba (#6)
Signed-off-by: fufesou <shuanglongchen@yeah.net>
This commit is contained in:
parent
1c79d8dd88
commit
044bb260d9
9 changed files with 89 additions and 40 deletions
|
|
@ -34,7 +34,7 @@ import CoreVideo
|
|||
}
|
||||
|
||||
|
||||
@objc public func markFrameAvaliable(data: Data, width: Int, height: Int) -> Bool {
|
||||
@objc public func markFrameAvaliable(data: Data, width: Int, height: Int, stride_align: Int) -> Bool {
|
||||
queue.sync {
|
||||
self.data = data.withUnsafeBytes { buffer in
|
||||
var pixelBufferCopy: CVPixelBuffer!
|
||||
|
|
@ -42,7 +42,9 @@ import CoreVideo
|
|||
let result = CVPixelBufferCreate(kCFAllocatorDefault, width, height, kCVPixelFormatType_32BGRA, [
|
||||
kCVPixelBufferPixelFormatTypeKey: kCVPixelFormatType_32BGRA,
|
||||
kCVPixelBufferMetalCompatibilityKey: true,
|
||||
kCVPixelBufferOpenGLCompatibilityKey: true
|
||||
kCVPixelBufferOpenGLCompatibilityKey: true,
|
||||
// https://developer.apple.com/forums/thread/712709
|
||||
kCVPixelBufferBytesPerRowAlignmentKey: stride_align * 4
|
||||
] as CFDictionary, &pixelBufferCopy)
|
||||
guard result == kCVReturnSuccess else {
|
||||
return nil
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue