From 301da63a15de8cfbe752ac44784db9b58cdd2d87 Mon Sep 17 00:00:00 2001 From: xbzk Date: Fri, 11 Sep 2026 21:38:12 +0200 Subject: [PATCH] [audio] hint openslES as audio driver on android to fix mute screen recording issue (#4397) - [x] I have read and followed the [Contribution Guidelines](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/CONTRIBUTING.md#code-contributions). - [x] I have read and followed the [AI Policy](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/docs/policies/AI.md) - [x] I have read and followed the [Coding Guidelines](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/docs/policies/Coding.md) to the best of my ability. ------------------- After audio backend migration some android devices screen captures became mute. Liz instructed to enable openSL ES via some SDL hint. Found the proper one in https://wiki.libsdl.org/SDL3/SDL_HINT_AUDIO_DRIVER. Added it restricted to android. UPDATE: Got myself wondering how things work on SDL after using that hint, and checked that one must provide a list of drivers "opensles,aaudio,..." to be attempted. Afraid of some devices failing on openSL ES, and to avoid hand providing entire list, i've added fallback logic so entire SDL's driver list can be tried just in case. Default list in https://github.com/libsdl-org/SDL/blob/release-3.4.14/src/audio/SDL_audio.c. Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/4397 Reviewed-by: MaranBr Reviewed-by: lizzie --- src/audio_core/sink/sdl3_sink.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/audio_core/sink/sdl3_sink.cpp b/src/audio_core/sink/sdl3_sink.cpp index 4816b17259..69558eabec 100644 --- a/src/audio_core/sink/sdl3_sink.cpp +++ b/src/audio_core/sink/sdl3_sink.cpp @@ -28,10 +28,18 @@ namespace { // // Keep in sync with cubeb_sink.cpp name. SDL_SetHint("SDL_AUDIO_DEVICE_APP_NAME", "yuzu Latency Getter"); +#ifdef __ANDROID__ + SDL_SetHintWithPriority(SDL_HINT_AUDIO_DRIVER, "openslES", SDL_HINT_OVERRIDE); if (!SDL_InitSubSystem(SDL_INIT_AUDIO)) { + LOG_WARNING(Audio_Sink, "OpenSL ES audio initialization failed: {}; retrying default drivers", SDL_GetError()); + SDL_ResetHint(SDL_HINT_AUDIO_DRIVER); + } +#endif + if (!SDL_WasInit(SDL_INIT_AUDIO) && !SDL_InitSubSystem(SDL_INIT_AUDIO)) { LOG_CRITICAL(Audio_Sink, "SDL_InitSubSystem audio failed: {}", SDL_GetError()); return false; } + LOG_INFO(Audio_Sink, "SDL audio driver: {}", SDL_GetCurrentAudioDriver()); } return true; }