DirectAudio: audio switching + guarded setUsage (#1806 review) - #7
Merged
joshuatam merged 1 commit intoAug 12, 2026
Conversation
Rebuilt directaudio-20260812.tzst from The412Banner/directaudio branch feat/directaudio-switching-usage (v1 + the two utkarshdalal#1806 review comments): - broadened AAudio error-callback recovery (INVALID_STATE/INVALID_HANDLE/ TIMEOUT as well as DISCONNECTED), matching module-aaudio-sink.c, with a stream-identity guard + no-lost-wakeup reopen gate (device-proven, 7 route/bg-fg cycles, no drops). - AAUDIO_USAGE_GAME via dlsym + android_get_device_api_level()>=28 guard (the unixlib direct-links libaaudio; a direct ref would fail .so load on minSdk 26 / Android 8). Same filename/layout; arm64ec, 16KB-page .so (loads on 4KB+16KB).
joshuatam
pushed a commit
that referenced
this pull request
Aug 19, 2026
Rebuilt directaudio-20260812.tzst from The412Banner/directaudio branch feat/directaudio-switching-usage (v1 + the two utkarshdalal#1806 review comments): - broadened AAudio error-callback recovery (INVALID_STATE/INVALID_HANDLE/ TIMEOUT as well as DISCONNECTED), matching module-aaudio-sink.c, with a stream-identity guard + no-lost-wakeup reopen gate (device-proven, 7 route/bg-fg cycles, no drops). - AAUDIO_USAGE_GAME via dlsym + android_get_device_api_level()>=28 guard (the unixlib direct-links libaaudio; a direct ref would fail .so load on minSdk 26 / Android 8). Same filename/layout; arm64ec, 16KB-page .so (loads on 4KB+16KB).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Addresses the two review comments on utkarshdalal#1806 by updating the bundled
directaudio-20260812.tzstto a rebuilt driver (drop-in: same filename/layout, no code changes).1. Audio switching (
aaudio_error_callback) — the mixer now reopens the AAudio output onINVALID_STATE/INVALID_HANDLE/TIMEOUTas well asDISCONNECTED, matchingGameNative/pulseaudio-androidmodule-aaudio-sink.c. While testing on-device I found broadening the trigger set caused a reopen churn (the reopen's own teardown/startup fired more reopens) and the one-shot guard could drop a real request mid-flight → audio died after 2–3 route changes. Fixed with (a) a stream-identity guard so only the live/promoted stream's errors trigger a reopen, and (b) a reopen gate that can't lose a wakeup. Held solid for 7 headphone/BT + background↔foreground cycles on-device.2.
AAudioStreamBuilder_setUsage— addedAAUDIO_USAGE_GAME, resolved viadlsym+android_get_device_api_level() >= 28rather than a direct call. The unixlib direct-links libaaudio (eager symbol binding at dlopen), so a directsetUsagereference would fail the.soload on minSdk-26 / Android 8. dlsym keeps it loadable everywhere and only applies the hint on API 28+.Driver source:
The412Banner/directaudio@ branchfeat/directaudio-switching-usage. Built arm64ec, 16KB-page.so(loads on both 4KB and 16KB devices).