CRAS: cras_alsa_io - Increase appl_ptr when underrun happens

Move appl_ptr to min_buffer_level + 1.5 * min_cb_level frames ahead
of hw_ptr instead of min_buffer_level + min_cb_level.

It is because original offset is not enough. Considering calculation
time, the total consumption might be larger than min_cb_level. It may
cause underrun happens again. We need to increase offset to see whether
the situation can be improved.

In addition, I added the new argument rate in adjust_appl_ptr function.
So that we can keep adjusting appl_ptr to min_buffer_level +
min_cb_level from leaving free run.

BUG=chromium:881724
TEST=CRAS works fine on peppy.

Change-Id: Ifef1988c79a256d85494929459214a2aae4dfbc7
Reviewed-on: https://chromium-review.googlesource.com/1212628
Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
Tested-by: Yu-Hsuan Hsu <yuhsuan@chromium.org>
Reviewed-by: Dylan Reid <dgreid@chromium.org>
2 files changed