From 9dae0575c0b51c7248a19024f482e7fcc34c6b86 Mon Sep 17 00:00:00 2001 From: The412Banner Date: Mon, 12 Oct 2026 20:39:48 -0400 Subject: [PATCH] Client sound retries a briefly disconnected AAudio; kbase ioctl refusals explained in the report A Galaxy S24 FE's session had no sound at all: the DirectAudio sink's AAudio stream opened with AAUDIO_ERROR_DISCONNECTED while the output route was still changing at session start, and the plain AAudio fallback failed the same moment. The sink guard now retries DirectAudio, then the plain sink, five times over ten seconds and says which one it got. graphics-report.txt keeps the client-sink and kbase lines, and explains a KBASE_IOCTL_MEM_EXEC_INIT EPERM as the kbase driver's own answer rather than the session's sandbox. --- .../launcher/audio/PulseAudioComponent.java | 21 +++++++++++++++---- .../launcher/session/GraphicsReport.kt | 7 ++++++- 2 files changed, 23 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/com/droiddeck/launcher/audio/PulseAudioComponent.java b/app/src/main/java/com/droiddeck/launcher/audio/PulseAudioComponent.java index c4e1db8c7..f4a5bcba3 100644 --- a/app/src/main/java/com/droiddeck/launcher/audio/PulseAudioComponent.java +++ b/app/src/main/java/com/droiddeck/launcher/audio/PulseAudioComponent.java @@ -195,10 +195,23 @@ public class PulseAudioComponent extends SessionPart { } else if (sinks.contains("\tDirectAudio\t") || sinks.startsWith("DirectAudio\t") || sinks.contains("\tDirectAudio\n") || sinks.matches("(?s).*\\bDirectAudio\\b.*")) { line = "== client sink: DirectAudio (module-directaudio-native-sink)"; } else { - boolean loaded = pactl("load-module", "module-aaudio-sink", "sink_name=AAudioSink", "performance_mode=1", "adaptive=1", "volume=1.0") != null - && pactl("set-default-sink", "AAudioSink") != null; - line = loaded ? "== client sink: DirectAudio did not come up; FALLBACK to the plain AAudio sink (AAudioSink)" - : "== client sink: DirectAudio did not come up and the AAudio fallback failed too - no client sound"; + // AAudio can refuse the first open with AAUDIO_ERROR_DISCONNECTED while Android is + // still switching the output route as the session starts (seen on a Galaxy S24 FE): + // try DirectAudio again, then the plain sink, a few times over ten seconds. + String loadedAs = null; + for (int attempt = 1; attempt <= 5 && loadedAs == null && pid > 1; attempt++) { + try { Thread.sleep(2000L); } catch (InterruptedException e) { Thread.currentThread().interrupt(); return; } + if (pactl("load-module", "module-directaudio-native-sink", "sink_name=DirectAudio", "performance_mode=1", + "adaptive=1", "decay=0", "limiter=1", "watchdog=1", "volume=1.0") != null + && pactl("set-default-sink", "DirectAudio") != null) { + loadedAs = "DirectAudio on attempt " + attempt; + } else if (pactl("load-module", "module-aaudio-sink", "sink_name=AAudioSink", "performance_mode=1", "adaptive=1", "volume=1.0") != null + && pactl("set-default-sink", "AAudioSink") != null) { + loadedAs = "the plain AAudio sink (AAudioSink) on attempt " + attempt; + } + } + line = loadedAs != null ? "== client sink: DirectAudio did not come up at start; retried and got " + loadedAs + : "== client sink: DirectAudio did not come up and the AAudio fallback failed too after 5 retries - no client sound"; Log.w(TAG, line); } Log.i(TAG, line); diff --git a/app/src/main/java/com/droiddeck/launcher/session/GraphicsReport.kt b/app/src/main/java/com/droiddeck/launcher/session/GraphicsReport.kt index 9cc92271a..0f6136efe 100644 --- a/app/src/main/java/com/droiddeck/launcher/session/GraphicsReport.kt +++ b/app/src/main/java/com/droiddeck/launcher/session/GraphicsReport.kt @@ -142,7 +142,7 @@ object GraphicsReport { ) /** The session script's driver lines: what it exported, the bridge's self-test, vulkaninfo, gamescope's Vulkan errors. */ - private val GUEST = Regex("""== vulkan driver|== vkbridge|== vulkaninfo|vulkan:|panvk|PanVK|radv|primary node|No compatible|DRM format""", RegexOption.IGNORE_CASE) + private val GUEST = Regex("""== vulkan driver|== vkbridge|== vulkaninfo|vulkan:|panvk|PanVK|radv|primary node|No compatible|DRM format|kbase|AAUDIO|client sink""", RegexOption.IGNORE_CASE) /** * The end of the report, from the finished folder: the compositor's driver lines out of @@ -161,6 +161,11 @@ object GraphicsReport { if (guestLines.any { it.contains("vkbridge", ignoreCase = true) && it.contains("FAIL") }) { appendLine("!! MALI BRIDGE SELF-TEST FAILED: this GPU's driver did not pass the bridge's checks (see below)") } + if (guestLines.any { it.contains("MEM_EXEC_INIT") }) { + appendLine("note: kbase refused KBASE_IOCTL_MEM_EXEC_INIT with EPERM. That answer comes from the kbase driver") + appendLine(" itself (proot does not filter ioctls; Android's seccomp would kill or return ENOSYS; SELinux") + appendLine(" would return EACCES), so it is the kernel's policy for this context, not the session's.") + } appendLine("-- driver lines from the session log (${guestLines.size})") guestLines.forEach { appendLine(it) } appendLine()