Commit Graph

3 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
688b88189e audio: probe pcm card from property
* Valid values for the audio device property are 'jack', 'hdmi0', 'hdmi1',
  and 'dac'.
* If 'jack' is selected, first PCM card with name 'Headphones' is used.
  If 'dac' is selected, first PCM card that doesn't match the name for 3.5mm
  or HDMI devices is used. HDMI audio uses virtual ALSA devices instead of
  using tinyalsa to open a PCM card directly.
* Allow forcing specific PCM card for debugging/development purposes.
* PCM card numbers are different between Pi 4 and Pi 5 and order can change
  depending on the DAC driver that's enabled.

Pi 4:

console:/ # cat /proc/asound/cards
 0 [Headphones     ]: bcm2835_headpho - bcm2835 Headphones
                      bcm2835 Headphones
 1 [vc4hdmi0       ]: vc4-hdmi - vc4-hdmi-0
                      vc4-hdmi-0
 2 [vc4hdmi1       ]: vc4-hdmi - vc4-hdmi-1
                      vc4-hdmi-1
Pi 5 with DAC:

console:/ # cat /proc/asound/cards
 0 [vc4hdmi0       ]: vc4-hdmi - vc4-hdmi-0
                      vc4-hdmi-0
 1 [vc4hdmi1       ]: vc4-hdmi - vc4-hdmi-1
                      vc4-hdmi-1
 2 [sndrpihifiberry]: HifiberryDacp - snd_rpi_hifiberry_dacplus
                      snd_rpi_hifiberry_dacplus
2025-11-06 13:10:19 +02:00
Konsta
7d6df38051 audio: import aidl hal
* hardware/interfaces/audio/aidl/default/ at android-16.0.0_r1.
2025-11-06 13:07:51 +02:00