diff options
author | Eric Laurent <elaurent@google.com> | 2014-08-01 14:48:35 -0700 |
---|---|---|
committer | Eric Laurent <elaurent@google.com> | 2014-08-06 00:38:23 +0000 |
commit | 93c3d41bdb15e39dac0faea9c5b60f1637cd477c (patch) | |
tree | a0d739ad732f10bc9d4548923c78c590841b14da /services/audioflinger | |
parent | 92ce4715315bddd158c7d4028556632f0547e3b9 (diff) | |
download | frameworks_av-93c3d41bdb15e39dac0faea9c5b60f1637cd477c.zip frameworks_av-93c3d41bdb15e39dac0faea9c5b60f1637cd477c.tar.gz frameworks_av-93c3d41bdb15e39dac0faea9c5b60f1637cd477c.tar.bz2 |
AudioSystem: add API to query audio HW sync source
Add a method to query from the audio HAL the HW sync
source used for a given audio session.
Modify audio policy to select a direct output with HW sync
when requested.
Bug: 16132368.
Change-Id: I03038f9188f2d389f8a5fd76a671854013a4513e
Diffstat (limited to 'services/audioflinger')
-rw-r--r-- | services/audioflinger/AudioFlinger.cpp | 19 | ||||
-rw-r--r-- | services/audioflinger/AudioFlinger.h | 3 |
2 files changed, 22 insertions, 0 deletions
diff --git a/services/audioflinger/AudioFlinger.cpp b/services/audioflinger/AudioFlinger.cpp index b8cc33a..1f77b2f 100644 --- a/services/audioflinger/AudioFlinger.cpp +++ b/services/audioflinger/AudioFlinger.cpp @@ -1579,6 +1579,25 @@ status_t AudioFlinger::setLowRamDevice(bool isLowRamDevice) return NO_ERROR; } +audio_hw_sync_t AudioFlinger::getAudioHwSyncForSession(audio_session_t sessionId) +{ + Mutex::Autolock _l(mLock); + for (size_t i = 0; i < mPlaybackThreads.size(); i++) { + sp<PlaybackThread> thread = mPlaybackThreads.valueAt(i); + if ((thread->hasAudioSession(sessionId) & ThreadBase::TRACK_SESSION) != 0) { + // A session can only be on one thread, so exit after first match + String8 reply = thread->getParameters(String8(AUDIO_PARAMETER_STREAM_HW_AV_SYNC)); + AudioParameter param = AudioParameter(reply); + int value; + if (param.getInt(String8(AUDIO_PARAMETER_STREAM_HW_AV_SYNC), value) == NO_ERROR) { + return value; + } + break; + } + } + return AUDIO_HW_SYNC_INVALID; +} + // ---------------------------------------------------------------------------- diff --git a/services/audioflinger/AudioFlinger.h b/services/audioflinger/AudioFlinger.h index 31c5a1a..4e9d49b 100644 --- a/services/audioflinger/AudioFlinger.h +++ b/services/audioflinger/AudioFlinger.h @@ -248,6 +248,9 @@ public: /* Set audio port configuration */ virtual status_t setAudioPortConfig(const struct audio_port_config *config); + /* Get the HW synchronization source used for an audio session */ + virtual audio_hw_sync_t getAudioHwSyncForSession(audio_session_t sessionId); + virtual status_t onTransact( uint32_t code, const Parcel& data, |