CRAS: audio_thread - set coarse rate adj to capture path

Set the coarse rate adjust field for input device, this will
guard the buffer level so it won't go too far from the min/max
stream callback threshold.

BUG=chromium:436251
TEST=cras_test_client --capture_file /tmp/1 --show_latency
or open AudioVisualizer app and use cras_test_client --dump_a
to monitor the input buffer level. Verify that after a few
hours recording the buffer level and latency value don't
increase to unacceptable range.

Change-Id: I9d01f3b90460669312702c45177417de77ca69c3
Reviewed-on: https://chromium-review.googlesource.com/232902
Reviewed-by: Chinyue Chen <chinyue@chromium.org>
Reviewed-by: Dylan Reid <dgreid@chromium.org>
Reviewed-by: Hsinyu Chao <hychao@chromium.org>
Commit-Queue: Hsinyu Chao <hychao@chromium.org>
Tested-by: Hsinyu Chao <hychao@chromium.org>
Candy: Add volume curve config.

BUG=chrome-os-partner:31814
TEST=`emerge-candy adhd` verify the file is exist.

Change-Id: Ie918e5a50690b8d70b0acf856c4f1dde18de622e
Reviewed-on: https://chromium-review.googlesource.com/232839
Commit-Queue: Huki Huang <huki.huang@intel.com>
Tested-by: Huki Huang <huki.huang@intel.com>
Reviewed-by: Yung Leem <yungleem@chromium.org>
CRAS: client - remove hotword stubs

These were never used. It will now go in a different direction.

Change-Id: Ic371185c75a1306730ecb541c912eb19e009c867
Signed-off-by: Dylan Reid <dgreid@chromium.org>
CRAS: client - copy flags to the stream

Any flags passed were being dropped before the stream is created.
This wasn't noticed because no flags were used until now.

Change-Id: I0921d7511e357c521054cebc68a23a60b8f42f96
Signed-off-by: Dylan Reid <dgreid@chromium.org>
CRAS: rstream - save flags.

The flags will be used now, save them when creating an rstream.

Change-Id: I2d0b2dc59c1800340c49bd990f9f4d6e7a238de0
Signed-off-by: Dylan Reid <dgreid@chromium.org>
CRAS: byte_buffer - add reset funciton.

The test iodev will need this when it returns to the start of a file.

Change-Id: Ied6bf99cb6be1092ac0852b79422b02fb86e0217
Signed-off-by: Dylan Reid <dgreid@chromium.org>
CRAS: rstream - rename get_buffer_size to get_buffer_frames

Make the name say what it means.  Do this before adding a user for
this function.

Change-Id: Iaba6fb61373f388d42a01815d1822e9d295b6b87
Signed-off-by: Dylan Reid <dgreid@chromium.org>
CRAS: dev_stream - Filter callback time if draining

This removes another rstream dependency from audio_thread and will
allow for other conditions to be used in the future to filter out the
next_cb_ts.

Change-Id: Ie1d19c0398514596c22b79e52ab9ae3d46cd2bce
Signed-off-by: Dylan Reid <dgreid@chromium.org>
CRAS: Add test iodev.

To start the test iodev will be used to test hotwording while we wait
for hardware.

Change-Id: I965ff7512ed2e8df8d81f3c7f02ec7f21a08abb7
Signed-off-by: Dylan Reid <dgreid@chromium.org>
CRAS: Add interface to add a test_iodev

Plumb a message and argument from the test client to add a test iodev
to the server.  This will be used to add a hotword test device and
fake wake up buffers.

Change-Id: I9fb244297a52faf55e4f1dda853e378e3c401860
Signed-off-by: Dylan Reid <dgreid@chromium.org>
CRAS: add flag for hotword stream

Add two flags, one to allow more than a callback threshold of data to
be sent over shm.  The other is to allow a stream's timing to be
driven by an input device.  This will allow for a stream to be
notified when samples are ready even if the input isn't clocked
traditionally, such as hotword devices.

Change-Id: I5938d0e08eb480d80142422d91869e7c7b32c234
Signed-off-by: Dylan Reid <dgreid@chromium.org>
CRAS: add test hotword commands

This creates the ability to send a command to a test iodev.  This will
be used to feed hotword data to the hotword test iodev.

Change-Id: I25822c661e6fdb9441352b4448c455873b53b573
Signed-off-by: Dylan Reid <dgreid@chromium.org>
CRAS: Add handling of hotword flags

Allow for BULK audio to be sent for device timing to be respected.
If a stream is timed by the device and not the clock, allow for
samples to be sent before they would be if the perfect sample rate was
used.

Change-Id: I18dc83afaf748a65391aa0965ecc558a9d57d0ba
Signed-off-by: Dylan Reid <dgreid@chromium.org>
CRAS: test_client - add ability to listen for a hotword

Add a new option to listen to hotword streams.  For now it is very
similar to capture except that it only prints when it recieves a
sample.

Change-Id: Ic85032391920ef867d7e8585d8ab7f2d71244212
Signed-off-by: Dylan Reid <dgreid@chromium.org>