Skip to content

Add dynamic rootless processing and USB output rates - #338

Open
legendcodermartino1245 wants to merge 2 commits into
timschneeb:masterfrom
legendcodermartino1245:codex/pr-rootless-dynamic-rates
Open

Add dynamic rootless processing and USB output rates#338
legendcodermartino1245 wants to merge 2 commits into
timschneeb:masterfrom
legendcodermartino1245:codex/pr-rootless-dynamic-rates

Conversation

@legendcodermartino1245

Copy link
Copy Markdown
Contributor

Draft / dependency

This is stacked on and depends on #337. Until that PR merges, GitHub shows both commits here. The dynamic rootless-rate work is the second commit (03cbbba).

Summary

Allow rootless processing to follow active source or physical USB hardware sample rates instead of clamping processing to 44.1/48 kHz.

Adds two USB modes:

  • Follow USB hardware rate: rebuild processing at the physical output rate.
  • Follow source rate: process at the source rate and allow Android to perform final conversion.

Implementation

  • detects active playback source rates
  • tracks route changes and rebuilds AudioRecord/AudioTrack as needed
  • uses Android 14 preferred mixer attributes where available
  • exposes source, processing, and hardware rates separately
  • supports processing rates through 384 kHz
  • preserves safe fallbacks when detection fails

Platform caveats

Some rate discovery relies on hidden playback configuration fields and AudioFlinger diagnostic output because rootless Android does not expose the complete physical path through a stable public API. This is why the PR is opened as a draft for design feedback.

Testing

  • all 16 rootless F-Droid unit tests pass
  • rootless debug APK builds successfully
  • tested on a Samsung device with a FiiO BTR7 USB DAC
  • verified a 96 kHz JamesDSP processing path, 96 kHz Android A2DP output, and LDAC negotiated at 96 kHz/24-bit

@timschneeb

Copy link
Copy Markdown
Owner

Looks good 👍 I'll merge it when you mark the PR as ready

Some rate discovery relies on hidden playback configuration fields and AudioFlinger diagnostic output because rootless >Android does not expose the complete physical path through a stable public API. This is why the PR is opened as a draft for >design feedback.

Using hidden APIs is fine, the app already does that pretty heavily anyways.

@legendcodermartino1245
legendcodermartino1245 marked this pull request as ready for review July 25, 2026 09:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants