diff options
author | François Gaffie <francois.gaffie@intel.com> | 2015-05-13 18:13:00 +0200 |
---|---|---|
committer | Eric Laurent <elaurent@google.com> | 2015-06-18 10:55:05 -0700 |
commit | 0f17ab7f9fac4327a8772e9199f411af7df912a4 (patch) | |
tree | 05d9dcb97a6f76ce0c0a43520d81705eb3241c27 /services/audiopolicy/engineconfigurable/src | |
parent | 20f06f996337c9bf79d0b112083f6427a122ebab (diff) | |
download | frameworks_av-0f17ab7f9fac4327a8772e9199f411af7df912a4.zip frameworks_av-0f17ab7f9fac4327a8772e9199f411af7df912a4.tar.gz frameworks_av-0f17ab7f9fac4327a8772e9199f411af7df912a4.tar.bz2 |
Bug fix on Engine Configurable
This patch fixes a couple of issue within audio policy engine configurable
-valgrind error detected within the parsing of the configuration file
-configuration file typos
-start of the PFW delayed to the init in order to wait the full construction
of the engine object
-wrong specialization of template functions.
-broadcast volume min / max init to stream collection of manager & PFW
Change-Id: I08823ab4040c92b719747c60cc3fa5c8b5f172ac
Signed-off-by: François Gaffie <francois.gaffie@intel.com>
Diffstat (limited to 'services/audiopolicy/engineconfigurable/src')
-rwxr-xr-x | services/audiopolicy/engineconfigurable/src/Engine.cpp | 63 |
1 files changed, 26 insertions, 37 deletions
diff --git a/services/audiopolicy/engineconfigurable/src/Engine.cpp b/services/audiopolicy/engineconfigurable/src/Engine.cpp index 61fae71..733cdf6 100755 --- a/services/audiopolicy/engineconfigurable/src/Engine.cpp +++ b/services/audiopolicy/engineconfigurable/src/Engine.cpp @@ -87,11 +87,6 @@ Engine::Engine() mPolicyParameterMgr(new ParameterManagerWrapper()), mApmObserver(NULL) { - if (mPolicyParameterMgr->start() != NO_ERROR) { - ALOGE("%s: could not start Policy PFW", __FUNCTION__); - delete mPolicyParameterMgr; - mPolicyParameterMgr = NULL; - } } Engine::~Engine() @@ -111,10 +106,13 @@ void Engine::setObserver(AudioPolicyManagerObserver *observer) status_t Engine::initCheck() { - return (mPolicyParameterMgr != NULL) && - mPolicyParameterMgr->isStarted() && - (mApmObserver != NULL)? - NO_ERROR : NO_INIT; + if (mPolicyParameterMgr != NULL && mPolicyParameterMgr->start() != NO_ERROR) { + ALOGE("%s: could not start Policy PFW", __FUNCTION__); + delete mPolicyParameterMgr; + mPolicyParameterMgr = NULL; + return NO_INIT; + } + return (mApmObserver != NULL)? NO_ERROR : NO_INIT; } bool Engine::setVolumeProfileForStream(const audio_stream_type_t &streamType, @@ -143,19 +141,6 @@ status_t Engine::add(const std::string &name, const Key &key) return collection.add(name, key); } -template <> -routing_strategy Engine::getPropertyForKey<routing_strategy, audio_usage_t>(audio_usage_t usage) const -{ - const SwAudioOutputCollection &outputs = mApmObserver->getOutputs(); - - if (usage == AUDIO_USAGE_ASSISTANCE_ACCESSIBILITY && - (outputs.isStreamActive(AUDIO_STREAM_RING) || - outputs.isStreamActive(AUDIO_STREAM_ALARM))) { - return STRATEGY_SONIFICATION; - } - return getPropertyForKey<routing_strategy, audio_usage_t>(usage); -} - template <typename Property, typename Key> Property Engine::getPropertyForKey(Key key) const { @@ -167,10 +152,21 @@ Property Engine::getPropertyForKey(Key key) const return element->template get<Property>(); } -template <> -audio_devices_t Engine::getPropertyForKey<audio_devices_t, routing_strategy>(routing_strategy strategy) const +routing_strategy Engine::ManagerInterfaceImpl::getStrategyForUsage(audio_usage_t usage) { - const SwAudioOutputCollection &outputs = mApmObserver->getOutputs(); + const SwAudioOutputCollection &outputs = mPolicyEngine->mApmObserver->getOutputs(); + + if (usage == AUDIO_USAGE_ASSISTANCE_ACCESSIBILITY && + (outputs.isStreamActive(AUDIO_STREAM_RING) || + outputs.isStreamActive(AUDIO_STREAM_ALARM))) { + return STRATEGY_SONIFICATION; + } + return mPolicyEngine->getPropertyForKey<routing_strategy, audio_usage_t>(usage); +} + +audio_devices_t Engine::ManagerInterfaceImpl::getDeviceForStrategy(routing_strategy strategy) const +{ + const SwAudioOutputCollection &outputs = mPolicyEngine->mApmObserver->getOutputs(); /** This is the only case handled programmatically because the PFW is unable to know the * activity of streams. @@ -187,19 +183,9 @@ audio_devices_t Engine::getPropertyForKey<audio_devices_t, routing_strategy>(rou !outputs.isStreamActiveRemotely(AUDIO_STREAM_MUSIC, SONIFICATION_RESPECTFUL_AFTER_MUSIC_DELAY) && outputs.isStreamActive(AUDIO_STREAM_MUSIC, SONIFICATION_RESPECTFUL_AFTER_MUSIC_DELAY)) { - return getPropertyForKey<audio_devices_t, routing_strategy>(STRATEGY_MEDIA); + return mPolicyEngine->getPropertyForKey<audio_devices_t, routing_strategy>(STRATEGY_MEDIA); } - return getPropertyForKey<audio_devices_t, routing_strategy>(strategy); -} - -routing_strategy Engine::ManagerInterfaceImpl::getStrategyForUsage(audio_usage_t usage) -{ - return mPolicyEngine->getPropertyForKey<routing_strategy, audio_usage_t>(usage); -} - -audio_devices_t Engine::ManagerInterfaceImpl::getDeviceForStrategy(routing_strategy stategy) const -{ - return mPolicyEngine->getPropertyForKey<audio_devices_t, routing_strategy>(stategy); + return mPolicyEngine->getPropertyForKey<audio_devices_t, routing_strategy>(strategy); } template <typename Property, typename Key> @@ -233,6 +219,9 @@ status_t Engine::initStreamVolume(audio_stream_type_t streamType, ALOGE("%s: Stream Type %d not found", __FUNCTION__, streamType); return BAD_TYPE; } + mApmObserver->getStreamDescriptors().setVolumeIndexMin(streamType, indexMin); + mApmObserver->getStreamDescriptors().setVolumeIndexMax(streamType, indexMax); + return stream->initVolume(indexMin, indexMax); } |