CRAS: dev_stream - Limit the frames to copy from converter buffer
When sample rate conversion is used in dev_stream, the input data is
copied twice: (1) from device buffer to converter and (2) from converter
buffer to stream shm.
During the first data transfer, we should limit the number of frames to
copy by the available size in stream shm. This is to avoid any data
left in converter buffer after the 2nd data transfer and break the
assumption in audio thread that all data copied from device should be
transfered to stream buffer.
This bug could be triggered when SRC is used and input data becomes
available in large size. For example when testing APM it processed
data in 10 ms blocks.
BUG=chromium:710465
TEST=dev_stream_unittest, run test cases that do SRC at capture where
fmt converter buffer size is too large or too small.
Change-Id: I238ba1deac82ac9c59894a2c494c0a873d3e67dd
Reviewed-on: https://chromium-review.googlesource.com/538535
Commit-Ready: Hsinyu Chao <hychao@chromium.org>
Tested-by: Hsinyu Chao <hychao@chromium.org>
Reviewed-by: Hsinyu Chao <hychao@chromium.org>
2 files changed