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

Closed
opened 2020-04-10 00:24:43 -05:00 by jbeich · 6 comments
jbeich commented 2020-04-10 00:24:43 -05:00 (Migrated from github.com)

Regressed by a0f859c761

$ 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
Regressed by a0f859c761bb ```c $ 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 commented 2020-04-10 08:52:05 -05:00 (Migrated from github.com)

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.

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 commented 2020-04-21 13:44:41 -05:00 (Migrated from github.com)

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.

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 commented 2020-05-13 12:52:30 -05:00 (Migrated from github.com)
Emscripten is affected by this as well: https://hg.libsdl.org/SDL/file/4709c1dfeabb/src/audio/emscripten/SDL_emscriptenaudio.c#l192
flibitijibibo commented 2020-05-14 10:38:35 -05:00 (Migrated from github.com)
SDL issue has been filed: https://bugzilla.libsdl.org/show_bug.cgi?id=5136
flibitijibibo commented 2021-03-01 08:43:35 -06:00 (Migrated from github.com)

SDL issue was moved to GitHub: https://github.com/libsdl-org/SDL/issues/3685

SDL issue was moved to GitHub: https://github.com/libsdl-org/SDL/issues/3685
flibitijibibo commented 2021-04-20 09:25:21 -05:00 (Migrated from github.com)

Doing a bit of spring cleaning...

See https://github.com/libsdl-org/SDL/issues/3685 for more on this issue, on the FAudio side this is closed as NOTOURBUG.

Doing a bit of spring cleaning... See https://github.com/libsdl-org/SDL/issues/3685 for more on this issue, on the FAudio side this is closed as NOTOURBUG.
Sign in to join this conversation.
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
gh-FNA-XNA/FAudio#183
No description provided.