Skip to content

Move virtual camera shutdown to subscription in service.#5937

Draft
michelinewu wants to merge 1 commit into
masterfrom
mw_virtual_cam_shutdown
Draft

Move virtual camera shutdown to subscription in service.#5937
michelinewu wants to merge 1 commit into
masterfrom
mw_virtual_cam_shutdown

Conversation

@michelinewu
Copy link
Copy Markdown
Contributor

Avoid unnecessary VirtualWebcamService initialization during app shutdown

Issues

shutdownHandler() in AppService explicitly called stop() on VirtualWebcamService. Because services load lazily, this caused the service to be instantiated at shutdown time, even when the user never used the virtual camera during the session, triggering unnecessary OBS calls (Windows (OBS_service_isVirtualCamPluginInstalled) and Mac (OBS_service_createVirtualCam)) on every app close.

Fixes

VirtualWebcamService.init() now subscribes to AppService.shutdownStarted, a Subject that fires early in the shutdown sequence before OBS is torn down. Since Subject.next() and stop() are both synchronous, the virtual cam is stopped inline before shutdown continues. The subscription only exists if the service was actually instantiated during the session, so users who never use virtual camera incur no cost. AppService no longer imports or references VirtualWebcamService.

File(s) changed:

  • desktop/app/services/app/app.ts
  • desktop/app/services/virtual-webcam.ts

Performance Implications

Scenario Before After
Virtual cam never used VirtualWebcamService instantiated + init() run + OBS API called at shutdown Skipped entirely
Virtual cam was used stop() called from shutdownHandler stop() called via shutdownStarted subscription

@bundlemon
Copy link
Copy Markdown

bundlemon Bot commented May 22, 2026

BundleMon

Files updated (1)
Status Path Size Limits
renderer.(hash).js
7.77MB (+28B 0%) -
Unchanged files (3)
Status Path Size Limits
vendors~renderer.(hash).js
4.67MB -
updater.js
115.29KB -
guest-api.js
40.23KB -

Total files change +28B 0%

Final result: ✅

View report in BundleMon website ➡️


Current branch size history | Target branch size history

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant