Commit Graph

9 Commits

Author SHA1 Message Date
Konsta
dcad73115c audio: hook refine position to alsa stream
* Fixes audio syncronization during video playback.
* Account start_threshold as device specific latency for ALSA HDMI and
  tinyalsa [1] (3.5mm jack, DAC & USB) output.
* Remove unneeded pcm call to query buffer size.

[1]: https://android.googlesource.com/platform/external/tinyalsa_new/+/refs/tags/android-16.0.0_r1/include/tinyalsa/pcm.h#214
2025-11-06 13:10:29 +02:00
Konsta
7bc0df0800 audio: alsa_utils: get hdmi device from property
* ALSA HDMI audio needs to be disabled when 3.5mm jack, DAC, or external
  USB audio cards is used. Enable HDMI audio path based on system property
  and the set the vc4 audio device name accordingly.
2025-11-06 13:10:09 +02:00
Konsta
fabdcf5490 audio: alsa_utils: increase start threshold to prevent underruns
* For some reason underruns are often observed when using the default
  parameters. Workaround this by increasing start threshold by 20 ms
  (i.e. at 48000Hz there's 960 additional frames in the ring buffer before
  the playback starts). Buffer size also needs to be increased to allow
  larger start threshold. Balance between avoiding underruns and adding
  latency.
* Add logging for the ALSA parameters.
2025-11-06 13:10:00 +02:00
Konsta
3ca268d760 audio: alsa_utils: use alsa for hdmi devices
* HDMI audio devices on Raspberry Pi use FORMAT_IEC958_SUBFRAME_LE which
  is not supported by tinyalsa used on Android. Use ALSA library and its
  virtual vc4 audio devices that use IEC958 plugin to manage the subframe
  conversion.
2025-11-06 13:09:49 +02:00
Konsta
3306b79d41 audio: alsa_utils: change log tag
* Match log tags used elsewhere in the audio HAL to make debugging easier
  (i.e. 'logcat | grep AHAL').
2025-11-06 13:09:39 +02:00
Konsta
5ad2f1d648 audio: alsa_utils: change default sample rate
* 48000Hz sample rate is set for output devices in audio policy
  configuration. Set the same default sample rate for sanity though this
  should not get used for valid profiles.
2025-11-06 13:09:27 +02:00
Konsta
a0f3530f2e audio: clean up makefiles
* Restructure to remove dependencies elsewhere in the AOSP tree, move APEX
  definition from subdirectory, 'bpfmt -s -w Andoid.bp', etc.
* Remove package license definitions that are not visible in this context.
2025-11-06 13:08:41 +02:00
Konsta
375a38c961 audio: rename hal for rpi 2025-11-06 13:08:31 +02:00
Konsta
487b7689f6 audio: import alsa_utils
* system/media/ at android-16.0.0_r1.
2025-11-06 13:08:00 +02:00