mirror of
https://github.com/badaix/snapcast.git
synced 2025-06-06 04:41:44 +02:00
Wasapi player: unregister system volume change callback on player destroy. Fixes crash when changing Windows volume after switching streams
Wasapi player: unregister system volume change callback on player destroy. Fixes crash when changing Windows volume after switching streams
This commit is contained in:
parent
ea1236feef
commit
af621acf1c
2 changed files with 3 additions and 2 deletions
|
@ -83,6 +83,7 @@ WASAPIPlayer::WASAPIPlayer(boost::asio::io_context& io_context, const ClientSett
|
|||
|
||||
WASAPIPlayer::~WASAPIPlayer()
|
||||
{
|
||||
audioEndpointListener_->UnregisterControlChangeNotify(&audioEndpointVolumeCallback_);
|
||||
WASAPIPlayer::stop();
|
||||
}
|
||||
|
||||
|
@ -250,10 +251,9 @@ void WASAPIPlayer::worker()
|
|||
hr = control->RegisterAudioSessionNotification(audioEventListener_);
|
||||
CHECK_HR(hr);
|
||||
|
||||
AudioEndpointVolumeCallback audioEndpointVolumeCallback;
|
||||
hr = device->Activate(IID_IAudioEndpointVolume, CLSCTX_ALL, NULL, (void**)&audioEndpointListener_);
|
||||
|
||||
audioEndpointListener_->RegisterControlChangeNotify((IAudioEndpointVolumeCallback*)&audioEndpointVolumeCallback);
|
||||
audioEndpointListener_->RegisterControlChangeNotify((IAudioEndpointVolumeCallback*)&audioEndpointVolumeCallback_);
|
||||
|
||||
// Get the device period
|
||||
REFERENCE_TIME hnsRequestedDuration = REFTIMES_PER_SEC;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue