summaryrefslogtreecommitdiffstats
path: root/media/libmedia/AudioTrack.cpp
diff options
context:
space:
mode:
authorGlenn Kasten <gkasten@google.com>2012-11-30 13:35:29 -0800
committerGlenn Kasten <gkasten@google.com>2013-01-07 14:24:21 -0800
commit9c6745f128648f6e0144b74ee593911a9fa10d51 (patch)
tree04921173242fd90eec6f5d6589d0e7c2edc53c4d /media/libmedia/AudioTrack.cpp
parentf78f2629f5f6f5fc37a2089a85107fed97f12192 (diff)
downloadframeworks_av-9c6745f128648f6e0144b74ee593911a9fa10d51.zip
frameworks_av-9c6745f128648f6e0144b74ee593911a9fa10d51.tar.gz
frameworks_av-9c6745f128648f6e0144b74ee593911a9fa10d51.tar.bz2
Propose new interpretation for setPosition and setLoop
Add new API getBufferPosition to return position relative to start of fixed buffer. Change-Id: I7aca8e392d45b988545f07b36b5032691057b03e
Diffstat (limited to 'media/libmedia/AudioTrack.cpp')
-rw-r--r--media/libmedia/AudioTrack.cpp45
1 files changed, 45 insertions, 0 deletions
diff --git a/media/libmedia/AudioTrack.cpp b/media/libmedia/AudioTrack.cpp
index 1bd839f..2d77581 100644
--- a/media/libmedia/AudioTrack.cpp
+++ b/media/libmedia/AudioTrack.cpp
@@ -561,6 +561,26 @@ status_t AudioTrack::setLoop_l(uint32_t loopStart, uint32_t loopEnd, int loopCou
return INVALID_OPERATION;
}
+ if (loopCount < 0 && loopCount != -1) {
+ return BAD_VALUE;
+ }
+
+#if 0
+ // This will be for the new interpretation of loopStart and loopEnd
+
+ if (loopCount != 0) {
+ if (loopStart >= mFrameCount || loopEnd >= mFrameCount || loopStart >= loopEnd) {
+ return BAD_VALUE;
+ }
+ uint32_t periodFrames = loopEnd - loopStart;
+ if (periodFrames < PERIOD_FRAMES_MIN) {
+ return BAD_VALUE;
+ }
+ }
+
+ // The remainder of this code still uses the old interpretation
+#endif
+
audio_track_cblk_t* cblk = mCblk;
Mutex::Autolock _l(cblk->lock);
@@ -656,6 +676,16 @@ status_t AudioTrack::setPosition(uint32_t position)
return INVALID_OPERATION;
}
+#if 0
+ // This will be for the new interpretation of position
+
+ if (position >= mFrameCount) {
+ return BAD_VALUE;
+ }
+
+ // The remainder of this code still uses the old interpretation
+#endif
+
audio_track_cblk_t* cblk = mCblk;
Mutex::Autolock _l(cblk->lock);
@@ -680,6 +710,21 @@ status_t AudioTrack::getPosition(uint32_t *position)
return NO_ERROR;
}
+#if 0
+status_t AudioTrack::getBufferPosition(uint32_t *position)
+{
+ if (mSharedBuffer == 0 || mIsTimed) {
+ return INVALID_OPERATION;
+ }
+ if (position == NULL) {
+ return BAD_VALUE;
+ }
+ *position = 0;
+
+ return NO_ERROR;
+}
+#endif
+
status_t AudioTrack::reload()
{
if (mStatus != NO_ERROR) {