Skip to content

Commit

Permalink
mac-capture: Remove disp_finished event
Browse files Browse the repository at this point in the history
This event is only used within destroy_[audio]_screen_stream, and does
not appear to be necessary there. stopCaptureWithCompletionHandler holds
a reference to the SCStream object by itself (and the other objects
being held aren't used afterwards anyways), so there should be no harm
in releasing everything immediately without blocking.
  • Loading branch information
gxalpha authored and WizardCM committed Aug 25, 2024
1 parent 60a45d3 commit 92d5b45
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 13 deletions.
4 changes: 0 additions & 4 deletions plugins/mac-capture/mac-sck-audio-capture.m
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@
MACCAP_ERR("destroy_audio_screen_stream: Failed to stop stream with error %s\n",
[[error localizedFailureReason] cStringUsingEncoding:NSUTF8StringEncoding]);
}
os_event_signal(sc->disp_finished);
}];
os_event_wait(sc->disp_finished);
}

if (sc->stream_properties) {
Expand All @@ -28,7 +26,6 @@
sc->disp = NULL;
}

os_event_destroy(sc->disp_finished);
os_event_destroy(sc->stream_start_completed);
}

Expand Down Expand Up @@ -152,7 +149,6 @@
sc->disp = NULL;
return !did_add_output;
}
os_event_init(&sc->disp_finished, OS_EVENT_TYPE_MANUAL);
os_event_init(&sc->stream_start_completed, OS_EVENT_TYPE_MANUAL);

__block BOOL did_stream_start = false;
Expand Down
1 change: 0 additions & 1 deletion plugins/mac-capture/mac-sck-common.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ struct API_AVAILABLE(macos(12.5)) screen_capture {
SCShareableContent *shareable_content;
ScreenCaptureDelegate *capture_delegate;

os_event_t *disp_finished;
os_event_t *stream_start_completed;
os_sem_t *shareable_content_available;
IOSurfaceRef current, prev;
Expand Down
8 changes: 0 additions & 8 deletions plugins/mac-capture/mac-sck-video-capture.m
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@
MACCAP_ERR("destroy_screen_stream: Failed to stop stream with error %s\n",
[[error localizedFailureReason] cStringUsingEncoding:NSUTF8StringEncoding]);
}
os_event_signal(sc->disp_finished);
}];
os_event_wait(sc->disp_finished);
}

if (sc->stream_properties) {
Expand Down Expand Up @@ -41,7 +39,6 @@
sc->disp = NULL;
}

os_event_destroy(sc->disp_finished);
os_event_destroy(sc->stream_start_completed);
}

Expand Down Expand Up @@ -110,7 +107,6 @@
MACCAP_ERR("init_screen_stream: Invalid target display ID: %u\n", sc->display);
os_sem_post(sc->shareable_content_available);
sc->disp = NULL;
os_event_init(&sc->disp_finished, OS_EVENT_TYPE_MANUAL);
os_event_init(&sc->stream_start_completed, OS_EVENT_TYPE_MANUAL);
return true;
}
Expand Down Expand Up @@ -152,7 +148,6 @@
MACCAP_ERR("init_screen_stream: Invalid target window ID: %u\n", sc->window);
os_sem_post(sc->shareable_content_available);
sc->disp = NULL;
os_event_init(&sc->disp_finished, OS_EVENT_TYPE_MANUAL);
os_event_init(&sc->stream_start_completed, OS_EVENT_TYPE_MANUAL);
return true;
} else {
Expand All @@ -172,7 +167,6 @@
MACCAP_ERR("init_screen_stream: Invalid target display ID: %u\n", sc->display);
os_sem_post(sc->shareable_content_available);
sc->disp = NULL;
os_event_init(&sc->disp_finished, OS_EVENT_TYPE_MANUAL);
os_event_init(&sc->stream_start_completed, OS_EVENT_TYPE_MANUAL);
return true;
}
Expand Down Expand Up @@ -217,7 +211,6 @@
if (sc->capture_type != ScreenCaptureWindowStream) {
sc->disp = NULL;
[content_filter release];
os_event_init(&sc->disp_finished, OS_EVENT_TYPE_MANUAL);
os_event_init(&sc->stream_start_completed, OS_EVENT_TYPE_MANUAL);
return true;
}
Expand Down Expand Up @@ -250,7 +243,6 @@
return !did_add_output;
}
}
os_event_init(&sc->disp_finished, OS_EVENT_TYPE_MANUAL);
os_event_init(&sc->stream_start_completed, OS_EVENT_TYPE_MANUAL);

__block BOOL did_stream_start = NO;
Expand Down

0 comments on commit 92d5b45

Please sign in to comment.