Commit e986c7984b60d96c13c9e29225233922808f91a1

Ryan C. Gordon 2022-12-12T16:07:48

wasapi: Fixed incorrect assertions. Fixes #6795. (cherry picked from commit 12486e144be0e7a37abd87b8bf90547a992ff66b)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
diff --git a/src/audio/wasapi/SDL_wasapi_winrt.cpp b/src/audio/wasapi/SDL_wasapi_winrt.cpp
index 7615b3f..744e421 100644
--- a/src/audio/wasapi/SDL_wasapi_winrt.cpp
+++ b/src/audio/wasapi/SDL_wasapi_winrt.cpp
@@ -182,13 +182,13 @@ void SDL_WasapiDeviceEventHandler::OnEnumerationCompleted(DeviceWatcher ^ sender
 
 void SDL_WasapiDeviceEventHandler::OnDefaultRenderDeviceChanged(Platform::Object ^ sender, DefaultAudioRenderDeviceChangedEventArgs ^ args)
 {
-    SDL_assert(this->iscapture);
+    SDL_assert(!this->iscapture);
     SDL_AtomicAdd(&SDL_IMMDevice_DefaultPlaybackGeneration, 1);
 }
 
 void SDL_WasapiDeviceEventHandler::OnDefaultCaptureDeviceChanged(Platform::Object ^ sender, DefaultAudioCaptureDeviceChangedEventArgs ^ args)
 {
-    SDL_assert(!this->iscapture);
+    SDL_assert(this->iscapture);
     SDL_AtomicAdd(&SDL_IMMDevice_DefaultCaptureGeneration, 1);
 }