CRAS: cras_test_client - Wake up file IO loop when stream terminates.

When running a stream (playback/capture/loopback), cras_test_client
loops every second in order to print latency and RMS values. Currently
the thread only wakes when a key command is sent to stdout, but not
when the stream terminates. This means that if no key commands are
sent, streams can only have a duration in multiples of the sleep time.

For measuring the RMS in a loopback stream, we wish to observe the
stream for a much shorter duration (say ~10 ms). The thread must
therefore be woken up at the correct time in order to terminate it.

BUG=chromium:257154, chromium:215328
TEST=Ran cras_test_client for playback, capture and loopback
streams. Durations have much finer resolution as expected. Key
commands still work.

Change-Id: I9368fc6ea9d8d64f1ea859fb03f616c85d64f9cf
Reviewed-on: https://gerrit.chromium.org/gerrit/64854
Reviewed-by: Dylan Reid <dgreid@chromium.org>
Commit-Queue: Adrian Li <alhli@chromium.org>
Reviewed-by: Adrian Li <alhli@chromium.org>
Tested-by: Adrian Li <alhli@chromium.org>
1 file changed