summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Daniels <briandaniels@google.com>2024-05-10 09:47:21 -0400
committerBrian Daniels <briandaniels@google.com>2024-05-10 09:47:21 -0400
commit7e16c8660b9806cc0ca125483fb872429bb51b83 (patch)
treeb837c9b33c1eab5a9c8be25b72b1ca0bed9a0fdd
parent6a0cacb15919202347b06cf0e9eaf1ad290f7404 (diff)
downloadcar-main.tar.gz
Specify start_threshold to match period size and countHEADmastermain
A start_threshold of 0 lets tinyalsa set it, which defaults to (period_count * period_size / 2). On some hypervisors, the virtio-snd virtual device expects a certain amount of periods to be sent before the device is started. This change lengthens the start_threshold to this value, which is equal to (period_count * period_size). Bug: 331600622 Test: Build, confirm sound plays on the device Change-Id: I30d328b5ff2037ecc55c04d6dd0c182498065fbf
-rw-r--r--emulator/audio/driver/audio_hw.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/emulator/audio/driver/audio_hw.c b/emulator/audio/driver/audio_hw.c
index 9f64a72..87b63ce 100644
--- a/emulator/audio/driver/audio_hw.c
+++ b/emulator/audio/driver/audio_hw.c
@@ -1221,6 +1221,7 @@ static int adev_open_output_stream(struct audio_hw_device *dev,
memcpy(&out->pcm_config, &pcm_config_out, sizeof(struct pcm_config));
out->pcm_config.rate = config->sample_rate;
out->pcm_config.period_size = out->pcm_config.rate * get_out_period_ms() / 1000;
+ out->pcm_config.start_threshold = out->pcm_config.period_count * out->pcm_config.period_size;
out->standby = true;
out->underrun_position = 0;