libsdl-org / SDL

Simple Directmedia Layer
https://libsdl.org
zlib License
9.46k stars 1.76k forks source link

[uwp] testaudiocapture hangs on start #7629

Open madebr opened 1 year ago

madebr commented 1 year ago

The testaudiocapture test hangs on start-up. A black window is drawn, but it does not work (no messages are pumped).

The output thus far was:

INFO: Using audio driver: wasapi
INFO:  Capture device #0: 'Microphone (Realtek High Definition Audio)'
INFO: Opening default playback device...
INFO: Opening capture device [[default]]...

The call stack is:

    [External Code] 
>   SDL3.dll!WASAPI_WaitDevice(SDL_AudioDevice * this) Line 199 C
    SDL3.dll!SDL_RunAudio(void * devicep) Line 735  C
    SDL3.dll!SDL_RunThread(SDL_Thread * thread) Line 294    C
    SDL3.dll!RunThread(void * data) Line 50 C
    SDL3.dll!RunThreadViaCreateThread(void * data) Line 64  C
    [External Code] 

I added the following to the Capabilities item of the .appxmanifest.

    <DeviceCapability Name="microphone"/>
madebr commented 1 year ago

FYI, the output of testaudioinfo is:

INFO: Built-in audio drivers:
INFO:   0: wasapi
INFO:   1: disk
INFO:   2: dummy
INFO: Select a driver with the SDL_AUDIO_DRIVER environment variable.
INFO: Using audio driver: wasapi

INFO: Found 1 output device:
INFO:   0: Speakers (Realtek High Definition Audio)
INFO:      Sample Rate: 48000
INFO:      Channels: 2
INFO:      SDL_AudioFormat: 8020
INFO: 
INFO: Found 1 capture device:
INFO:   0: Microphone (Realtek High Definition Audio)
INFO:      Sample Rate: 44100
INFO:      Channels: 2
INFO:      SDL_AudioFormat: 8010
INFO: 
INFO: Error when calling SDL_GetDefaultAudioInfo: That operation is not supported
INFO: Error when calling SDL_GetDefaultAudioInfo: That operation is not supported

(it does not fail)

madebr commented 1 year ago

The failure mode of testaudiocapture has changed. The following is printed to stdout:

INFO: Opening capture device [[default]]...
Exception thrown at 0x00007FFBCA77CF19 (KernelBase.dll) in testaudiocapture.exe: 0x40080202: WinRT transform error (parameters: 0x000000008000000B, 0x0000000080070490, 0x0000000000000014, 0x000000B4B92FDD30).
avcore\audiocore\client\audioclient\audioclientcore.cpp(1501)\AUDIOSES.DLL!00007FFBC08E74E5: (caller: 00007FFBC08C4FD5) ReturnHr(1) tid(ad8) 80070490 Element not found.
ERROR: Couldn't open an audio device for capture: WASAPI can't initialize audio client: !

The output of testaudioinfo is:

INFO: Built-in audio drivers:
INFO:   0: wasapi
INFO:   1: disk
INFO:   2: dummy
INFO: Select a driver with the SDL_AUDIO_DRIVER environment variable.
INFO: Using audio driver: wasapi

INFO: Found 1 output device:
INFO:   0: Speakers (Realtek High Definition Audio)
INFO:      Sample Rate: 48000
INFO:      Channels: 2
INFO:      SDL_AudioFormat: 8020
INFO: 
INFO: Found 1 capture device:
INFO:   0: Microphone (Realtek High Definition Audio)
INFO:      Sample Rate: 44100
INFO:      Channels: 2
INFO:      SDL_AudioFormat: 8010
INFO: 
INFO: Default Output Device:
INFO: Sample Rate: 48000
INFO: Channels: 2
INFO: SDL_AudioFormat: 8020
INFO: Default Capture Device:
INFO: Sample Rate: 44100
INFO: Channels: 2
INFO: SDL_AudioFormat: 8010
slouken commented 10 months ago

This should be fixed, please reopen if you're still seeing this.

madebr commented 10 months ago

This is still happening:

INFO: Opening capture device [[default]]...
Exception thrown at 0x00007FFAA22DCF19 (KernelBase.dll) in testaudiocapture.exe: 0x40080202: WinRT transform error (parameters: 0x000000008000000B, 0x0000000080070490, 0x0000000000000014, 0x00000042382FDA40).
avcore\audiocore\client\audioclient\audioclientcore.cpp(1501)\AUDIOSES.DLL!00007FFA983174E5: (caller: 00007FFA982F4FD5) ReturnHr(1) tid(4948) 80070490 Element not found.
ERROR: Couldn't open an audio device for capture: WASAPI can't initialize audio client: !
INFO: Shutting down.

Using d9e6dcc650fd96c66d1177438d1e0ee9b624c21c