Andersama / obs-asio

ASIO plugin for OBS-Studio
GNU General Public License v3.0
684 stars 43 forks source link

When console is powered off with OBS active, Windows locks up #60

Closed PaulGriffithAthens closed 3 years ago

PaulGriffithAthens commented 4 years ago

We are using a Yamaha TF-1 digital audio mixer, feeding OBS running under Windows 10 via USB. This is exactly what this plugin is for, and it works very well.

The problem comes if the audio equipment gets powered off before the computer when shutting down after use. Specifically, if OBS is still running on the computer. In this scenario, Windows completely locks up. (Have not tested what happens if the computer boots all the way up into OBS without the console first being powered on.)

Is this a known problem? Is there a solution for it? We have volunteers operating a live stream, and in spite of training we are probably going to have a problem with this going forward...

Thank you!

pkviet commented 4 years ago

mmh i've repro'd your bug; it's really shitty, I don't know how I had not encountered it. Till I find a fix, try the bassasio obs-asio version of the plugin. I can't release it though since the bassasio lib is not open source. So you'll have to compile it. Or wait till I set up some CI for it, enabling people to build it themselves using github actions for instance.

PaulGriffithAthens commented 4 years ago

Thank you for the swift response! To anyone reading, we are referring to the juce version of the plugin, version 2.0.2.

I've found the instructions for compiling the bassasio version, noting the link here if anyone else cares to try this:

https://github.com/Andersama/obs-asio/wiki/Compilation-instructions

I'll let you know how it works. If you do come up with a fix for the or simplified compilation for the bassasio, please post here.

Thanks, again!

Andersama commented 4 years ago

I don't remember considering a power loss when writing the code, there's likely an issue with the asio thread dangling with no asio device feeding it / not being able to respond to kill commands. In my testing scenarios I had multiple asio devices alive although maybe not outputting, but I definitely never tested the code's response to a sudden power outage to the audio device.

I'm guessing the Yamaha is the only asio device you have plugged in when you're cutting it's power? If you can disconnect it via software does it lock up when shutting off windows? If it doesn't it should be doing what I'd expect which is send an asio disconnect signal that juce will respond to.

PaulGriffithAthens commented 4 years ago

We are using only the Yamaha mixer as an ASIO source device.

Do you mean remove the Yamaha as a source in OBS? There would be a lot of re-configuration of all of the audio settings if we did that. Perhaps create a new setup in OBS which does not include it, and switch to that setup? It might work, but rather than that, it's actually much easier to just close out OBS, after which there is no difficulty. The problem arises when we power down our equipment in an order which creates a lockup. If OBS doesn't get shut down before the audio setup, it's a very destructive error. With multiple users (some on streaming, some on audio), this is a scenario which we can warn about but which can be easily overlooked in the rush by volunteers to close down and go to their waiting families...

Andersama commented 4 years ago

No not quite, with some asio devices the driver / software provides some kind of disconnect option. If implemented properly that would have the asio device send a disconnect message to any of its clients. The juce library we're using can respond to those. I wanted to see if the power off prevents a disconnect message from begin sent (what I should've expected / thought about).

I went over the code a bit, I sent some code over to pkv to test, since he can replicate your bug he should be able to verify if any my patches fix your issue.

Are you able to compile the code on your own? Since pkv's not here, I could give you my patches to test yourself.

PaulGriffithAthens commented 4 years ago

I had a long look at the “bassasio” information earlier today, but I’m afraid it’s out of my expertise/comfort zone to try to compile it myself. Undoubtedly the same with this. I would be happy to test a compiled version for you, however.

I greatly appreciate what you’re doing! It’s a great plugin, and it really gives me the flexibility which Yamaha’s Steinberg USB driver somehow doesn’t. Thank you!

Andersama commented 4 years ago

Well actually that's an okay test for me, you don't have this issue* w/ bassasio?

PaulGriffithAthens commented 4 years ago

In the end, I didn't attempt to compile bassasio... Sorry I can't be more helpful in this respect.

Andersama commented 4 years ago

No worries, since it's been so long since I've touched the code it was a bit like going over it with a second set of eyes. I'm vaguely confident in what the issue was and a patch to solve it. I was hoping for a bit more to verify my hunch even if I'm not setup to test it.

pkviet commented 4 years ago

I'm not sure any more I repro'd your bug @PaulGriffithAthens I tested with an usb asio device; it doesn't have an on/off switch. If I unplug the usb while obs is streaming its ausdio, I have a BSOD, not a crash. BUT I don't think it's an obs nor obs-asio issue, because I retested with a DAW (Reaper); if I unplug, I BSOD all the same. So imo, why I got is different from your issue. BTW, I also BSOD with bassasio plugin. I'd need to be able to test with this Yamaha device. There's only so much we can try without a device

PaulGriffithAthens commented 4 years ago

Thanks for your work on this, @pkviet. If you can give me a compiled version, I'll drive over to the site and test it for you.

In our case, we haven't had the blue screen of death. What we do is power off the Yamaha mixer by using a power strip, after which the Windows computer is locked up -- unresponsive.

Are you OK with providing me a ready-to-install version so that I can try it for you?

Thanks again!

pkviet commented 4 years ago

@PaulGriffithAthens ping me on obs discord server

PaulGriffithAthens commented 4 years ago

Not sure how to do that...

pkviet commented 4 years ago

Go to obs website, help section. There's a link to obs discord server. Over there, go to the dev channel and ping me @pkv

PaulGriffithAthens commented 4 years ago

Done