summaryrefslogtreecommitdiffstats
path: root/media/libmedia/AudioTrack.cpp
diff options
context:
space:
mode:
authorEric Laurent <elaurent@google.com>2013-10-16 15:38:30 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2013-10-16 15:38:30 -0700
commit771f1b6d196b7924707fc44177ac3a88fc31fa9e (patch)
treeffd599ada0a44511112fe0586c8f56121ce9ce6e /media/libmedia/AudioTrack.cpp
parenta529ee78d7cc5d94cbe79cea2d7e6469c88a0fba (diff)
parent7f8c397378a7ee5abd395413be71388ad36d3ed2 (diff)
downloadframeworks_av-771f1b6d196b7924707fc44177ac3a88fc31fa9e.zip
frameworks_av-771f1b6d196b7924707fc44177ac3a88fc31fa9e.tar.gz
frameworks_av-771f1b6d196b7924707fc44177ac3a88fc31fa9e.tar.bz2
am 7f8c3973: am 120a8847: Merge "AudioTrack: fix head position after restore" into klp-dev
* commit '7f8c397378a7ee5abd395413be71388ad36d3ed2': AudioTrack: fix head position after restore
Diffstat (limited to 'media/libmedia/AudioTrack.cpp')
-rw-r--r--media/libmedia/AudioTrack.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/media/libmedia/AudioTrack.cpp b/media/libmedia/AudioTrack.cpp
index 382f708..643159f 100644
--- a/media/libmedia/AudioTrack.cpp
+++ b/media/libmedia/AudioTrack.cpp
@@ -1661,7 +1661,9 @@ status_t AudioTrack::restoreTrack_l(const char *from)
// if the new IAudioTrack is created, createTrack_l() will modify the
// following member variables: mAudioTrack, mCblkMemory and mCblk.
// It will also delete the strong references on previous IAudioTrack and IMemory
- size_t position = mProxy->getPosition();
+
+ // take the frames that will be lost by track recreation into account in saved position
+ size_t position = mProxy->getPosition() + mProxy->getFramesFilled();
mNewPosition = position + mUpdatePeriod;
size_t bufferPosition = mStaticProxy != NULL ? mStaticProxy->getBufferPosition() : 0;
result = createTrack_l(mStreamType,