Loading services/audiopolicy/common/managerdefinitions/include/EffectDescriptor.h +9 −10 Original line number Diff line number Diff line Loading @@ -100,20 +100,19 @@ public: */ audio_io_handle_t getIoForSession(audio_session_t sessionId, const effect_uuid_t* effectType = nullptr) const; bool hasOrphansForSession(audio_session_t sessionId) const; EffectDescriptorCollection getOrphanEffectsForSession(audio_session_t sessionId) const; void dump(String8 *dst, int spaces = 0, bool verbose = true) const; /** * @brief Checks if there is at least one orphan effect with given sessionId and effect type * uuid. * @brief Checks if there is at least one orphan effect with given sessionId and optional effect * type uuid. * @param sessionId Session ID. * @param effectType Effect type UUID, the implementation will be same as hasOrphansForSession * if null. * @param effectType Optional effect type UUID pointer to effect_uuid_t, nullptr by default. * @return True if there is an orphan effect for given sessionId and type UUID, false otherwise. */ bool hasOrphanEffectsForSessionAndType(audio_session_t sessionId, const effect_uuid_t* effectType) const; bool hasOrphansForSession(audio_session_t sessionId, const effect_uuid_t* effectType = nullptr) const; EffectDescriptorCollection getOrphanEffectsForSession(audio_session_t sessionId) const; void dump(String8 *dst, int spaces = 0, bool verbose = true) const; private: status_t setEffectEnabled(const sp<EffectDescriptor> &effectDesc, bool enabled); Loading services/audiopolicy/common/managerdefinitions/src/EffectDescriptor.cpp +5 −19 Original line number Diff line number Diff line Loading @@ -210,27 +210,13 @@ void EffectDescriptorCollection::moveEffects(const std::vector<int>& ids, audio_ } } bool EffectDescriptorCollection::hasOrphansForSession(audio_session_t sessionId) const { bool EffectDescriptorCollection::hasOrphansForSession(audio_session_t sessionId, const effect_uuid_t* effectType) const { for (size_t i = 0; i < size(); ++i) { sp<EffectDescriptor> effect = valueAt(i); if (effect->mSession == sessionId && effect->mIsOrphan) { return true; } } return false; } bool EffectDescriptorCollection::hasOrphanEffectsForSessionAndType( audio_session_t sessionId, const effect_uuid_t* effectType) const { if (effectType == nullptr) { return hasOrphansForSession(sessionId); } for (size_t i = 0; i < size(); ++i) { sp<EffectDescriptor> effect = valueAt(i); if (effect->mIsOrphan && effect->mSession == sessionId && memcmp(&effect->mDesc.type, effectType, sizeof(effect_uuid_t)) == 0) { if (effect->mSession == sessionId && effect->mIsOrphan && (effectType == nullptr || memcmp(&effect->mDesc.type, effectType, sizeof(effect_uuid_t)) == 0)) { return true; } } Loading services/audiopolicy/managerdefault/AudioPolicyManager.cpp +2 −3 Original line number Diff line number Diff line Loading @@ -2087,8 +2087,7 @@ audio_io_handle_t AudioPolicyManager::selectOutput(const SortedVector<audio_io_h // matching criteria values in priority order for best matching output so far std::vector<uint32_t> bestMatchCriteria(8, 0); const bool hasOrphanHaptic = mEffects.hasOrphanEffectsForSessionAndType(sessionId, FX_IID_HAPTICGENERATOR); const bool hasOrphanHaptic = mEffects.hasOrphansForSession(sessionId, FX_IID_HAPTICGENERATOR); const uint32_t channelCount = audio_channel_count_from_out_mask(channelMask); const uint32_t hapticChannelCount = audio_channel_count_from_out_mask( channelMask & AUDIO_CHANNEL_HAPTIC_ALL); Loading Loading @@ -6145,7 +6144,7 @@ bool AudioPolicyManager::checkHapticCompatibilityOnSpatializerOutput( // means haptic use cases (either the client channelmask includes haptic bits, or created a // HapticGenerator effect for this session) are not supported. return clientHapticChannel == 0 && !mEffects.hasOrphanEffectsForSessionAndType(sessionId, FX_IID_HAPTICGENERATOR); !mEffects.hasOrphansForSession(sessionId, FX_IID_HAPTICGENERATOR); } } Loading Loading
services/audiopolicy/common/managerdefinitions/include/EffectDescriptor.h +9 −10 Original line number Diff line number Diff line Loading @@ -100,20 +100,19 @@ public: */ audio_io_handle_t getIoForSession(audio_session_t sessionId, const effect_uuid_t* effectType = nullptr) const; bool hasOrphansForSession(audio_session_t sessionId) const; EffectDescriptorCollection getOrphanEffectsForSession(audio_session_t sessionId) const; void dump(String8 *dst, int spaces = 0, bool verbose = true) const; /** * @brief Checks if there is at least one orphan effect with given sessionId and effect type * uuid. * @brief Checks if there is at least one orphan effect with given sessionId and optional effect * type uuid. * @param sessionId Session ID. * @param effectType Effect type UUID, the implementation will be same as hasOrphansForSession * if null. * @param effectType Optional effect type UUID pointer to effect_uuid_t, nullptr by default. * @return True if there is an orphan effect for given sessionId and type UUID, false otherwise. */ bool hasOrphanEffectsForSessionAndType(audio_session_t sessionId, const effect_uuid_t* effectType) const; bool hasOrphansForSession(audio_session_t sessionId, const effect_uuid_t* effectType = nullptr) const; EffectDescriptorCollection getOrphanEffectsForSession(audio_session_t sessionId) const; void dump(String8 *dst, int spaces = 0, bool verbose = true) const; private: status_t setEffectEnabled(const sp<EffectDescriptor> &effectDesc, bool enabled); Loading
services/audiopolicy/common/managerdefinitions/src/EffectDescriptor.cpp +5 −19 Original line number Diff line number Diff line Loading @@ -210,27 +210,13 @@ void EffectDescriptorCollection::moveEffects(const std::vector<int>& ids, audio_ } } bool EffectDescriptorCollection::hasOrphansForSession(audio_session_t sessionId) const { bool EffectDescriptorCollection::hasOrphansForSession(audio_session_t sessionId, const effect_uuid_t* effectType) const { for (size_t i = 0; i < size(); ++i) { sp<EffectDescriptor> effect = valueAt(i); if (effect->mSession == sessionId && effect->mIsOrphan) { return true; } } return false; } bool EffectDescriptorCollection::hasOrphanEffectsForSessionAndType( audio_session_t sessionId, const effect_uuid_t* effectType) const { if (effectType == nullptr) { return hasOrphansForSession(sessionId); } for (size_t i = 0; i < size(); ++i) { sp<EffectDescriptor> effect = valueAt(i); if (effect->mIsOrphan && effect->mSession == sessionId && memcmp(&effect->mDesc.type, effectType, sizeof(effect_uuid_t)) == 0) { if (effect->mSession == sessionId && effect->mIsOrphan && (effectType == nullptr || memcmp(&effect->mDesc.type, effectType, sizeof(effect_uuid_t)) == 0)) { return true; } } Loading
services/audiopolicy/managerdefault/AudioPolicyManager.cpp +2 −3 Original line number Diff line number Diff line Loading @@ -2087,8 +2087,7 @@ audio_io_handle_t AudioPolicyManager::selectOutput(const SortedVector<audio_io_h // matching criteria values in priority order for best matching output so far std::vector<uint32_t> bestMatchCriteria(8, 0); const bool hasOrphanHaptic = mEffects.hasOrphanEffectsForSessionAndType(sessionId, FX_IID_HAPTICGENERATOR); const bool hasOrphanHaptic = mEffects.hasOrphansForSession(sessionId, FX_IID_HAPTICGENERATOR); const uint32_t channelCount = audio_channel_count_from_out_mask(channelMask); const uint32_t hapticChannelCount = audio_channel_count_from_out_mask( channelMask & AUDIO_CHANNEL_HAPTIC_ALL); Loading Loading @@ -6145,7 +6144,7 @@ bool AudioPolicyManager::checkHapticCompatibilityOnSpatializerOutput( // means haptic use cases (either the client channelmask includes haptic bits, or created a // HapticGenerator effect for this session) are not supported. return clientHapticChannel == 0 && !mEffects.hasOrphanEffectsForSessionAndType(sessionId, FX_IID_HAPTICGENERATOR); !mEffects.hasOrphansForSession(sessionId, FX_IID_HAPTICGENERATOR); } } Loading