summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGlenn Kasten <gkasten@google.com>2015-03-09 21:33:10 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2015-03-09 21:33:11 +0000
commit172e2c5a41275efbd5a9c343fa8b8c4c653061b4 (patch)
treeffb176c2537f9ca489e2166f2cb17ac165ce5d82
parent50b22c7717a1af8a1f2f90858b69431a3de468b5 (diff)
parentb46f394a85d704dd05287cf9bb77cf86e3c02a38 (diff)
downloadframeworks_av-172e2c5a41275efbd5a9c343fa8b8c4c653061b4.zip
frameworks_av-172e2c5a41275efbd5a9c343fa8b8c4c653061b4.tar.gz
frameworks_av-172e2c5a41275efbd5a9c343fa8b8c4c653061b4.tar.bz2
Merge "AudioTrack::obtainBuffer() now returns number of non-contiguous frames"
-rw-r--r--include/media/AudioTrack.h16
-rw-r--r--media/libmedia/AudioTrack.cpp4
2 files changed, 15 insertions, 5 deletions
diff --git a/include/media/AudioTrack.h b/include/media/AudioTrack.h
index 8baad6b..3de0774 100644
--- a/include/media/AudioTrack.h
+++ b/include/media/AudioTrack.h
@@ -495,6 +495,13 @@ public:
* After filling these slots with data, the caller should release them with releaseBuffer().
* If the track buffer is not full, obtainBuffer() returns as many contiguous
* [empty slots for] frames as are available immediately.
+ *
+ * If nonContig is non-NULL, it is an output parameter that will be set to the number of
+ * additional non-contiguous frames that are predicted to be available immediately,
+ * if the client were to release the first frames and then call obtainBuffer() again.
+ * This value is only a prediction, and needs to be confirmed.
+ * It will be set to zero for an error return.
+ *
* If the track buffer is full and track is stopped, obtainBuffer() returns WOULD_BLOCK
* regardless of the value of waitCount.
* If the track buffer is full and track is not stopped, obtainBuffer() blocks with a
@@ -526,14 +533,17 @@ public:
* size actual number of bytes available
* raw pointer to the buffer
*/
-
/* FIXME Deprecated public API for TRANSFER_OBTAIN mode */
- status_t obtainBuffer(Buffer* audioBuffer, int32_t waitCount)
+ status_t obtainBuffer(Buffer* audioBuffer, int32_t waitCount,
+ size_t *nonContig = NULL)
__attribute__((__deprecated__));
private:
/* If nonContig is non-NULL, it is an output parameter that will be set to the number of
- * additional non-contiguous frames that are available immediately.
+ * additional non-contiguous frames that are predicted to be available immediately,
+ * if the client were to release the first frames and then call obtainBuffer() again.
+ * This value is only a prediction, and needs to be confirmed.
+ * It will be set to zero for an error return.
* FIXME We could pass an array of Buffers instead of only one Buffer to obtainBuffer(),
* in case the requested amount of frames is in two or more non-contiguous regions.
* FIXME requested and elapsed are both relative times. Consider changing to absolute time.
diff --git a/media/libmedia/AudioTrack.cpp b/media/libmedia/AudioTrack.cpp
index 0713c66..720db17 100644
--- a/media/libmedia/AudioTrack.cpp
+++ b/media/libmedia/AudioTrack.cpp
@@ -1236,7 +1236,7 @@ release:
return status;
}
-status_t AudioTrack::obtainBuffer(Buffer* audioBuffer, int32_t waitCount)
+status_t AudioTrack::obtainBuffer(Buffer* audioBuffer, int32_t waitCount, size_t *nonContig)
{
if (audioBuffer == NULL) {
return BAD_VALUE;
@@ -1263,7 +1263,7 @@ status_t AudioTrack::obtainBuffer(Buffer* audioBuffer, int32_t waitCount)
ALOGE("%s invalid waitCount %d", __func__, waitCount);
requested = NULL;
}
- return obtainBuffer(audioBuffer, requested);
+ return obtainBuffer(audioBuffer, requested, NULL /*elapsed*/, nonContig);
}
status_t AudioTrack::obtainBuffer(Buffer* audioBuffer, const struct timespec *requested,