mirror of
https://git.eden-emu.dev/eden-emu/eden.git
synced 2026-09-11 22:32:29 +00:00
[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 <maranbr@eden-emu.dev> Reviewed-by: lizzie <lizzie@eden-emu.dev>
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user