From 3622cdff65f34a99d2f55936a895387ad41510ce Mon Sep 17 00:00:00 2001 From: Glenn Kasten Date: Fri, 20 Mar 2015 10:58:21 -0700 Subject: AudioRecord::read() can be non-blocking to match AudioTrack Change-Id: I23b9466b81ab6037d0bccd5e6f5974b7bd4aeacb --- include/media/AudioRecord.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/media/AudioRecord.h b/include/media/AudioRecord.h index c503f25..63d2e20 100644 --- a/include/media/AudioRecord.h +++ b/include/media/AudioRecord.h @@ -406,8 +406,11 @@ public: * WOULD_BLOCK when obtainBuffer() returns same, or * AudioRecord was stopped during the read * or any other error code returned by IAudioRecord::start() or restoreRecord_l(). + * Default behavior is to only return when all data has been transferred. Set 'blocking' to + * false for the method to return immediately without waiting to try multiple times to read + * the full content of the buffer. */ - ssize_t read(void* buffer, size_t size); + ssize_t read(void* buffer, size_t size, bool blocking = true); /* Return the number of input frames lost in the audio driver since the last call of this * function. Audio driver is expected to reset the value to 0 and restart counting upon -- cgit v1.1