summaryrefslogtreecommitdiffstats
path: root/media/libmedia/AudioTrack.cpp
diff options
context:
space:
mode:
authorJean-Michel Trivi <jmtrivi@google.com>2014-02-04 11:00:59 -0800
committerJean-Michel Trivi <jmtrivi@google.com>2014-03-03 10:44:27 -0800
commit720ad9ddb2ac6b55b0dfbfcd2d8360151d8ac427 (patch)
tree58049745c0426d9b615a3891419963f2589edd7b /media/libmedia/AudioTrack.cpp
parent56df9ff31d583ad3eae4f279a3df550273c58e1e (diff)
downloadframeworks_av-720ad9ddb2ac6b55b0dfbfcd2d8360151d8ac427.zip
frameworks_av-720ad9ddb2ac6b55b0dfbfcd2d8360151d8ac427.tar.gz
frameworks_av-720ad9ddb2ac6b55b0dfbfcd2d8360151d8ac427.tar.bz2
AudioTrack non-blocking write
Bug 7531968 Change-Id: I6d0e79fa8cab5b6eb36bcc34977f4cf0d7eec8ea
Diffstat (limited to 'media/libmedia/AudioTrack.cpp')
-rw-r--r--media/libmedia/AudioTrack.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/media/libmedia/AudioTrack.cpp b/media/libmedia/AudioTrack.cpp
index 5c62260..3184902 100644
--- a/media/libmedia/AudioTrack.cpp
+++ b/media/libmedia/AudioTrack.cpp
@@ -1270,7 +1270,7 @@ void AudioTrack::releaseBuffer(Buffer* audioBuffer)
// -------------------------------------------------------------------------
-ssize_t AudioTrack::write(const void* buffer, size_t userSize)
+ssize_t AudioTrack::write(const void* buffer, size_t userSize, bool blocking)
{
if (mTransfer != TRANSFER_SYNC || mIsTimed) {
return INVALID_OPERATION;
@@ -1289,7 +1289,8 @@ ssize_t AudioTrack::write(const 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 (written > 0) {
break;