node-mac-recorder 2.22.22 → 2.22.23
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
CHANGED
|
@@ -502,7 +502,8 @@ extern "C" bool stopAVFoundationRecording() {
|
|
|
502
502
|
|
|
503
503
|
// Finish writing with null checks
|
|
504
504
|
AVAssetWriterInput *writerInput = g_avVideoInput;
|
|
505
|
-
|
|
505
|
+
AVAssetWriter *writerRef = g_avWriter;
|
|
506
|
+
if (writerInput && writerRef && writerRef.status == AVAssetWriterStatusWriting) {
|
|
506
507
|
[writerInput markAsFinished];
|
|
507
508
|
}
|
|
508
509
|
|
|
@@ -342,17 +342,23 @@ static void FinishWriter(AVAssetWriter *writer, AVAssetWriterInput *input) {
|
|
|
342
342
|
if (!writer) {
|
|
343
343
|
return;
|
|
344
344
|
}
|
|
345
|
-
|
|
346
|
-
|
|
345
|
+
|
|
346
|
+
// markAsFinished sadece AVAssetWriterStatusWriting (1) durumunda çağrılabilir
|
|
347
|
+
// Status 0 (Unknown) veya diğer durumlarda crash eder
|
|
348
|
+
if (input && writer.status == AVAssetWriterStatusWriting) {
|
|
347
349
|
[input markAsFinished];
|
|
348
350
|
}
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
351
|
+
|
|
352
|
+
if (writer.status == AVAssetWriterStatusWriting) {
|
|
353
|
+
dispatch_semaphore_t semaphore = dispatch_semaphore_create(0);
|
|
354
|
+
[writer finishWritingWithCompletionHandler:^{
|
|
355
|
+
dispatch_semaphore_signal(semaphore);
|
|
356
|
+
}];
|
|
357
|
+
dispatch_time_t timeout = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(5 * NSEC_PER_SEC));
|
|
358
|
+
dispatch_semaphore_wait(semaphore, timeout);
|
|
359
|
+
} else if (writer.status == AVAssetWriterStatusFailed) {
|
|
360
|
+
NSLog(@"⚠️ Writer already failed: %@", writer.error);
|
|
361
|
+
}
|
|
356
362
|
}
|
|
357
363
|
|
|
358
364
|
static void CleanupWriters(void) {
|
|
@@ -373,10 +379,10 @@ static void CleanupWriters(void) {
|
|
|
373
379
|
}
|
|
374
380
|
|
|
375
381
|
if (g_audioWriter) {
|
|
376
|
-
if (g_systemAudioInput) {
|
|
382
|
+
if (g_systemAudioInput && g_audioWriter.status == AVAssetWriterStatusWriting) {
|
|
377
383
|
[g_systemAudioInput markAsFinished];
|
|
378
384
|
}
|
|
379
|
-
if (g_microphoneAudioInput) {
|
|
385
|
+
if (g_microphoneAudioInput && g_audioWriter.status == AVAssetWriterStatusWriting) {
|
|
380
386
|
[g_microphoneAudioInput markAsFinished];
|
|
381
387
|
}
|
|
382
388
|
FinishWriter(g_audioWriter, nil);
|