Loading media/libaudioclient/AudioSystem.cpp +10 −7 Original line number Diff line number Diff line Loading @@ -95,7 +95,7 @@ sp<CaptureStateListenerImpl> AudioSystem::gSoundTriggerCaptureStateListener; // ServiceSingleton to provide interaction with the service notifications and // binder death notifications. // // If the AF/AP service is unavailable for kServiceWaitMs from ServiceManager, // If the AF/AP service is unavailable for kServiceClientWaitMs from ServiceManager, // ServiceSingleton will return a nullptr service handle resulting in the same dead object error // as if the service died (which it did, otherwise we'd be returning the cached handle). // Loading Loading @@ -129,9 +129,10 @@ sp<CaptureStateListenerImpl> AudioSystem::gSoundTriggerCaptureStateListener; // // TODO(b/375691003) We use 10s as a conservative timeout value, and will tune closer to 3s. // Too small a value (i.e. less than 1s would churn repeated calls to get the service). static constexpr int32_t kServiceWaitMs = 10'000; // The value can be tuned by the property audio.service.client_wait_ms. static constexpr int32_t kServiceClientWaitMs = 10'000; static constexpr const char kServiceWaitProperty[] = "audio.service.wait_ms"; static constexpr const char kServiceWaitProperty[] = "audio.service.client_wait_ms"; // AudioFlingerServiceTraits is a collection of methods that parameterize the // ServiceSingleton handler for IAudioFlinger Loading Loading @@ -172,7 +173,7 @@ public: } mediautils::initService<media::IAudioFlingerService, AudioFlingerServiceTraits>(); mWaitMs = std::chrono::milliseconds( property_get_int32(kServiceWaitProperty, kServiceWaitMs)); property_get_int32(kServiceWaitProperty, kServiceClientWaitMs)); init = true; } if (mValid) return mService; Loading Loading @@ -272,7 +273,8 @@ private: static inline constinit std::mutex mMutex; static inline constinit sp<AudioSystem::AudioFlingerClient> mClient GUARDED_BY(mMutex); static inline constinit sp<IAudioFlinger> mService GUARDED_BY(mMutex); static inline constinit std::chrono::milliseconds mWaitMs GUARDED_BY(mMutex) {kServiceWaitMs}; static inline constinit std::chrono::milliseconds mWaitMs GUARDED_BY(mMutex) {kServiceClientWaitMs}; static inline constinit bool mValid GUARDED_BY(mMutex) = false; static inline constinit std::atomic_bool mDisableThreadPoolStart = false; }; Loading Loading @@ -1014,7 +1016,7 @@ public: } mediautils::initService<IAudioPolicyService, AudioPolicyServiceTraits>(); mWaitMs = std::chrono::milliseconds( property_get_int32(kServiceWaitProperty, kServiceWaitMs)); property_get_int32(kServiceWaitProperty, kServiceClientWaitMs)); init = true; } if (mValid) return mService; Loading Loading @@ -1071,7 +1073,8 @@ private: static inline constinit sp<AudioSystem::AudioPolicyServiceClient> mClient GUARDED_BY(mMutex); static inline constinit sp<IAudioPolicyService> mService GUARDED_BY(mMutex); static inline constinit bool mValid GUARDED_BY(mMutex) = false; static inline constinit std::chrono::milliseconds mWaitMs GUARDED_BY(mMutex) {kServiceWaitMs}; static inline constinit std::chrono::milliseconds mWaitMs GUARDED_BY(mMutex) {kServiceClientWaitMs}; static inline constinit std::atomic_bool mDisableThreadPoolStart = false; }; Loading Loading
media/libaudioclient/AudioSystem.cpp +10 −7 Original line number Diff line number Diff line Loading @@ -95,7 +95,7 @@ sp<CaptureStateListenerImpl> AudioSystem::gSoundTriggerCaptureStateListener; // ServiceSingleton to provide interaction with the service notifications and // binder death notifications. // // If the AF/AP service is unavailable for kServiceWaitMs from ServiceManager, // If the AF/AP service is unavailable for kServiceClientWaitMs from ServiceManager, // ServiceSingleton will return a nullptr service handle resulting in the same dead object error // as if the service died (which it did, otherwise we'd be returning the cached handle). // Loading Loading @@ -129,9 +129,10 @@ sp<CaptureStateListenerImpl> AudioSystem::gSoundTriggerCaptureStateListener; // // TODO(b/375691003) We use 10s as a conservative timeout value, and will tune closer to 3s. // Too small a value (i.e. less than 1s would churn repeated calls to get the service). static constexpr int32_t kServiceWaitMs = 10'000; // The value can be tuned by the property audio.service.client_wait_ms. static constexpr int32_t kServiceClientWaitMs = 10'000; static constexpr const char kServiceWaitProperty[] = "audio.service.wait_ms"; static constexpr const char kServiceWaitProperty[] = "audio.service.client_wait_ms"; // AudioFlingerServiceTraits is a collection of methods that parameterize the // ServiceSingleton handler for IAudioFlinger Loading Loading @@ -172,7 +173,7 @@ public: } mediautils::initService<media::IAudioFlingerService, AudioFlingerServiceTraits>(); mWaitMs = std::chrono::milliseconds( property_get_int32(kServiceWaitProperty, kServiceWaitMs)); property_get_int32(kServiceWaitProperty, kServiceClientWaitMs)); init = true; } if (mValid) return mService; Loading Loading @@ -272,7 +273,8 @@ private: static inline constinit std::mutex mMutex; static inline constinit sp<AudioSystem::AudioFlingerClient> mClient GUARDED_BY(mMutex); static inline constinit sp<IAudioFlinger> mService GUARDED_BY(mMutex); static inline constinit std::chrono::milliseconds mWaitMs GUARDED_BY(mMutex) {kServiceWaitMs}; static inline constinit std::chrono::milliseconds mWaitMs GUARDED_BY(mMutex) {kServiceClientWaitMs}; static inline constinit bool mValid GUARDED_BY(mMutex) = false; static inline constinit std::atomic_bool mDisableThreadPoolStart = false; }; Loading Loading @@ -1014,7 +1016,7 @@ public: } mediautils::initService<IAudioPolicyService, AudioPolicyServiceTraits>(); mWaitMs = std::chrono::milliseconds( property_get_int32(kServiceWaitProperty, kServiceWaitMs)); property_get_int32(kServiceWaitProperty, kServiceClientWaitMs)); init = true; } if (mValid) return mService; Loading Loading @@ -1071,7 +1073,8 @@ private: static inline constinit sp<AudioSystem::AudioPolicyServiceClient> mClient GUARDED_BY(mMutex); static inline constinit sp<IAudioPolicyService> mService GUARDED_BY(mMutex); static inline constinit bool mValid GUARDED_BY(mMutex) = false; static inline constinit std::chrono::milliseconds mWaitMs GUARDED_BY(mMutex) {kServiceWaitMs}; static inline constinit std::chrono::milliseconds mWaitMs GUARDED_BY(mMutex) {kServiceClientWaitMs}; static inline constinit std::atomic_bool mDisableThreadPoolStart = false; }; Loading