summaryrefslogtreecommitdiffstats
path: root/services/audioflinger
diff options
context:
space:
mode:
authorSumit Bhattacharya <sumitb@nvidia.com>2015-11-19 12:56:41 +0530
committerSteve Kondik <steve@cyngn.com>2015-12-07 18:45:16 -0800
commit5f72c89a07f3a8881a4b9536221a5f9883d8a3b6 (patch)
tree4afe61b6f43b28d5c9d491fd5dfbc0ae250ace5b /services/audioflinger
parent3c51eb879f0fb925118d8ead8af8d511537caff8 (diff)
downloadframeworks_av-5f72c89a07f3a8881a4b9536221a5f9883d8a3b6.zip
frameworks_av-5f72c89a07f3a8881a4b9536221a5f9883d8a3b6.tar.gz
frameworks_av-5f72c89a07f3a8881a4b9536221a5f9883d8a3b6.tar.bz2
AudioFlinger: Fix re-use of fast-track
When a fast-track using shared buffer is restarted, we need to call obtainbuffer if frameReady has already become zero, even if track is still active. This is required to reset mFramesReadySafe. Otherwise mFramesReadySafe remain at 0 and fastmixer can't consume data from the track when it is re-used. Change-Id: I5d6f364f8f31baad3341bd4f51bf8a8b147cd7d7
Diffstat (limited to 'services/audioflinger')
-rw-r--r--services/audioflinger/Tracks.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/services/audioflinger/Tracks.cpp b/services/audioflinger/Tracks.cpp
index 98eb87f..4eb13dc 100644
--- a/services/audioflinger/Tracks.cpp
+++ b/services/audioflinger/Tracks.cpp
@@ -707,10 +707,11 @@ status_t AudioFlinger::PlaybackThread::Track::start(AudioSystem::sync_event_t ev
mState = state;
}
}
- // track was already in the active list, not a problem
- if (status == ALREADY_EXISTS) {
- status = NO_ERROR;
- } else {
+ // If track was already in the active list, not a problem unless
+ // track is fast and sharedBuffer is used and frameReady has already become 0.
+ // In such case we need to call obtainbuffer() to refresh the framesReady value.
+ if ((status != ALREADY_EXISTS) ||
+ (isFastTrack() && (mSharedBuffer != 0) && (framesReady() == 0))) {
// Acknowledge any pending flush(), so that subsequent new data isn't discarded.
// It is usually unsafe to access the server proxy from a binder thread.
// But in this case we know the mixer thread (whether normal mixer or fast mixer)
@@ -720,6 +721,9 @@ status_t AudioFlinger::PlaybackThread::Track::start(AudioSystem::sync_event_t ev
buffer.mFrameCount = 1;
(void) mAudioTrackServerProxy->obtainBuffer(&buffer, true /*ackFlush*/);
}
+
+ if (status == ALREADY_EXISTS)
+ status = NO_ERROR;
} else {
status = BAD_VALUE;
}