CRAS: input_data - Fix larger offset case

As the background explained in commit 01cb78342, when multiple
input streams are connected with different buffer sizes and processing
options, there could be a case in capture_to_streams() that stream
offset is larger than the buffer size got from input iodev.

This commit fixes the crash caused by above scenario plus the
assumption in cras_audio_area_copy() that stream offset not larger
than buffer size.

BUG=chromium:892608
TEST=Start three input streams
cras_test_client --capture_file /tmp/1 --block_size 480
cras_test_client --capture_file /tmp/2 --block_size 256
cras_test_client --capture_file /tmp/3 --block_size 256 --effects aec
and verify CRAS doesn't crash.

Change-Id: I869a19d88a32ee764127766b432a4b17011d7933
Reviewed-on: https://chromium-review.googlesource.com/1265216
Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
Tested-by: Hsinyu Chao <hychao@chromium.org>
Reviewed-by: Dylan Reid <dgreid@chromium.org>
1 file changed