CRAS: audio_thread - Log state of each stream when writing.

Log when data is fetched form playback streams and log each stream
when writing audio data.

BUG=none
TEST=run and check log.

Signed-off-by: Dylan Reid <dgreid@chromium.org>
Change-Id: Ib9fe5f89001ec33cc2033ebea99f47c2a8759369
Reviewed-on: https://chromium-review.googlesource.com/188964
Reviewed-by: Hsinyu Chao <hychao@chromium.org>
CRAS: Make shared structures architecture-independent.

This allows x86 clients to connect to x86-64 server: mainly useful
for crouton as users want to play sound from x86 binaries running
in their x86-64 chroots.

Get rid of size_t, long, and timespec, whose size depend on the
architecture. We also pack all structures to make sure alignment
is the same across platforms.

We assume that sizeof(enum) = sizeof(int) = 4, which is true on
x86/x86-64/arm with GCC (using default compilation flags).

Volume is now an uint32_t (was size_t), capture gain is now an
int32_t (was long): no difference on x86/arm, and 32-bit is more than
enough range on x86-64. Frame rate, number of channels, and shm
offsets are also converted from size_t to uint32_t.

We replace timespec by a fixed-size cras_timespec, where both fields
are 32-bit signed integers (as on x86/arm, x86-64 uses 64-bit ints).
All we care about in CRAS is differences between 2 cras_timespec, so
64-bit fields are not required (even after year 2038...).

BUG=chromium:309961
TEST=Audio input/output still works (e.g. try a Hangout session)
TEST=In crosh, developer mode: 'cd; arecord -f dat -d 5 > x; aplay x'
     records 5 seconds of audio, then plays it back.
CQ-DEPEND=CL:189206

Change-Id: I12d851fbbdec5fbb222dc156b5e13316f6c91e30
CRAS test: Verify sizes of shared structures.

This makes sure that shared structures have a fixed size across
architectures.

This test also acts as a reminder that CRAS_SERVER_STATE_VERSION
and CRAS_PROTO_VER should be bumped whenever shared structures and
message format changes.

BUG=chromium:309961
TEST=cros_workon_make --board=${BOARD} media-sound/adhd --test
     on x86 and x86_64.
CQ-DEPEND=CL:189204

Change-Id: Ie9872c8ac9cb6df531c2c821ecb554ad830d27fb