Loading services/audioflinger/AudioFlinger.h +7 −5 Original line number Diff line number Diff line Loading @@ -423,7 +423,8 @@ private: // for as long as possible. The memory is only freed when it is needed for another log writer. Vector< sp<NBLog::Writer> > mUnregisteredWriters; audio_utils::mutex& unregisteredWritersMutex() const { return mUnregisteredWritersMutex; } mutable audio_utils::mutex mUnregisteredWritersMutex; mutable audio_utils::mutex mUnregisteredWritersMutex{ audio_utils::MutexOrder::kAudioFlinger_UnregisteredWritersMutex}; AudioFlinger() ANDROID_API; ~AudioFlinger() override; Loading Loading @@ -495,7 +496,7 @@ private: bool mPendingRequests; // Mutex and condition variable around mPendingRequests' value audio_utils::mutex mMutex; audio_utils::mutex mMutex{audio_utils::MutexOrder::kMediaLogNotifier_Mutex}; audio_utils::condition_variable mCondition; // Duration of the sleep period after a processed request Loading Loading @@ -604,18 +605,19 @@ private: int mCnt; }; mutable audio_utils::mutex mMutex; mutable audio_utils::mutex mMutex{audio_utils::MutexOrder::kAudioFlinger_Mutex}; // protects mClients and mNotificationClients. // must be locked after mutex() and ThreadBase::mutex() if both must be locked // avoids acquiring AudioFlinger::mutex() from inside thread loop. mutable audio_utils::mutex mClientMutex; mutable audio_utils::mutex mClientMutex{audio_utils::MutexOrder::kAudioFlinger_ClientMutex}; DefaultKeyedVector<pid_t, wp<Client>> mClients GUARDED_BY(clientMutex()); // see ~Client() audio_utils::mutex& hardwareMutex() const { return mHardwareMutex; } mutable audio_utils::mutex mHardwareMutex; mutable audio_utils::mutex mHardwareMutex{ audio_utils::MutexOrder::kAudioFlinger_HardwareMutex}; // NOTE: If both mMutex and mHardwareMutex mutexes must be held, // always take mMutex before mHardwareMutex Loading services/audioflinger/DeviceEffectManager.h +1 −1 Original line number Diff line number Diff line Loading @@ -85,7 +85,7 @@ private: audio_utils::mutex& mutex() const RETURN_CAPABILITY(audio_utils::DeviceEffectManager_Mutex) { return mMutex; } mutable audio_utils::mutex mMutex; mutable audio_utils::mutex mMutex{audio_utils::MutexOrder::kDeviceEffectManager_Mutex}; const sp<IAfDeviceEffectManagerCallback> mAfDeviceEffectManagerCallback; const sp<DeviceEffectManagerCallback> mMyCallback; std::map<AudioDeviceTypeAddr, std::vector<sp<IAfDeviceEffectProxy>>> Loading services/audioflinger/Effects.h +8 −5 Original line number Diff line number Diff line Loading @@ -135,7 +135,7 @@ protected: DISALLOW_COPY_AND_ASSIGN(EffectBase); // mutex for process, commands and handles list protection mutable audio_utils::mutex mMutex; mutable audio_utils::mutex mMutex{audio_utils::MutexOrder::kEffectBase_Mutex}; mediautils::atomic_sp<EffectCallbackInterface> mCallback; // parent effect chain const int mId; // this instance unique ID const audio_session_t mSessionId; // audio session ID Loading @@ -151,7 +151,7 @@ protected: // Mutex protecting transactions with audio policy manager as mutex() cannot // be held to avoid cross deadlocks with audio policy mutex audio_utils::mutex& policyMutex() const { return mPolicyMutex; } mutable audio_utils::mutex mPolicyMutex; mutable audio_utils::mutex mPolicyMutex{audio_utils::MutexOrder::kEffectBase_PolicyMutex}; // Effect is registered in APM or not bool mPolicyRegistered = false; // Effect enabled state communicated to APM. Enabled state corresponds to Loading Loading @@ -367,7 +367,8 @@ private: DISALLOW_COPY_AND_ASSIGN(EffectHandle); audio_utils::mutex& mutex() const { return mMutex; } mutable audio_utils::mutex mMutex; // protects IEffect method calls // protects IEffect method calls mutable audio_utils::mutex mMutex{audio_utils::MutexOrder::kEffectHandle_Mutex}; const wp<IAfEffectBase> mEffect; // pointer to controlled EffectModule const sp<media::IEffectClient> mEffectClient; // callback interface for client notifications /*const*/ sp<Client> mClient; // client for shared memory allocation, see Loading Loading @@ -625,7 +626,8 @@ private: std::optional<size_t> findVolumeControl_l(size_t from, size_t to) const; mutable audio_utils::mutex mMutex; // mutex protecting effect list // mutex protecting effect list mutable audio_utils::mutex mMutex{audio_utils::MutexOrder::kEffectChain_Mutex}; Vector<sp<IAfEffectModule>> mEffects; // list of effect modules audio_session_t mSessionId; // audio session ID sp<EffectBufferHalInterface> mInBuffer; // chain input buffer Loading Loading @@ -764,7 +766,8 @@ private: const sp<ProxyCallback> mMyCallback; audio_utils::mutex& proxyMutex() const { return mProxyMutex; } mutable audio_utils::mutex mProxyMutex; mutable audio_utils::mutex mProxyMutex{ audio_utils::MutexOrder::kDeviceEffectProxy_ProxyMutex}; std::map<audio_patch_handle_t, sp<IAfEffectHandle>> mEffectHandles; // protected by mProxyMutex sp<IAfEffectModule> mHalEffect; // protected by mProxyMutex struct audio_port_config mDevicePort = { .id = AUDIO_PORT_HANDLE_NONE }; Loading services/audioflinger/MelReporter.h +1 −1 Original line number Diff line number Diff line Loading @@ -138,7 +138,7 @@ private: * Lock for protecting the active mel patches. Do not mix with the AudioFlinger lock. * Locking order AudioFlinger::mutex() -> PatchCommandThread::mutex() -> MelReporter::mutex(). */ mutable audio_utils::mutex mMutex; mutable audio_utils::mutex mMutex{audio_utils::MutexOrder::kMelReporter_Mutex}; std::unordered_map<audio_patch_handle_t, ActiveMelPatch> mActiveMelPatches GUARDED_BY(mutex()); std::unordered_map<audio_port_handle_t, int> mActiveDevices GUARDED_BY(mutex()); Loading services/audioflinger/PatchCommandThread.h +3 −2 Original line number Diff line number Diff line Loading @@ -130,11 +130,12 @@ private: return mListenerMutex; } mutable audio_utils::mutex mMutex; mutable audio_utils::mutex mMutex{audio_utils::MutexOrder::kPatchCommandThread_Mutex}; audio_utils::condition_variable mWaitWorkCV; std::deque<sp<Command>> mCommands GUARDED_BY(mutex()); // list of pending commands mutable audio_utils::mutex mListenerMutex; mutable audio_utils::mutex mListenerMutex{ audio_utils::MutexOrder::kPatchCommandThread_ListenerMutex}; std::vector<wp<PatchCommandListener>> mListeners GUARDED_BY(listenerMutex()); }; Loading Loading
services/audioflinger/AudioFlinger.h +7 −5 Original line number Diff line number Diff line Loading @@ -423,7 +423,8 @@ private: // for as long as possible. The memory is only freed when it is needed for another log writer. Vector< sp<NBLog::Writer> > mUnregisteredWriters; audio_utils::mutex& unregisteredWritersMutex() const { return mUnregisteredWritersMutex; } mutable audio_utils::mutex mUnregisteredWritersMutex; mutable audio_utils::mutex mUnregisteredWritersMutex{ audio_utils::MutexOrder::kAudioFlinger_UnregisteredWritersMutex}; AudioFlinger() ANDROID_API; ~AudioFlinger() override; Loading Loading @@ -495,7 +496,7 @@ private: bool mPendingRequests; // Mutex and condition variable around mPendingRequests' value audio_utils::mutex mMutex; audio_utils::mutex mMutex{audio_utils::MutexOrder::kMediaLogNotifier_Mutex}; audio_utils::condition_variable mCondition; // Duration of the sleep period after a processed request Loading Loading @@ -604,18 +605,19 @@ private: int mCnt; }; mutable audio_utils::mutex mMutex; mutable audio_utils::mutex mMutex{audio_utils::MutexOrder::kAudioFlinger_Mutex}; // protects mClients and mNotificationClients. // must be locked after mutex() and ThreadBase::mutex() if both must be locked // avoids acquiring AudioFlinger::mutex() from inside thread loop. mutable audio_utils::mutex mClientMutex; mutable audio_utils::mutex mClientMutex{audio_utils::MutexOrder::kAudioFlinger_ClientMutex}; DefaultKeyedVector<pid_t, wp<Client>> mClients GUARDED_BY(clientMutex()); // see ~Client() audio_utils::mutex& hardwareMutex() const { return mHardwareMutex; } mutable audio_utils::mutex mHardwareMutex; mutable audio_utils::mutex mHardwareMutex{ audio_utils::MutexOrder::kAudioFlinger_HardwareMutex}; // NOTE: If both mMutex and mHardwareMutex mutexes must be held, // always take mMutex before mHardwareMutex Loading
services/audioflinger/DeviceEffectManager.h +1 −1 Original line number Diff line number Diff line Loading @@ -85,7 +85,7 @@ private: audio_utils::mutex& mutex() const RETURN_CAPABILITY(audio_utils::DeviceEffectManager_Mutex) { return mMutex; } mutable audio_utils::mutex mMutex; mutable audio_utils::mutex mMutex{audio_utils::MutexOrder::kDeviceEffectManager_Mutex}; const sp<IAfDeviceEffectManagerCallback> mAfDeviceEffectManagerCallback; const sp<DeviceEffectManagerCallback> mMyCallback; std::map<AudioDeviceTypeAddr, std::vector<sp<IAfDeviceEffectProxy>>> Loading
services/audioflinger/Effects.h +8 −5 Original line number Diff line number Diff line Loading @@ -135,7 +135,7 @@ protected: DISALLOW_COPY_AND_ASSIGN(EffectBase); // mutex for process, commands and handles list protection mutable audio_utils::mutex mMutex; mutable audio_utils::mutex mMutex{audio_utils::MutexOrder::kEffectBase_Mutex}; mediautils::atomic_sp<EffectCallbackInterface> mCallback; // parent effect chain const int mId; // this instance unique ID const audio_session_t mSessionId; // audio session ID Loading @@ -151,7 +151,7 @@ protected: // Mutex protecting transactions with audio policy manager as mutex() cannot // be held to avoid cross deadlocks with audio policy mutex audio_utils::mutex& policyMutex() const { return mPolicyMutex; } mutable audio_utils::mutex mPolicyMutex; mutable audio_utils::mutex mPolicyMutex{audio_utils::MutexOrder::kEffectBase_PolicyMutex}; // Effect is registered in APM or not bool mPolicyRegistered = false; // Effect enabled state communicated to APM. Enabled state corresponds to Loading Loading @@ -367,7 +367,8 @@ private: DISALLOW_COPY_AND_ASSIGN(EffectHandle); audio_utils::mutex& mutex() const { return mMutex; } mutable audio_utils::mutex mMutex; // protects IEffect method calls // protects IEffect method calls mutable audio_utils::mutex mMutex{audio_utils::MutexOrder::kEffectHandle_Mutex}; const wp<IAfEffectBase> mEffect; // pointer to controlled EffectModule const sp<media::IEffectClient> mEffectClient; // callback interface for client notifications /*const*/ sp<Client> mClient; // client for shared memory allocation, see Loading Loading @@ -625,7 +626,8 @@ private: std::optional<size_t> findVolumeControl_l(size_t from, size_t to) const; mutable audio_utils::mutex mMutex; // mutex protecting effect list // mutex protecting effect list mutable audio_utils::mutex mMutex{audio_utils::MutexOrder::kEffectChain_Mutex}; Vector<sp<IAfEffectModule>> mEffects; // list of effect modules audio_session_t mSessionId; // audio session ID sp<EffectBufferHalInterface> mInBuffer; // chain input buffer Loading Loading @@ -764,7 +766,8 @@ private: const sp<ProxyCallback> mMyCallback; audio_utils::mutex& proxyMutex() const { return mProxyMutex; } mutable audio_utils::mutex mProxyMutex; mutable audio_utils::mutex mProxyMutex{ audio_utils::MutexOrder::kDeviceEffectProxy_ProxyMutex}; std::map<audio_patch_handle_t, sp<IAfEffectHandle>> mEffectHandles; // protected by mProxyMutex sp<IAfEffectModule> mHalEffect; // protected by mProxyMutex struct audio_port_config mDevicePort = { .id = AUDIO_PORT_HANDLE_NONE }; Loading
services/audioflinger/MelReporter.h +1 −1 Original line number Diff line number Diff line Loading @@ -138,7 +138,7 @@ private: * Lock for protecting the active mel patches. Do not mix with the AudioFlinger lock. * Locking order AudioFlinger::mutex() -> PatchCommandThread::mutex() -> MelReporter::mutex(). */ mutable audio_utils::mutex mMutex; mutable audio_utils::mutex mMutex{audio_utils::MutexOrder::kMelReporter_Mutex}; std::unordered_map<audio_patch_handle_t, ActiveMelPatch> mActiveMelPatches GUARDED_BY(mutex()); std::unordered_map<audio_port_handle_t, int> mActiveDevices GUARDED_BY(mutex()); Loading
services/audioflinger/PatchCommandThread.h +3 −2 Original line number Diff line number Diff line Loading @@ -130,11 +130,12 @@ private: return mListenerMutex; } mutable audio_utils::mutex mMutex; mutable audio_utils::mutex mMutex{audio_utils::MutexOrder::kPatchCommandThread_Mutex}; audio_utils::condition_variable mWaitWorkCV; std::deque<sp<Command>> mCommands GUARDED_BY(mutex()); // list of pending commands mutable audio_utils::mutex mListenerMutex; mutable audio_utils::mutex mListenerMutex{ audio_utils::MutexOrder::kPatchCommandThread_ListenerMutex}; std::vector<wp<PatchCommandListener>> mListeners GUARDED_BY(listenerMutex()); }; Loading