node-mac-recorder 2.21.33 → 2.21.34
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/camera_recorder.mm +21 -3
package/package.json
CHANGED
package/src/camera_recorder.mm
CHANGED
|
@@ -266,7 +266,13 @@ static BOOL MRIsContinuityCamera(AVCaptureDevice *device) {
|
|
|
266
266
|
}
|
|
267
267
|
|
|
268
268
|
- (void)clearPendingSampleBuffers {
|
|
269
|
-
|
|
269
|
+
id container = self.pendingSampleBuffers;
|
|
270
|
+
if (![container isKindOfClass:[NSArray class]]) {
|
|
271
|
+
MRLog(@"⚠️ CameraRecorder: pendingSampleBuffers corrupted (%@) — resetting", NSStringFromClass([container class]));
|
|
272
|
+
self.pendingSampleBuffers = [NSMutableArray array];
|
|
273
|
+
return;
|
|
274
|
+
}
|
|
275
|
+
for (NSValue *value in (NSArray *)container) {
|
|
270
276
|
CMSampleBufferRef buffer = (CMSampleBufferRef)[value pointerValue];
|
|
271
277
|
if (buffer) {
|
|
272
278
|
CFRelease(buffer);
|
|
@@ -854,6 +860,11 @@ static BOOL MRIsContinuityCamera(AVCaptureDevice *device) {
|
|
|
854
860
|
if (!sampleBuffer) {
|
|
855
861
|
return;
|
|
856
862
|
}
|
|
863
|
+
if (![self.pendingSampleBuffers isKindOfClass:[NSMutableArray class]]) {
|
|
864
|
+
MRLog(@"⚠️ CameraRecorder: pendingSampleBuffers not NSMutableArray (%@) — reinitializing",
|
|
865
|
+
NSStringFromClass([self.pendingSampleBuffers class]));
|
|
866
|
+
self.pendingSampleBuffers = [NSMutableArray array];
|
|
867
|
+
}
|
|
857
868
|
CMSampleBufferRef bufferCopy = NULL;
|
|
858
869
|
OSStatus status = CMSampleBufferCreateCopy(kCFAllocatorDefault, sampleBuffer, &bufferCopy);
|
|
859
870
|
if (status == noErr && bufferCopy) {
|
|
@@ -864,11 +875,18 @@ static BOOL MRIsContinuityCamera(AVCaptureDevice *device) {
|
|
|
864
875
|
}
|
|
865
876
|
|
|
866
877
|
- (void)flushPendingSampleBuffers {
|
|
867
|
-
|
|
878
|
+
id container = self.pendingSampleBuffers;
|
|
879
|
+
if (![container isKindOfClass:[NSArray class]]) {
|
|
880
|
+
MRLog(@"⚠️ CameraRecorder: pendingSampleBuffers corrupted (%@) — resetting",
|
|
881
|
+
NSStringFromClass([container class]));
|
|
882
|
+
self.pendingSampleBuffers = [NSMutableArray array];
|
|
883
|
+
return;
|
|
884
|
+
}
|
|
885
|
+
if ([(NSArray *)container count] == 0) {
|
|
868
886
|
return;
|
|
869
887
|
}
|
|
870
888
|
|
|
871
|
-
NSArray<NSValue *> *queued = [
|
|
889
|
+
NSArray<NSValue *> *queued = [(NSArray *)container copy];
|
|
872
890
|
[self.pendingSampleBuffers removeAllObjects];
|
|
873
891
|
|
|
874
892
|
CMTime audioStart = MRSyncAudioFirstTimestamp();
|