CRAS: audio_thread - don't check draining streams

If a stream is draining, don't check if it has replied with more data.

Change-Id: Ia085eb5985ecd802c56b5e1a0f55c3c4a651802f
Signed-off-by: Dylan Reid <dgreid@chromium.org>
CRAS: audio_thread - remove unified timestamp.

Unified streams no longer exist, remove setting a timestamp for them.

Change-Id: Ibc1d8694f0eab27cd1850220626678164cde4a6b
Signed-off-by: Dylan Reid <dgreid@chromium.org>
CRAS: audio_thread - Use helper to check capture frames.

Add a new helper to dev_stream that returns how many frames are
writable in the stream for capture samples.  This will be useful in
later commits as sample rate conversion can make determining this
non-trivial.

Change-Id: I060a349021e0fcde269133dd7c5e51569cafbd62
Signed-off-by: Dylan Reid <dgreid@chromium.org>
CRAS: Only set dev format from the audio thread.

Since the format converter now lives in the audio thread, there is no
need to update the format of the rstream based on the device format.
Now set the device format when adding the first stream in the audio
thread.

BUG=none
TEST=unittest, plus play and record audio with multiple test clients.

Change-Id: I7288529e73a27b78a60c9076442577018e4aa47e
Signed-off-by: Dylan Reid <dgreid@chromium.org>
CRAS: byte_buffer - Add size helpers.

Add helpers to check the total number of bytes available, and to
return both the pointer to the buffer and the number of bytes that can
be read or written.  This will be used by server side sample rate
conversion.

Change-Id: I1939c85cc5961240b6f6317eda80d81aee82f65b
Signed-off-by: Dylan Reid <dgreid@chromium.org>
CRAS: audio_thread - Remove temp variable.

avail_frames was only used once, remove it and use the result of the
function call directly.

Change-Id: I70c0554b4efe60fdd48435c4adda895c6823f968
Signed-off-by: Dylan Reid <dgreid@chromium.org>
CRAS: audio_thread - log write_limit from possibly_read

This will be useful to have logged before sample rate conversion on
capture.

Change-Id: I8f3873590b636843632f43dceaf1abff8a2ba506
Signed-off-by: Dylan Reid <dgreid@chromium.org>
CRAS: Implement format conversion for the capture path.

Add format conversion for capture samples on the server side.

Change-Id: I056b5ae4362ded6e2be1cebbc4cef8ab3ed80ac0
Signed-off-by: Dylan Reid <dgreid@chromium.org>
CRAS: move timestamp setting to dev_stream

This ins't really related to iodev, move it to devstream.

Change-Id: I8683eeba2b765ca59b5a8370d5927138158ede0b
Signed-off-by: Dylan Reid <dgreid@chromium.org>
CRAS: Account for SRC when reporting delay.

The delay reported by the device need to go through sample rate
conversion to the remote sample rate before being reported to the
client.

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