diff options
author | Dylan Reid <dgreid@chromium.org> | 2014-08-28 15:55:28 -0700 |
---|---|---|
committer | chrome-internal-fetch <chrome-internal-fetch@google.com> | 2014-09-19 02:59:23 +0000 |
commit | 8e45c089c7665d417441576b29f0f3b3947961db (patch) | |
tree | a689bb8f863fb71ca95135f1be0ec9024eef12e0 /cras/src/tests/audio_thread_unittest.cc | |
parent | 6aab3d5a75edc39c76fbf6af650ba32c4aa0d1e6 (diff) | |
download | adhd-8e45c089c7665d417441576b29f0f3b3947961db.tar.gz |
CRAS: audio_thread - Use helper to check capture frames.
Add a new helper to dev_stream that returns how many frames are
writable in the stream for capture samples. This will be useful in
later commits as sample rate conversion can make determining this
non-trivial.
Change-Id: I060a349021e0fcde269133dd7c5e51569cafbd62
Signed-off-by: Dylan Reid <dgreid@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/217173
Reviewed-by: Chinyue Chen <chinyue@chromium.org>
Diffstat (limited to 'cras/src/tests/audio_thread_unittest.cc')
-rw-r--r-- | cras/src/tests/audio_thread_unittest.cc | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/cras/src/tests/audio_thread_unittest.cc b/cras/src/tests/audio_thread_unittest.cc index 083e05f2..663546e9 100644 --- a/cras/src/tests/audio_thread_unittest.cc +++ b/cras/src/tests/audio_thread_unittest.cc @@ -2503,6 +2503,20 @@ int dev_stream_playback_frames(const struct dev_stream *dev_stream) { return cras_fmt_conv_in_frames_to_out(dev_stream->conv, frames); } +unsigned int dev_stream_capture_avail(const struct dev_stream *dev_stream) +{ + struct cras_audio_shm *shm; + struct cras_rstream *rstream = dev_stream->stream; + unsigned int cb_threshold = cras_rstream_get_cb_threshold(rstream); + unsigned int frames_avail; + + shm = cras_rstream_input_shm(rstream); + + cras_shm_get_writeable_frames(shm, cb_threshold, &frames_avail); + + return frames_avail; +} + size_t cras_fmt_conv_in_frames_to_out(struct cras_fmt_conv *conv, size_t in_frames) { |