CRAS: empty_iodev - Input frames shouldn't exceed buffer size

In silent recording device we implemeted current_level() to
calculate the fake zero frames based on device start time and
current time. If client app comes late to ask for input buffer,
empty_iodev would report a large numger of frames but the
actual buffer doesn't contain that many. And this will cause
input dsp pipeline to access invalid address.

BUG=chromium:949054, b:129480865
TEST=Manual test on grunt, connect Bose QC35 and launch
google.com in browser, hit the mic icon for voice search.
Speake something multiple times, verify CRAS doesn't crash.

Change-Id: I90f7e9710a37ea11a05fa57a49cc4a4629cd55c2
Reviewed-on: https://chromium-review.googlesource.com/1549806
Commit-Ready: Hsinyu Chao <hychao@chromium.org>
Tested-by: Hsinyu Chao <hychao@chromium.org>
Reviewed-by: Cheng-Yi Chiang <cychiang@chromium.org>
Reviewed-by: Dylan Reid <dgreid@chromium.org>
3 files changed