Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crashes when SDL backend requires pow2 quantum (OSS, Emscripten) #183

Closed
jbeich opened this issue Apr 10, 2020 · 6 comments
Closed

Crashes when SDL backend requires pow2 quantum (OSS, Emscripten) #183

jbeich opened this issue Apr 10, 2020 · 6 comments

Comments

@jbeich
Copy link

jbeich commented Apr 10, 2020

Regressed by a0f859c

$ cmake -DBUILD_TESTS=ON
$ make

$ SDL_AUDIODRIVER=dsp ./faudio_tests
INFO: OpenAudioDevice failed: Fragment size must be a power of two
WARN:

Assertion failure at FAudio_PlatformInit (src/FAudio_platform_sdl2.c:133), triggered 1 time:
  '0 && "Failed to open audio device!"'

Abort/Break/Retry/Ignore/AlwaysIgnore? [abriA] : A

Process 26959 stopped
* thread #1, name = 'faudio_tests', stop reason = signal SIGSEGV: invalid address (fault address: 0xd4)
    frame #0: 0x000000080028fd9a libFAudio.so.0`FAudio_INTERNAL_VoiceOutputFrequency(voice=0x000000080f62d000, pSendList=0x0000000000000000) at FAudio_internal.c:1415:48
   1412         if ((pSendList == NULL) || (pSendList->SendCount == 0))
   1413         {
   1414                 /* When we're deliberately given no sends, use master rate! */
-> 1415                 outSampleRate = voice->audio->master->master.inputSampleRate;
   1416         }
   1417         else
   1418         {
(lldb) bt
* thread #1, name = 'faudio_tests', stop reason = signal SIGSEGV: invalid address (fault address: 0xd4)
  * frame #0: 0x000000080028fd9a libFAudio.so.0`FAudio_INTERNAL_VoiceOutputFrequency(voice=0x000000080f62d000, pSendList=0x0000000000000000) at FAudio_internal.c:1415:48
    frame #1: 0x0000000800281dbe libFAudio.so.0`FAudio_CreateSourceVoice(audio=0x000000080f62c000, ppSourceVoice=0x00007fffffffdfc8, pSourceFormat=0x00007fffffffdfa0, Flags=0, MaxFrequencyRatio=1, pCallback=0x000000000020a170, pSendList=0x0000000000000000, pEffectChain=0x0000000000000000) at FAudio.c:477:2
    frame #2: 0x0000000000203d8a faudio_tests`test_simple_streaming(xa=0x000000080f62c000) at xaudio2.c:370:5
    frame #3: 0x0000000000203435 faudio_tests`main(argc=1, argv=0x00007fffffffe098) at xaudio2.c:1279:13
    frame #4: 0x000000000020315f faudio_tests`_start(ap=<unavailable>, cleanup=<unavailable>) at crt1.c:76:7
@flibitijibibo
Copy link
Member

This sounds like an issue with SDL - when the backend has specific needs for sample period size it should override the value and trigger creation of an SDL_AudioStream to act as a buffer between the client and server. You’ll see this with both the WASAPI and PulseAudio backends.

@flibitijibibo
Copy link
Member

Confirmed, this is the issue: https://hg.libsdl.org/SDL/file/22dcbdfe45ea/src/audio/dsp/SDL_dspaudio.c#l211

This should be falling back to a nearest-power-of-two, which will trigger an SDL_AudioStream in SDL. I would report this at the SDL Bugzilla (maybe CC whoever maintains SDL for FreeBSD), this already works with other backends.

@flibitijibibo
Copy link
Member

@flibitijibibo flibitijibibo changed the title Crashes when SDL uses OSS backend (default on DragonFly and FreeBSD) Crashes when SDL backend requires pow2 quantum (OSS, Emscripten) May 13, 2020
@flibitijibibo
Copy link
Member

SDL issue has been filed: https://bugzilla.libsdl.org/show_bug.cgi?id=5136

@flibitijibibo
Copy link
Member

SDL issue was moved to GitHub: libsdl-org/SDL#3685

@flibitijibibo
Copy link
Member

Doing a bit of spring cleaning...

See libsdl-org/SDL#3685 for more on this issue, on the FAudio side this is closed as NOTOURBUG.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants