summaryrefslogtreecommitdiffstats
path: root/media/libmedia/AudioTrack.cpp
diff options
context:
space:
mode:
authorAndy Hung <hunga@google.com>2015-07-24 07:52:41 -0700
committerAndy Hung <hunga@google.com>2015-07-24 11:01:55 -0700
commitd7bd69e4d1e74f25413721804d5290c53ea87f2b (patch)
treeabd46c30e346d4abfbd2dafc303f531be923a35f /media/libmedia/AudioTrack.cpp
parent240577a43ff8d312fa4b464db887916580473396 (diff)
downloadframeworks_av-d7bd69e4d1e74f25413721804d5290c53ea87f2b.zip
frameworks_av-d7bd69e4d1e74f25413721804d5290c53ea87f2b.tar.gz
frameworks_av-d7bd69e4d1e74f25413721804d5290c53ea87f2b.tar.bz2
Fix restore position warning and static track adjustment
Remove unnecessary restoreTrack_l() position warning when AudioTrack output device changes. Also, fix rare getPosition() offset error if a static track is continuously playing a long time (> 24 hours at 48khz sampling) and its output device changes. Bug: 22524122 Bug: 21699132 Change-Id: I5a35c13d62ff9f0702b09d5cd9362c730364b18c
Diffstat (limited to 'media/libmedia/AudioTrack.cpp')
-rw-r--r--media/libmedia/AudioTrack.cpp18
1 files changed, 9 insertions, 9 deletions
diff --git a/media/libmedia/AudioTrack.cpp b/media/libmedia/AudioTrack.cpp
index ab720c6..4437638 100644
--- a/media/libmedia/AudioTrack.cpp
+++ b/media/libmedia/AudioTrack.cpp
@@ -483,7 +483,6 @@ status_t AudioTrack::set(
mMarkerReached = false;
mNewPosition = 0;
mUpdatePeriod = 0;
- mServer = 0;
mPosition = 0;
mReleased = 0;
mStartUs = 0;
@@ -1389,6 +1388,9 @@ status_t AudioTrack::createTrack_l()
mReqFrameCount = frameCount;
}
+ // reset server position to 0 as we have new cblk.
+ mServer = 0;
+
// update proxy
if (mSharedBuffer == 0) {
mStaticProxy.clear();
@@ -2109,15 +2111,13 @@ status_t AudioTrack::restoreTrack_l(const char *from)
// If a new IAudioTrack cannot be created, the previous (dead) instance will be left intact.
status_t result = createTrack_l();
- // take the frames that will be lost by track recreation into account in saved position
- // For streaming tracks, this is the amount we obtained from the user/client
- // (not the number actually consumed at the server - those are already lost).
- (void) updateAndGetPosition_l();
- if (mStaticProxy == 0) {
- mPosition = mReleased;
- }
-
if (result == NO_ERROR) {
+ // take the frames that will be lost by track recreation into account in saved position
+ // For streaming tracks, this is the amount we obtained from the user/client
+ // (not the number actually consumed at the server - those are already lost).
+ if (mStaticProxy == 0) {
+ mPosition = mReleased;
+ }
// Continue playback from last known position and restore loop.
if (mStaticProxy != 0) {
if (loopCount != 0) {