| Summary: | SDL_AudioInit, SDL_AudioQuit and again SDL_AudioInit crashes | ||
|---|---|---|---|
| Product: | SDL | Reporter: | Ellie <etc0de> |
| Component: | audio | Assignee: | Ryan C. Gordon <icculus> |
| Status: | RESOLVED FIXED | QA Contact: | Sam Lantinga <slouken> |
| Severity: | critical | ||
| Priority: | P2 | CC: | aschiffler |
| Version: | HG 2.0 | ||
| Hardware: | x86 | ||
| OS: | Windows (All) | ||
This doesn't crash for me on Windows now; it's possible we fixed the issue at some point. (It's worth noting that the test program doesn't fail the SDL_OpenAudio() call now, but if I set fmt.channels to 88 or something to force it to fail, the crash doesn't happen on the quit/reinit, either.) Can you confirm this is still giving you problems with the latest version of SDL? I'm happy to look into this further if you can still reproduce it. --ryan. I had this mainly tested in wine because float32 audio appeared to be unavailable which forced an audio reopen. On Windows, the example code usually worked because SDL_OpenAudio doesn't return an error (in which case this bug can NOT be reproduced). Sadly, I'm currently blocked by https://bugzilla.redhat.com/show_bug.cgi?id=983936 from wine testing. Recommend to close this bug as no-repro.
The test audio_initQuitAudio (which is part of the testautomation suite) and can be run with:
./testautomation.exe --filter audio_initQuitAudio
used to fail (and was disabled because of this bug).
The test passes now on cygwin as well as VS on my Win7 box.
$ ./testautomation.exe --filter audio_initQuitAudio
INFO: 07/07/14 20:15:02: ::::: Test Run /w seed '3LKSXORVDKCBUK75' started
INFO: 07/07/14 20:15:02: Filtering: running only test 'audio_initQuitAudio' in suite 'Audio'
INFO: 07/07/14 20:15:02: ===== Test Suite 1: 'Audio' started
INFO: 07/07/14 20:15:02: ===== Test Case 1.1: 'audio_enumerateAndNameAudioDevices' skipped
INFO: 07/07/14 20:15:02: ===== Test Case 1.2: 'audio_enumerateAndNameAudioDevicesNegativeTests' skipped
INFO: 07/07/14 20:15:02: ===== Test Case 1.3: 'audio_printAudioDrivers' skipped
INFO: 07/07/14 20:15:02: ===== Test Case 1.4: 'audio_printCurrentAudioDriver' skipped
INFO: 07/07/14 20:15:02: ===== Test Case 1.5: 'audio_buildAudioCVT' skipped
INFO: 07/07/14 20:15:02: ===== Test Case 1.6: 'audio_buildAudioCVTNegative' skipped
INFO: 07/07/14 20:15:02: ===== Test Case 1.7: 'audio_getAudioStatus' skipped
INFO: 07/07/14 20:15:02: ===== Test Case 1.8: 'audio_openCloseAndGetAudioStatus' skipped
INFO: 07/07/14 20:15:02: ===== Test Case 1.9: 'audio_lockUnlockOpenAudioDevice' skipped
INFO: 07/07/14 20:15:02: ===== Test Case 1.10: 'audio_convertAudio' skipped
INFO: 07/07/14 20:15:02: ===== Test Case 1.11: 'audio_openCloseAudioDeviceConnected' skipped
INFO: 07/07/14 20:15:02: ===== Test Case 1.12: 'audio_quitInitAudioSubSystem' skipped
INFO: 07/07/14 20:15:02: Force run of disabled test since test filter was set
INFO: 07/07/14 20:15:02: ----- Test Case 1.13: 'audio_initQuitAudio' started
INFO: 07/07/14 20:15:02: Test Description: 'Init and quit audio drivers directly.'
INFO: 07/07/14 20:15:02: Test Iteration 1: execKey 2135562624452638555
INFO: 07/07/14 20:15:02: Assert 'Call to SDL_InitSubSystem(SDL_INIT_AUDIO)': Pass
INFO: 07/07/14 20:15:02: Assert 'Check result from SDL_InitSubSystem(SDL_INIT_AUDIO)': Passed
INFO: 07/07/14 20:15:02: Assert 'Call to SDL_QuitSubSystem(SDL_INIT_AUDIO)': Pass
INFO: 07/07/14 20:15:02: Assert 'Call to SDL_GetNumAudioDrivers': Pass
INFO: 07/07/14 20:15:02: Assert 'Validate number of audio drivers; expected: >0 got: 4': Passed
INFO: 07/07/14 20:15:02: Assert 'Call to SDL_GetAudioDriver(0)': Pass
INFO: 07/07/14 20:15:02: Assert 'Audio driver name is not NULL': Passed
INFO: 07/07/14 20:15:02: Assert 'Audio driver name is not empty; got: directsound': Passed
INFO: 07/07/14 20:15:02: Assert 'Call to SDL_AudioInit('directsound')': Pass
INFO: 07/07/14 20:15:02: Assert 'Validate result value; expected: 0 got: 0': Passed
INFO: 07/07/14 20:15:02: Assert 'Call to SDL_AudioQuit()': Pass
INFO: 07/07/14 20:15:02: Assert 'Call to SDL_GetAudioDriver(1)': Pass
INFO: 07/07/14 20:15:02: Assert 'Audio driver name is not NULL': Passed
INFO: 07/07/14 20:15:02: Assert 'Audio driver name is not empty; got: winmm': Passed
INFO: 07/07/14 20:15:02: Assert 'Call to SDL_AudioInit('winmm')': Pass
INFO: 07/07/14 20:15:02: Assert 'Validate result value; expected: 0 got: 0': Passed
INFO: 07/07/14 20:15:02: Assert 'Call to SDL_AudioQuit()': Pass
INFO: 07/07/14 20:15:02: Assert 'Call to SDL_GetAudioDriver(2)': Pass
INFO: 07/07/14 20:15:02: Assert 'Audio driver name is not NULL': Passed
INFO: 07/07/14 20:15:02: Assert 'Audio driver name is not empty; got: disk': Passed
INFO: 07/07/14 20:15:02: Assert 'Call to SDL_AudioInit('disk')': Pass
INFO: 07/07/14 20:15:02: Assert 'Validate result value; expected: 0 got: 0': Passed
INFO: 07/07/14 20:15:02: Assert 'Call to SDL_AudioQuit()': Pass
INFO: 07/07/14 20:15:02: Assert 'Call to SDL_GetAudioDriver(3)': Pass
INFO: 07/07/14 20:15:02: Assert 'Audio driver name is not NULL': Passed
INFO: 07/07/14 20:15:02: Assert 'Audio driver name is not empty; got: dummy': Passed
INFO: 07/07/14 20:15:02: Assert 'Call to SDL_AudioInit('dummy')': Pass
INFO: 07/07/14 20:15:02: Assert 'Validate result value; expected: 0 got: 0': Passed
INFO: 07/07/14 20:15:02: Assert 'Call to SDL_AudioQuit()': Pass
INFO: 07/07/14 20:15:02: Assert 'Call to SDL_AudioInit(NULL)': Pass
INFO: 07/07/14 20:15:02: Assert 'Validate result value; expected: 0 got: 0': Passed
INFO: 07/07/14 20:15:02: Assert 'Call to SDL_AudioQuit()': Pass
INFO: 07/07/14 20:15:02: Assert 'Call to SDL_InitSubSystem(SDL_INIT_AUDIO)': Pass
INFO: 07/07/14 20:15:02: Assert 'Check result from SDL_InitSubSystem(SDL_INIT_AUDIO)': Passed
INFO: 07/07/14 20:15:02: Assert Summary: Total=34 Passed=34 Failed=0
INFO: 07/07/14 20:15:02: Total Test runtime: 0.0 sec
INFO: 07/07/14 20:15:02: >>> Test 'audio_initQuitAudio': Passed
INFO: 07/07/14 20:15:02: ===== Test Case 1.14: 'audio_initOpenCloseQuitAudio' skipped
INFO: 07/07/14 20:15:02: Total Suite runtime: 0.0 sec
INFO: 07/07/14 20:15:02: Suite Summary: Total=1 Passed=1 Failed=0 Skipped=0
INFO: 07/07/14 20:15:02: >>> Suite 'Audio': Passed
INFO: 07/07/14 20:15:02: Total Run runtime: 0.0 sec
INFO: 07/07/14 20:15:02: Run Summary: Total=1 Passed=1 Failed=0 Skipped=0
INFO: 07/07/14 20:15:02: >>> Run /w seed '3LKSXORVDKCBUK75': Passed
Thanks for confirming, Andreas. |
In an attempt to reopen audio at some point using another device, I ran into this crash which many windows users can reproduce (probably on machines without proper float 32bit support) and which I can reproduce myself on Linux in wine emulation: #include <windows.h> #include "SDL.h" void audiocallback(void *intentionally_unused, Uint8 *stream, int len) { memset(stream, 0, (unsigned int)len); } int main(int argc, char** argv) { SDL_Init(SDL_INIT_TIMER); SDL_AudioInit("waveout"); SDL_AudioSpec fmt; memset(&fmt,0,sizeof(fmt)); fmt.freq = 48000; fmt.format = AUDIO_F32SYS; fmt.channels = 2; fmt.samples = 4096; fmt.callback = audiocallback; fmt.userdata = NULL; if (SDL_OpenAudio(&fmt, NULL) < 0) { SDL_AudioQuit(); printf("We will crash right now:\n");fflush(stdout); SDL_AudioInit("directsound"); } printf("Or did we not?\n");fflush(stdout); return 0; } The only workaround is to use SDL_OpenAudio() again without using SDL_AudioQuit() in between. Since I assume that will result in memory leaks or even worse problems (does it even close the old device properly?), that is pretty odd.