Skip to content

Commit 4d6fb78

Browse files
author
Vladislav Grigoryev
committed
Fix photo using surface crash.
1 parent 2c45649 commit 4d6fb78

9 files changed

Lines changed: 26 additions & 19 deletions

File tree

Example/Example.xcodeproj/project.pbxproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -438,7 +438,7 @@
438438
"$(inherited)",
439439
"@executable_path/Frameworks",
440440
);
441-
MARKETING_VERSION = 2.1.2;
441+
MARKETING_VERSION = 2.1.3;
442442
PRODUCT_BUNDLE_IDENTIFIER = "gora.studio.SCNRecorder.Example.${DEVELOPMENT_TEAM}";
443443
PRODUCT_NAME = "$(TARGET_NAME)";
444444
SWIFT_VERSION = 5.0;
@@ -459,7 +459,7 @@
459459
"$(inherited)",
460460
"@executable_path/Frameworks",
461461
);
462-
MARKETING_VERSION = 2.1.2;
462+
MARKETING_VERSION = 2.1.3;
463463
PRODUCT_BUNDLE_IDENTIFIER = "gora.studio.SCNRecorder.Example.${DEVELOPMENT_TEAM}";
464464
PRODUCT_NAME = "$(TARGET_NAME)";
465465
SWIFT_VERSION = 5.0;

Example/Podfile.lock

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
PODS:
2-
- SCNRecorder (2.1.2)
2+
- SCNRecorder (2.1.3)
33

44
DEPENDENCIES:
55
- SCNRecorder (from `../`)
@@ -9,7 +9,7 @@ EXTERNAL SOURCES:
99
:path: "../"
1010

1111
SPEC CHECKSUMS:
12-
SCNRecorder: 8fb988232b1ba508d36e64d743960ec259d67a35
12+
SCNRecorder: d3ee579c3c4511774300689840b82cb4b7a9143f
1313

1414
PODFILE CHECKSUM: e392a018caa1209a22fbb64a189d92975244c2bf
1515

Example/Pods/Local Podspecs/SCNRecorder.podspec.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Example/Pods/Manifest.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Example/Pods/Target Support Files/SCNRecorder/SCNRecorder-Info.plist

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

SCNRecorder.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Pod::Spec.new do |s|
22
s.name = 'SCNRecorder'
3-
s.version = '2.1.2'
3+
s.version = '2.1.3'
44
s.summary = 'A lags-free recorder of ARKit and SceneKit for iOS in Swift'
55
s.homepage = 'https://github.com/gorastudio/SCNRecorder'
66
s.license = { :type => 'MIT', :file => 'LICENSE.md' }

SCNRecorder.xcodeproj/project.pbxproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -820,7 +820,7 @@
820820
"@executable_path/Frameworks",
821821
"@loader_path/Frameworks",
822822
);
823-
MARKETING_VERSION = 2.1.2;
823+
MARKETING_VERSION = 2.1.3;
824824
MODULEMAP_FILE = SCNRecorder.modulemap;
825825
PRODUCT_BUNDLE_IDENTIFIER = gora.studio.SCNRecorder;
826826
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
@@ -848,7 +848,7 @@
848848
"@executable_path/Frameworks",
849849
"@loader_path/Frameworks",
850850
);
851-
MARKETING_VERSION = 2.1.2;
851+
MARKETING_VERSION = 2.1.3;
852852
MODULEMAP_FILE = SCNRecorder.modulemap;
853853
PRODUCT_BUNDLE_IDENTIFIER = gora.studio.SCNRecorder;
854854
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";

Sources/MediaSession/MediaSession.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,8 +189,11 @@ extension MediaSession {
189189
}
190190

191191
func takeCoreImage(completionHandler handler: @escaping (CIImage) -> Void) {
192+
guard let videoInput = videoInput else { return }
193+
192194
addVideoOutput(
193195
ImageOutput.takeCIImage(
196+
context: videoInput.context,
194197
completionHandler: { [weak self] in
195198
self?.removeVideoOutput($0)
196199
handler($1)

Sources/Outputs/ImageOutput/ImageOutput.swift

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
import Foundation
2727
import AVFoundation
2828
import UIKit
29+
import VideoToolbox
2930

3031
final class ImageOutput {
3132

@@ -40,20 +41,23 @@ final class ImageOutput {
4041
}
4142
}
4243

43-
static func takeCGImage(
44+
static func takeCIImage(
4445
context: CIContext,
45-
completionHandler handler: @escaping (ImageOutput, CGImage) -> Void
46+
completionHandler handler: @escaping (ImageOutput, CIImage) -> Void
4647
) -> ImageOutput {
47-
takeCIImage {
48-
handler($0, context.createCGImage($1, from: $1.extent)!)
48+
takeCGImage(context: context) {
49+
handler($0, CIImage(cgImage: $1))
4950
}
5051
}
5152

52-
static func takeCIImage(
53-
completionHandler handler: @escaping (ImageOutput, CIImage) -> Void
53+
static func takeCGImage(
54+
context: CIContext,
55+
completionHandler handler: @escaping (ImageOutput, CGImage) -> Void
5456
) -> ImageOutput {
5557
takePixelBuffer {
56-
handler($0, CIImage(cvPixelBuffer: $1))
58+
var image: CGImage?
59+
VTCreateCGImageFromCVPixelBuffer($1, options: nil, imageOut: &image)
60+
handler($0, image!)
5761
}
5862
}
5963

0 commit comments

Comments
 (0)