Skip to content

Commit 63996b0

Browse files
author
Omer Karisman
committed
Stop recreating the CIContext for every frame.
1 parent d0de14e commit 63996b0

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

SceneKitVideoRecorder.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Pod::Spec.new do |s|
1616
#
1717

1818
s.name = "SceneKitVideoRecorder"
19-
s.version = "1.0.0"
19+
s.version = "1.0.1"
2020
s.summary = "Record videos of SceneKit and ARKit"
2121

2222
# This description is used to generate tags and improve search results.

SceneKitVideoRecorder/Classes/PixelBufferFactory.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212
import UIKit
1313

1414
struct PixelBufferFactory {
15+
16+
static let context = CIContext(options: nil)
17+
1518
static func make(with metalLayer: CAMetalLayer, usingBuffer pool: CVPixelBufferPool) -> (CVPixelBuffer?, UIImage) {
1619

1720
let currentDrawable = metalLayer.nextDrawable()
@@ -38,7 +41,6 @@ struct PixelBufferFactory {
3841
static func imageFromCVPixelBuffer(buffer: CVPixelBuffer) -> UIImage {
3942

4043
let ciimage = CIImage(cvPixelBuffer: buffer)
41-
let context = CIContext(options: nil)
4244
let cgimgage = context.createCGImage(ciimage, from: CGRect(x: 0, y: 0, width: CVPixelBufferGetWidth(buffer), height: CVPixelBufferGetHeight(buffer)))
4345

4446
let uiimage = UIImage(cgImage: cgimgage!)

0 commit comments

Comments
 (0)