Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 14 additions & 4 deletions Sources/NextLevelSessionExporter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -453,11 +453,21 @@ extension NextLevelSessionExporter {
let result = CVPixelBufferPoolCreatePixelBuffer(kCFAllocatorDefault, pixelBufferPool, &toRenderBuffer)
if result == kCVReturnSuccess {
if let toBuffer = toRenderBuffer {
self._renderHandler?(pixelBuffer, self._lastSamplePresentationTime, toBuffer)
if pixelBufferAdaptor.append(toBuffer, withPresentationTime:self._lastSamplePresentationTime) == false {
error = true
// if _renderHandler is nil, then we can save time by just passing pixelBuffer directly to pixelBufferAdaptor.append
if (self._renderHandler == nil) {
if pixelBufferAdaptor.append(pixelBuffer, withPresentationTime:self._lastSamplePresentationTime) == false {
error = true
}
handled = true
}
// otherwise, we need to call into _renderHandler to preprocess the frames
else {
self._renderHandler?(pixelBuffer, self._lastSamplePresentationTime, toBuffer)
if pixelBufferAdaptor.append(toBuffer, withPresentationTime:self._lastSamplePresentationTime) == false {
error = true
}
handled = true
}
handled = true
}
}
}
Expand Down