Android: Use OpenSL ES for audio on TVs, add audio API and MMAP settings

An Android 11 TV played nothing over a Bluetooth headset since the switch
to Oboe, while its speakers worked. Testing on it showed AAudio with MMAP
is silent there and AAudio without MMAP works, as does OpenSL ES (also
when the headset is connected mid-game), whatever the stream usage. MMAP
should never be used for a Bluetooth route, so it's a firmware bug.

Audio settings get an Audio API choice and a Low-latency audio (MMAP)
checkbox, with hints, so other devices with the same kind of bug can be
worked around. The API defaults to OpenSL ES on TVs and before Android
8.1, where the choice isn't offered, and AAudio elsewhere. Changing them
reopens the streams right away. System Information shows the output
stream that got opened (API, MMAP or not, rate, buffers, device) and any
audio error.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Henrik RydgårdandClaude Opus 5.5 committed 2026-10-24 23:58:42 +02:00
1 parent b438655479
commit a5c90b61df
8 files changed
+129 -12

No files matched your search

+13
View File
@@ -30,6 +30,12 @@
#include "UI/OnScreenDisplay.h"
#include "android/jni/app-android.h"
#if PPSSPP_PLATFORM(ANDROID)
#include "android/jni/AndroidAudio.h"
extern AndroidAudioState *g_audioState;
#endif
void SystemInfoScreen::update() {
UITabbedBaseDialogScreen::update();
g_OSD.NudgeIngameNotifications();
@@ -433,6 +439,13 @@ void SystemInfoScreen::CreateAudioInfoTab(UI::LinearLayout *audio) {
audioInformation->Add(new InfoItem(a->T("Audio Error"), error.empty() ? di->T("None") : error));
} else {
audioInformation->Add(new InfoItem(si->T("Sample rate"), StringFromFormat(si->T_cstr("%d Hz"), System_GetPropertyInt(SYSPROP_AUDIO_SAMPLE_RATE))));
#if PPSSPP_PLATFORM(ANDROID)
// What actually got opened: the API, whether it's MMAP, the device's rate and buffers.
const std::string streamInfo = AndroidAudio_GetInfoString(g_audioState);
audioInformation->Add(new InfoItem(si->T("Stream format"), streamInfo.empty() ? di->T("None") : streamInfo));
const std::string error = AndroidAudio_GetErrorString(g_audioState);
audioInformation->Add(new InfoItem(a->T("Audio Error"), error.empty() ? di->T("None") : error));
#endif
}
int framesPerBuffer = System_GetPropertyInt(SYSPROP_AUDIO_FRAMES_PER_BUFFER);
if (framesPerBuffer > 0) {