CRAS: client - Don't read repeated data
CRAS client could handles multiple messages from server about
capture data ready. We should check if the read offset of stream
shm reaches write offset, to avoid reading repeated data.
BUG=chromium:662886
TEST=Execute 'cras_test_client --capture_file /tmp/1' and then
hit 'p', 'enter', 'p', 'enter'... repeat 10 times while making
some sound to internal mic.
Inspect the recorded /tmp/1 file using Audacity to verify there
are no repeated samples, but with several short discontinuity
instead.
Change-Id: I40bf34cbae31f76bd013ec855a4d5ef4055399f2
Reviewed-on: https://chromium-review.googlesource.com/411668
Commit-Ready: Nicolas Boichat <drinkcat@chromium.org>
Tested-by: Hsinyu Chao <hychao@chromium.org>
Reviewed-by: Dylan Reid <dgreid@chromium.org>
3 files changed