stijnvdb88 / Snap.Net

A cross-platform control client and player for https://github.com/badaix/snapcast
GNU General Public License v3.0
121 stars 11 forks source link

Changing Windows' volume sometimes causes error for Realtek High Definition Audio #5

Closed ICTman1076 closed 3 years ago

ICTman1076 commented 4 years ago

If I change the volume of my laptop using the standard Windows controls, Snap.net displays this error:

image

It then disables playback on that audio device. It does not always occur, but has happened to me a few times, and the last 2 times it happened as I changed volume (I wasn't paying attention the first time). Audio was not playing.

The audio devices I have: image

Running Version 0.20.0.0 on Windows 10 version 1909 on a Lenovo Yoga 510.

stijnvdb88 commented 4 years ago

Hi! Thanks for reporting the issue - it's a very difficult one to track down! Has it been happening often for you? It took me a week to be able to reproduce it with a debugger attached - the crash is happening in snapclient:

Exception thrown at 0x00007FF92A8EA799 in snapclient.exe: Microsoft C++ exception: int at memory location 0x00000037603F6F44.
Exception thrown at 0x00007FF9236102E7 (AudioSes.dll) in snapclient.exe: 0xC0000005: Access violation reading location 0xFFFFFFFFFFFFFFFF.

I will try to fix it, but could use your help in trying to figure out how to reproduce the issue :) It did happen when changing the Windows volume like you said, but there must be some condition before that as well (99% of the time, changing Windows volume did not cause it to crash). In my case, audio was playing

ICTman1076 commented 4 years ago

I also find it difficult to reproduce if I try, it tends to just happen when I'm doing something else. It's not happened to me while playing audio, but I haven't really been using snapcast recently so maybe I'm just yet to experience it.

I will have a fiddle around and see if I can work it out.

lucianm commented 3 years ago

Confirming this error also with the current Snap.Net 0.22.0.1

stijnvdb88 commented 3 years ago

H again! I finally realized what was causing this: anything that causes snapclient's WasapiPlayer to be re-initialized (eg. switching streams), and then changing Windows volume. Just sent a PR with the fix, the crash should be gone with the next release of snapcast (0.25.0). Thanks again for reporting the issue :)