diff options
author | Eric Laurent <elaurent@google.com> | 2014-11-14 10:06:21 -0800 |
---|---|---|
committer | Eric Laurent <elaurent@google.com> | 2014-11-25 12:48:19 -0800 |
commit | e83b55dc29ca16092ba02f36f55fa6e0e37fd78c (patch) | |
tree | f8232611b6372b74579e3ed03dfbeb167011d257 /services/audioflinger | |
parent | 0f78eabb733e1413d7febd00c0bad0f0add02314 (diff) | |
download | frameworks_av-e83b55dc29ca16092ba02f36f55fa6e0e37fd78c.zip frameworks_av-e83b55dc29ca16092ba02f36f55fa6e0e37fd78c.tar.gz frameworks_av-e83b55dc29ca16092ba02f36f55fa6e0e37fd78c.tar.bz2 |
audio policy: new getOutputForAttr() prototype.
Update getOutputForAttr() prototype and group all logic
dealing with audio attributes to stream type conversion in
audio policy manager.
getOutputForAttr():
- specifies the audio session (for future use)
- returns a status code
- receives either stream type (for legacy) or audio attributes
- returns an updated streamtype
Remove logic dealing with legacy stream types to attributes conversion
from AudioTrack.
Use correct type for audio sessions in other APIs (startOutput() ...).
releaseOutput() specifies the audio session (for future use).
Bug: 18067208.
Change-Id: I1bfbe9626c04c7955d77f8a70aecfad2cb204817
Diffstat (limited to 'services/audioflinger')
-rw-r--r-- | services/audioflinger/Threads.cpp | 12 | ||||
-rw-r--r-- | services/audioflinger/Tracks.cpp | 2 |
2 files changed, 9 insertions, 5 deletions
diff --git a/services/audioflinger/Threads.cpp b/services/audioflinger/Threads.cpp index 792419f..08d9eb1 100644 --- a/services/audioflinger/Threads.cpp +++ b/services/audioflinger/Threads.cpp @@ -1622,13 +1622,15 @@ status_t AudioFlinger::PlaybackThread::addTrack_l(const sp<Track>& track) if (track->isExternalTrack()) { TrackBase::track_state state = track->mState; mLock.unlock(); - status = AudioSystem::startOutput(mId, track->streamType(), track->sessionId()); + status = AudioSystem::startOutput(mId, track->streamType(), + (audio_session_t)track->sessionId()); mLock.lock(); // abort track was stopped/paused while we released the lock if (state != track->mState) { if (status == NO_ERROR) { mLock.unlock(); - AudioSystem::stopOutput(mId, track->streamType(), track->sessionId()); + AudioSystem::stopOutput(mId, track->streamType(), + (audio_session_t)track->sessionId()); mLock.lock(); } return INVALID_OPERATION; @@ -2057,13 +2059,15 @@ void AudioFlinger::PlaybackThread::threadLoop_removeTracks( for (size_t i = 0 ; i < count ; i++) { const sp<Track>& track = tracksToRemove.itemAt(i); if (track->isExternalTrack()) { - AudioSystem::stopOutput(mId, track->streamType(), track->sessionId()); + AudioSystem::stopOutput(mId, track->streamType(), + (audio_session_t)track->sessionId()); #ifdef ADD_BATTERY_DATA // to track the speaker usage addBatteryData(IMediaPlayerService::kBatteryDataAudioFlingerStop); #endif if (track->isTerminated()) { - AudioSystem::releaseOutput(mId); + AudioSystem::releaseOutput(mId, track->streamType(), + (audio_session_t)track->sessionId()); } } } diff --git a/services/audioflinger/Tracks.cpp b/services/audioflinger/Tracks.cpp index aa708ec..fcbf8f8 100644 --- a/services/audioflinger/Tracks.cpp +++ b/services/audioflinger/Tracks.cpp @@ -491,7 +491,7 @@ void AudioFlinger::PlaybackThread::Track::destroy() wasActive = playbackThread->destroyTrack_l(this); } if (isExternalTrack() && !wasActive) { - AudioSystem::releaseOutput(mThreadIoHandle); + AudioSystem::releaseOutput(mThreadIoHandle, mStreamType, (audio_session_t)mSessionId); } } } |