aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDenis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>2020-11-27 18:12:10 +0100
committerDenis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>2020-11-28 00:22:17 +0100
commit1176fc39822a711dce65eb48265caf017d411d48 (patch)
tree00dcec6e7402ab8c34ff4f89f37524b4274cf0b7
parenta78cffc9c08a7108fcf680180a8073518f4828b4 (diff)
downloaddevice_samsung_i9305-1176fc39822a711dce65eb48265caf017d411d48.tar.gz
device_samsung_i9305-1176fc39822a711dce65eb48265caf017d411d48.tar.bz2
device_samsung_i9305-1176fc39822a711dce65eb48265caf017d411d48.zip
use midas audio primary module
The default audio HAL is a stub that doesn't do any access to the hardware. The code of the audio.primary.default default implementation is in hardware/libhardware/modules/audio and in audio_hw.c we have: static ssize_t out_write(struct audio_stream_out *stream, const void* buffer, size_t bytes) { ALOGV("out_write: bytes: %zu", bytes); /* XXX: fake timing for audio output */ struct stub_stream_out *out = (struct stub_stream_out *)stream; struct timespec t = { .tv_sec = 0, .tv_nsec = 0 }; clock_gettime(CLOCK_MONOTONIC, &t); const int64_t now = (t.tv_sec * 1000000000LL + t.tv_nsec) / 1000; const int64_t elapsed_time_since_last_write = now - out->last_write_time_us; int64_t sleep_time = bytes * 1000000LL / audio_stream_out_frame_size(stream) / out_get_sample_rate(&stream->common) - elapsed_time_since_last_write; if (sleep_time > 0) { usleep(sleep_time); } else { // we don't sleep when we exit standby (this is typical for a real alsa buffer). sleep_time = 0; } out->last_write_time_us = now + sleep_time; // last_write_time_us is an approximation of when the (simulated) alsa // buffer is believed completely full. The usleep above waits for more space // in the buffer, but by the end of the sleep the buffer is considered // topped-off. // // On the subsequent out_write(), we measure the elapsed time spent in // the mixer. This is subtracted from the sleep estimate based on frames, // thereby accounting for drain in the alsa buffer during mixing. // This is a crude approximation; we don't handle underruns precisely. return bytes; } This function is supposed to send the audio frames to the the audio driver, but instead it doesn't send it anywhere. So we can safely deduce that this implementation is a dummy one that implements the API just to make the higher level of the stack happy. Because of that the Dragonboard audio library which is known to work in Android 11, has been imported in device_samsung_midas_common for now. In order to use it, we need to change ro.hardware.audio.primary as it is used by the higher level stack to find what HAL library to load for the primary audio module. While the Dragonboard audio library doesn't handle audio routing, it is possible to either modify it to do that or use another library like libaudioroute, and the associated mixer_paths.xml configuration file to do it. Thanks to Joonas Kylmälä who identified that the Dragonboard audio library worked out of the box on Android 11 for the Galaxy SIII 4G (GT-I9305). Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
-rw-r--r--init.smdk4x12.rc2
1 files changed, 1 insertions, 1 deletions
diff --git a/init.smdk4x12.rc b/init.smdk4x12.rc
index c6d45fa..70a8ad8 100644
--- a/init.smdk4x12.rc
+++ b/init.smdk4x12.rc
@@ -16,7 +16,7 @@
on boot
# Audio support
- setprop ro.hardware.audio.primary default
+ setprop ro.hardware.audio.primary exynos4
# adb support
mkdir /dev/usb-ffs 0770 shell shell
mkdir /dev/usb-ffs/adb 0770 shell shell