Loading include/media/AudioRecord.h +4 −1 Original line number Diff line number Diff line Loading @@ -402,8 +402,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 Loading media/libmedia/AudioRecord.cpp +3 −2 Original line number Diff line number Diff line Loading @@ -721,7 +721,7 @@ audio_io_handle_t AudioRecord::getInputPrivate() const // ------------------------------------------------------------------------- ssize_t AudioRecord::read(void* buffer, size_t userSize) ssize_t AudioRecord::read(void* buffer, size_t userSize, bool blocking) { if (mTransfer != TRANSFER_SYNC) { return INVALID_OPERATION; Loading @@ -740,7 +740,8 @@ ssize_t AudioRecord::read(void* buffer, size_t userSize) while (userSize >= mFrameSize) { audioBuffer.frameCount = userSize / mFrameSize; status_t err = obtainBuffer(&audioBuffer, &ClientProxy::kForever); status_t err = obtainBuffer(&audioBuffer, blocking ? &ClientProxy::kForever : &ClientProxy::kNonBlocking); if (err < 0) { if (read > 0) { break; Loading Loading
include/media/AudioRecord.h +4 −1 Original line number Diff line number Diff line Loading @@ -402,8 +402,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 Loading
media/libmedia/AudioRecord.cpp +3 −2 Original line number Diff line number Diff line Loading @@ -721,7 +721,7 @@ audio_io_handle_t AudioRecord::getInputPrivate() const // ------------------------------------------------------------------------- ssize_t AudioRecord::read(void* buffer, size_t userSize) ssize_t AudioRecord::read(void* buffer, size_t userSize, bool blocking) { if (mTransfer != TRANSFER_SYNC) { return INVALID_OPERATION; Loading @@ -740,7 +740,8 @@ ssize_t AudioRecord::read(void* buffer, size_t userSize) while (userSize >= mFrameSize) { audioBuffer.frameCount = userSize / mFrameSize; status_t err = obtainBuffer(&audioBuffer, &ClientProxy::kForever); status_t err = obtainBuffer(&audioBuffer, blocking ? &ClientProxy::kForever : &ClientProxy::kNonBlocking); if (err < 0) { if (read > 0) { break; Loading