Bug Report
Description
No audio output in Minecraft Bedrock when using the SDL3 audio backend. FMOD initialization fails with error code 28 (FMOD_ERR_OUTPUT_INIT). System audio works perfectly in all other applications.
Root Cause
Three bugs in fake_audio.cpp combine to cause audio failure:
1. Unvalidated SDL_GetAudioDeviceFormat return value
updateDefaults() calls SDL_GetAudioDeviceFormat() without checking the return value. On PipeWire with SDL3, this call can fail, leaving uninitialized stack values (e.g., freq=0, channels=11, sampleFrames=-495316880) which overwrite the sensible defaults.
2. Missing AAudio builder configuration hooks
FMOD calls AAudioStreamBuilder_setSampleRate(), setChannelCount(), and setFormat() to configure the audio stream — but these functions were not hooked. The requested configuration was silently discarded.
3. Wrong stream state for newly created streams
AAudioStream_getState() returns AAUDIO_STREAM_STATE_CLOSED when stream->s == NULL. But after openStream() and before requestStart(), the state should be AAUDIO_STREAM_STATE_OPEN. FMOD checks this and aborts when it sees CLOSED.
Log Output
getSampleRate: 0
getChannelCount: 11
getChannelCount: -495316880
FMOD_System_Init returned 28
Affected Systems
- Any Linux system using PipeWire as audio server
- Systems where
SDL_GetAudioDeviceFormat(SDL_AUDIO_DEVICE_DEFAULT_PLAYBACK, ...) fails
- Some PulseAudio setups
Test System
| Component |
Details |
| OS |
Kubuntu 24.04.4 LTS, Kernel 6.17.0-19-generic |
| Audio |
PipeWire 1.0.5 |
| Audio Devices |
Yamaha ZG01, Astro A50, Razer Kiyo Pro, HDMI |
| MC |
Bedrock Edition 1.26.0.2 via mcpelauncher (ng branch, SDL3 audio) |
Fix
PR #133 fixes all three issues:
- Zero-initializes
SDL_AudioSpec and validates the return value — keeps defaults (48000 Hz, 2 ch, 512 frames) if SDL call fails
- Adds hooks for
AAudioStreamBuilder_setSampleRate, setChannelCount, setFormat — stores and propagates builder config to the stream
- Returns
AAUDIO_STREAM_STATE_OPEN instead of CLOSED for streams that exist but haven't started yet
See PR #133 for full implementation details and documentation.
Bug Report
Description
No audio output in Minecraft Bedrock when using the SDL3 audio backend. FMOD initialization fails with error code 28 (
FMOD_ERR_OUTPUT_INIT). System audio works perfectly in all other applications.Root Cause
Three bugs in
fake_audio.cppcombine to cause audio failure:1. Unvalidated
SDL_GetAudioDeviceFormatreturn valueupdateDefaults()callsSDL_GetAudioDeviceFormat()without checking the return value. On PipeWire with SDL3, this call can fail, leaving uninitialized stack values (e.g.,freq=0,channels=11,sampleFrames=-495316880) which overwrite the sensible defaults.2. Missing AAudio builder configuration hooks
FMOD calls
AAudioStreamBuilder_setSampleRate(),setChannelCount(), andsetFormat()to configure the audio stream — but these functions were not hooked. The requested configuration was silently discarded.3. Wrong stream state for newly created streams
AAudioStream_getState()returnsAAUDIO_STREAM_STATE_CLOSEDwhenstream->s == NULL. But afteropenStream()and beforerequestStart(), the state should beAAUDIO_STREAM_STATE_OPEN. FMOD checks this and aborts when it seesCLOSED.Log Output
Affected Systems
SDL_GetAudioDeviceFormat(SDL_AUDIO_DEVICE_DEFAULT_PLAYBACK, ...)failsTest System
ngbranch, SDL3 audio)Fix
PR #133 fixes all three issues:
SDL_AudioSpecand validates the return value — keeps defaults (48000 Hz, 2 ch, 512 frames) if SDL call failsAAudioStreamBuilder_setSampleRate,setChannelCount,setFormat— stores and propagates builder config to the streamAAUDIO_STREAM_STATE_OPENinstead ofCLOSEDfor streams that exist but haven't started yetSee PR #133 for full implementation details and documentation.