Skip to content

Set the minimum requested AAudio buffer capacity - #1386

Merged
flyingmutant merged 2 commits into
cmus:masterfrom
pgaskin:aaudio-buffer-capacity
Nov 29, 2024
Merged

flyingmutant merged 2 commits into
cmus:masterfrom
pgaskin:aaudio-buffer-capacity

Conversation

@pgaskin

@pgaskin pgaskin commented Nov 29, 2024

Copy link
Copy Markdown
Member

This fixes buffer underruns on the Pixel 9 due to the default selected buffer size being faster than cmus can produce audio.

There's probably a better way to deal with this, but it works.

On some devices (e.g., the Pixel 9 with Android 15), the minimum audio
device latency is low enough that the default buffer capacity selected
by AAudio is low enough that cmus can't keep up with producing audio.

This doesn't seem to be an issue on most other devices.

For reference, the default selected capacity and burst size in frames
for 48000 Hz audio was 2886/962 on the Pixel 9, and 6734/3367 on the
Pixel 8.

I chose 80ms as the minimum since it results in AAudio selecting a
capacity and burst size of 4000/2000 on the Pixel 9, and 6734/3367 on
the Pixel 8. Higher values result in slightly lower CPU usage, but
more UI lag. Lower values start running into buffer underruns.
@pgaskin

pgaskin commented Nov 29, 2024

Copy link
Copy Markdown
Member Author

To test this easily, you can download the ndk build artifact and place aaudio.so in /data/data/com.termux/files/usr/lib/cmus/op/.

@pgaskin
pgaskin requested a review from flyingmutant November 29, 2024 08:39
@pgaskin pgaskin assigned pgaskin and flyingmutant and unassigned pgaskin Nov 29, 2024
@flyingmutant
flyingmutant merged commit a15a9e0 into cmus:master Nov 29, 2024
pgaskin added a commit to pgaskin/termux-packages that referenced this pull request Nov 29, 2024
TomJo2000 pushed a commit to termux/termux-packages that referenced this pull request Nov 30, 2024
termux-pacman-bot added a commit to termux-pacman/termux-packages that referenced this pull request Nov 30, 2024
@BrewTestBot BrewTestBot mentioned this pull request Oct 28, 2026
1 task done
bmwiedemann pushed a commit to bmwiedemann/openSUSE that referenced this pull request Nov 2, 2026
https://build.opensuse.org/request/show/1394501
by user mia + anag_factory
- Update to 2.13.0
  * Set the minimum requested AAudio buffer capacity
    gh#cmus/cmus#1386
  * Check for libavutil pkg-config
    gh#cmus/cmus#1388
  * Add sort by duration
    gh#cmus/cmus#1440
  * Respect scroll_offset setting when resizing window
    gh#cmus/cmus#1413
  * Try to fallback to any plugin upon failure to init output
    plugin
    gh#cmus/cmus#1416
  * PulseAudio bugfixes and APPLICATION_ID
    gh#cmus/cmus#1405
  * ip/ffmpeg fixes and ffmpeg 8.0 support
    gh#cmus/cmus#1444
  * CUE handling improvements and replaygain/genre support
    gh#cmus/cmus#1406
  * Fix for missing Icecast streaming bitrate display.
    gh#cmus/cmus#1451
  * op/mixer_alsa: alsamixer's volume scale; setting mixer control
    like aplay does it
    gh#cmus/cmus#1445
  * ip/ffmpeg: fix seeking and
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