CRAS: audio_thread - basic dev speed tracking.

This can be removed one the sample rate estimation is integrated.

For now, if the device has too many or too few samples queued, wake up
streams later or earlier to try to get back within range.

Change-Id: I029d06fc897d75f8474b9bc8cdc1790eda133650
Signed-off-by: Dylan Reid <dgreid@chromium.org>
CRAS: test - log longest wake time

Change-Id: Iac9c215804dac8a457ae24d5bd07597fbe8d8f96
Signed-off-by: Dylan Reid <dgreid@chromium.org>
CRAS: audio_thread - Zero fill to recover from catastrophic output underruns

These underruns are happening when dev_open is called for a secondary
device.  On some boards dev_open takes tens of milliseconds.  This
will need to be fixed by moving dev_open calls out of the audio
thread. For now allow the thread to recover.

Change-Id: I96f5aa9daaf14e9de53f044998760f39dca778b4
Signed-off-by: Dylan Reid <dgreid@chromium.org>
CRAS: audio_thread - limit write based on converted frames.

When determining the minimum fill level for playback, use
sample-rate-converted buffer levels from the stream.

Change-Id: Ieceb472ebf858bb0b59ee2fc76bfc7663b760af5
Signed-off-by: Dylan Reid <dgreid@chromium.org>
CRAS: Rename input/dev_mix to buffer_share.

This can be used to manage the read level of multiple devices from and
rstream as well, make the names more generic.

Change-Id: Iec7aec55ba0832dceb20069a93c3d09daf1b6134
Signed-off-by: Dylan Reid <dgreid@chromium.org>
CRAS: Handle multiple active output devices.

Use the buffer_share object to manage the read pointers of various
output devices into the playback streams.  This allows multiple
devices to play the same stream simultaneously.

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