Any update on this?
Post
Replies
Boosts
Views
Activity
Hi again,
This is for a totally different example. I trying to record a video from1 a custom MetalKit View. I am running the Profiler and I can get the slowdown by running a simple Performance analysis. My testing device is an iPhone 12 pro max. Not sure if the texture is too big, I am using the same as the screen size. Still unsure if that is the problem.
let region = MTLRegionMake2D(0, 0, texture.width, texture.height)
let frameTime = CACurrentMediaTime() - recordingStartTime
let presentationTime = CMTimeMakeWithSeconds(frameTime, preferredTimescale: 240)
CVPixelBufferLockBaseAddress(pixelBuffer, [])
let pixelBufferBytes = CVPixelBufferGetBaseAddress(pixelBuffer)!
let bytesPerRow = CVPixelBufferGetBytesPerRow(pixelBuffer)
// TODO: - FIX PERFORMANCE
texture.getBytes(pixelBufferBytes, bytesPerRow: bytesPerRow, from: region, mipmapLevel: 0)
assetWriterPixelBufferInput.append(pixelBuffer, withPresentationTime: presentationTime)
CVPixelBufferUnlockBaseAddress(pixelBuffer, [])
Hi all, I have encountered the same problem