CRAS: dev_stream - Avoid bursting captured data to stream

When there are enough captured samples, only send captured data to input
stream when time is late enough. Otherwise, client can not handle this
much data.
Note that stream with BULK_AUDIO_OK flag can still send data when there
is enough data.

BUG=chrome-os-partner:60786
TEST=make check
TEST=Play sine tone use sox command. At the same time, use
cras_test_client --loopback_f /tmp/lb.raw to record using loopback
device. Check num_overruns in audio thread log. Also, check CAPTURE_POST
in audio thread log and see the interval is roughly sleep interval.

Change-Id: I1a6e7056cd0bab40e2e597ca08ef524b7ff1207f
Reviewed-on: https://chromium-review.googlesource.com/447184
Commit-Ready: Cheng-Yi Chiang <cychiang@chromium.org>
Tested-by: Cheng-Yi Chiang <cychiang@chromium.org>
Reviewed-by: Dylan Reid <dgreid@chromium.org>
2 files changed