CRAS: audio_thread - Ignore next_cb_ts of draining streams

In the current version, when a stream is draining and there are some
samples in a share memory, we will wake up at the next_cb_ts of that
stream.
However, if a device is full, we can not take out all samples from the
stream. Meanwile, the next_cb_ts is not updated because the stream is
draining. It causes the audio thread always wake up at that next_cb_ts
and trigger busy loop.
To fix this problem, we can ignore next_cb_ts if the streams is
draining. The first reason is we don't need to fetch that stream any
more. The second reason is a device already have its own wake up time,
which is the time that a device needs more samples. So we don't need to
worry about that these samples will not be played.
(see cras_iodev_frames_to_play_in_sleep)

BUG=chromium:958492
TEST=Do not trigger busyloop when device buffer is full. (Tested on
eve by seting incorrect rate in cras.)

Change-Id: I2aa95cfe3c3685ee48c1703c0db7d919ffbc6ae5
Reviewed-on: https://chromium-review.googlesource.com/1640437
Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
Tested-by: Yu-Hsuan Hsu <yuhsuan@chromium.org>
Legacy-Commit-Queue: Commit Bot <commit-bot@chromium.org>
Reviewed-by: Cheng-Yi Chiang <cychiang@chromium.org>
1 file changed