From 275e8e9de2e11b4b344f5a201f1f0e51fda02d9c Mon Sep 17 00:00:00 2001 From: Eric Laurent Date: Sun, 30 Nov 2014 15:14:47 -0800 Subject: audio policy: add support for custom mixes Add support for custom mixes in AudioPolicyManager. Two methods are added to register or unregister a list of custom mixes with their attributes and format. getOutputForAttr() and getInputForAttr() first look for a match in registered mixes before defaulting to normal output/input selection Remote submix device connection disconnection now takes address into account to identify the correspnoding custom mix. Bug: 16009464. Change-Id: I3f1c2a485a0fb71b1f984ed0adc9b68aa971e408 --- media/libmedia/AudioTrack.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'media/libmedia/AudioTrack.cpp') diff --git a/media/libmedia/AudioTrack.cpp b/media/libmedia/AudioTrack.cpp index e4c3c08..d9c3177 100644 --- a/media/libmedia/AudioTrack.cpp +++ b/media/libmedia/AudioTrack.cpp @@ -851,6 +851,10 @@ status_t AudioTrack::getPosition(uint32_t *position) // due to hardware latency. We leave this behavior for now. *position = dspFrames; } else { + if (mCblk->mFlags & CBLK_INVALID) { + restoreTrack_l("getPosition"); + } + // IAudioTrack::stop() isn't synchronous; we don't know when presentation completes *position = (mState == STATE_STOPPED || mState == STATE_FLUSHED) ? 0 : updateAndGetPosition_l(); @@ -1946,6 +1950,10 @@ status_t AudioTrack::getTimestamp(AudioTimestamp& timestamp) break; } + if (mCblk->mFlags & CBLK_INVALID) { + restoreTrack_l("getTimestamp"); + } + // The presented frame count must always lag behind the consumed frame count. // To avoid a race, read the presented frames first. This ensures that presented <= consumed. status_t status = mAudioTrack->getTimestamp(timestamp); -- cgit v1.1