Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Microphone streaming causes windows to not sleep/hibernate #57

Closed
barrj4 opened this issue Aug 30, 2022 · 11 comments · Fixed by #204
Closed

Microphone streaming causes windows to not sleep/hibernate #57

barrj4 opened this issue Aug 30, 2022 · 11 comments · Fixed by #204
Labels
bug Something isn't working good first issue Good for newcomers

Comments

@barrj4
Copy link

barrj4 commented Aug 30, 2022

Microphone recording stops windows from windows from sleeping on its own. From the terminal command "powercfg -requests" with the application in the task bar (WOW not running):

C:\WINDOWS\system32>powercfg -requests
DISPLAY:
None.

SYSTEM:
[DRIVER] Steam Streaming Microphone (ROOT\SteamStreamingMicrophone\0000)
An audio stream is currently in use.
[DRIVER] USB Audio 2.0 (USB\VID_30BE&PID_0101&MI_00\6&3c99bba&0&0000)
An audio stream is currently in use.
[DRIVER] USB Audio Device (USB\VID_0D8C&PID_9600&MI_00\6&2f66cdae&0&0000)
An audio stream is currently in use.
[DRIVER] Legacy Kernel Caller

AWAYMODE:
None.

EXECUTION:
None.

PERFBOOST:
None.

ACTIVELOCKSCREEN:
None.

After closing the wow-recorder app:

C:\WINDOWS\system32>powercfg -requests
DISPLAY:
None.

SYSTEM:
None.

AWAYMODE:
None.

EXECUTION:
None.

PERFBOOST:
None.

ACTIVELOCKSCREEN:
None.
@aza547
Copy link
Owner

aza547 commented Aug 30, 2022

Thanks for the report. Will look at fixing soon.

@aza547 aza547 added bug Something isn't working good first issue Good for newcomers labels Aug 30, 2022
@tdaugaard
Copy link
Contributor

I was doing a few tests on this yesterday and I think it stems from OBS recording in the background before the actual recording of content is triggered. Is that a fair assumption?

I tried a simple commenting out of setupSources() first, and then osn.Global.setOutputSource() later and found the latter to fix the problem, but then obviously OBS won't record any sound at all ;)

@tdaugaard
Copy link
Contributor

This can only realistically be fixed by not recording sound (disabling the sound sources) while recording the buffer and only enabling the sound when we detect an event that starts the recording, but that obviously would mean we could lose up to like 30 seconds of audio in the beginning.

@barrj4
Copy link
Author

barrj4 commented Oct 12, 2022

Would it be possible to check if the game is running and if not just stop recording to the buffer? the game will also stop windows from sleeping.

@tdaugaard
Copy link
Contributor

Yes, that would totally be possible and an easy fix.

@aza547
Copy link
Owner

aza547 commented Oct 13, 2022

Would it be possible to check if the game is running and if not just stop recording to the buffer? the game will also stop windows from sleeping.

We already do this?

@tdaugaard
Copy link
Contributor

We already do this?

Yes, but the audio sources are still being kept open by OBS even if you stop buffer recording. Check out #204 for a possible fix to this.

@aza547
Copy link
Owner

aza547 commented Nov 4, 2022

I've backed this out as the fix was causing #220

@aza547 aza547 reopened this Nov 4, 2022
@aza547
Copy link
Owner

aza547 commented Dec 29, 2022

A fix for this is finally coming in the next release.

@aza547
Copy link
Owner

aza547 commented Jan 1, 2023

Ugh, design changed a bit and makes this harder: https://obsproject.com/forum/threads/obs-prevents-screen-sleep-any-work-around.111687/.

Seems that if OBS is initialized we'll never be able to sleep.

A good option seems to be shutdown OBS when WoW is closed - but that takes a few seconds of synchronous programming that isn't acceptable from a UX point of view.

I'm going to look at how I can use Node to do this in a separate thread. Seems gross, but the alternate is having the app lock up for 2-3s every time WoW opens/closes.

@aza547
Copy link
Owner

aza547 commented Jan 1, 2023

OK, back in business on this.

I re-examined the fix @tdaugaard made and found the issue which was it was clearing the video source in addition to the audio sources.

Fixed in the next release, so closing.

@aza547 aza547 closed this as completed Jan 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants