cras: cras_iodev.c: Add max to sleep time for wake during last period
When cras is running on hardware with tiny buffers, it will be the case
that the hardware buffer is smaller than the stream. Previously, we
assumed that the stream buffer would wake the server and fill before the
hardware buffer was exhausted. That doesn't happen when the stream
buffer is larger: we conclude that we should schedule a wakeup at exatly
the moment that the hw_level reaches 0. This is certain to cause
underruns.
This patch teaches cras to sleep until there is 1ms of hw_level left.
dump_audio_thread shows that we are no longer reaching hw_level 0.
BUG=b:63121716
TEST=build Kahlee kernel with SNDRV_PCM_INFO_NO_PERIOD_WAKEUP and deploy
to DUT. Test audio playback.
Change-Id: I07ce59bf43ce1e247532a71cdb13314b77fceb22
Reviewed-on: https://chromium-review.googlesource.com/753295
Commit-Ready: Jason Clinton <jclinton@chromium.org>
Tested-by: Jason Clinton <jclinton@chromium.org>
Reviewed-by: Dylan Reid <dgreid@chromium.org>
2 files changed