Loading services/audioflinger/AudioFlinger.cpp +4 −4 Original line number Diff line number Diff line Loading @@ -1029,7 +1029,7 @@ NO_THREAD_SAFETY_ANALYSIS // conditional try lock return NO_ERROR; } sp<AudioFlinger::Client> AudioFlinger::registerPid(pid_t pid) sp<Client> AudioFlinger::registerPid(pid_t pid) { Mutex::Autolock _cl(mClientLock); // If pid is already in the mClients wp<> map, then use that entry Loading Loading @@ -2311,19 +2311,19 @@ sp<AudioFlinger::ThreadBase> AudioFlinger::getEffectThread_l(audio_session_t ses // ---------------------------------------------------------------------------- AudioFlinger::Client::Client(const sp<AudioFlinger>& audioFlinger, pid_t pid) Client::Client(const sp<AudioFlinger>& audioFlinger, pid_t pid) : RefBase(), mAudioFlinger(audioFlinger), mPid(pid), mClientAllocator(AllocatorFactory::getClientAllocator()) {} // Client destructor must be called with AudioFlinger::mClientLock held AudioFlinger::Client::~Client() Client::~Client() { mAudioFlinger->removeClient_l(mPid); } AllocatorFactory::ClientAllocator& AudioFlinger::Client::allocator() AllocatorFactory::ClientAllocator& Client::allocator() { return mClientAllocator; } Loading services/audioflinger/AudioFlinger.h +3 −20 Original line number Diff line number Diff line Loading @@ -117,6 +117,8 @@ #include "android/media/BnAudioRecord.h" #include "android/media/BnEffect.h" #include "Client.h" // include AudioFlinger component interfaces #include "IAfEffect.h" Loading Loading @@ -146,6 +148,7 @@ using android::content::AttributionSourceState; class AudioFlinger : public AudioFlingerServerAdapter::Delegate { friend class sp<AudioFlinger>; friend class Client; // removeClient_l(); public: static void instantiate() ANDROID_API; Loading Loading @@ -497,26 +500,6 @@ public: private: void dumpToThreadLog_l(const sp<ThreadBase> &thread); public: // TODO(b/288339104) Move to separate file // --- Client --- class Client : public RefBase { public: Client(const sp<AudioFlinger>& audioFlinger, pid_t pid); virtual ~Client(); AllocatorFactory::ClientAllocator& allocator(); pid_t pid() const { return mPid; } sp<AudioFlinger> audioFlinger() const { return mAudioFlinger; } private: DISALLOW_COPY_AND_ASSIGN(Client); const sp<AudioFlinger> mAudioFlinger; const pid_t mPid; AllocatorFactory::ClientAllocator mClientAllocator; }; private: // --- Notification Client --- class NotificationClient : public IBinder::DeathRecipient { public: Loading services/audioflinger/Client.h 0 → 100644 +43 −0 Original line number Diff line number Diff line /* * Copyright (C) 2023 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #pragma once // TODO(b/288339104) Move to nested namespace namespace android { class AudioFlinger; class Client : public RefBase { public: Client(const sp<AudioFlinger>& audioFlinger, pid_t pid); // TODO(b/289139675) make Client container. // Client destructor must be called with AudioFlinger::mClientLock held ~Client() override; AllocatorFactory::ClientAllocator& allocator(); pid_t pid() const { return mPid; } sp<AudioFlinger> audioFlinger() const { return mAudioFlinger; } private: DISALLOW_COPY_AND_ASSIGN(Client); const sp<AudioFlinger> mAudioFlinger; const pid_t mPid; AllocatorFactory::ClientAllocator mClientAllocator; }; } // namespace android services/audioflinger/DeviceEffectManager.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -59,7 +59,7 @@ void AudioFlinger::DeviceEffectManager::onReleaseAudioPatch(audio_patch_handle_t sp<IAfEffectHandle> AudioFlinger::DeviceEffectManager::createEffect_l( effect_descriptor_t *descriptor, const AudioDeviceTypeAddr& device, const sp<AudioFlinger::Client>& client, const sp<Client>& client, const sp<IEffectClient>& effectClient, const std::map<audio_patch_handle_t, PatchPanel::Patch>& patches, int *enabled, Loading services/audioflinger/DeviceEffectManager.h +1 −1 Original line number Diff line number Diff line Loading @@ -32,7 +32,7 @@ public: sp<IAfEffectHandle> createEffect_l(effect_descriptor_t *descriptor, const AudioDeviceTypeAddr& device, const sp<AudioFlinger::Client>& client, const sp<Client>& client, const sp<media::IEffectClient>& effectClient, const std::map<audio_patch_handle_t, PatchPanel::Patch>& patches, int *enabled, Loading Loading
services/audioflinger/AudioFlinger.cpp +4 −4 Original line number Diff line number Diff line Loading @@ -1029,7 +1029,7 @@ NO_THREAD_SAFETY_ANALYSIS // conditional try lock return NO_ERROR; } sp<AudioFlinger::Client> AudioFlinger::registerPid(pid_t pid) sp<Client> AudioFlinger::registerPid(pid_t pid) { Mutex::Autolock _cl(mClientLock); // If pid is already in the mClients wp<> map, then use that entry Loading Loading @@ -2311,19 +2311,19 @@ sp<AudioFlinger::ThreadBase> AudioFlinger::getEffectThread_l(audio_session_t ses // ---------------------------------------------------------------------------- AudioFlinger::Client::Client(const sp<AudioFlinger>& audioFlinger, pid_t pid) Client::Client(const sp<AudioFlinger>& audioFlinger, pid_t pid) : RefBase(), mAudioFlinger(audioFlinger), mPid(pid), mClientAllocator(AllocatorFactory::getClientAllocator()) {} // Client destructor must be called with AudioFlinger::mClientLock held AudioFlinger::Client::~Client() Client::~Client() { mAudioFlinger->removeClient_l(mPid); } AllocatorFactory::ClientAllocator& AudioFlinger::Client::allocator() AllocatorFactory::ClientAllocator& Client::allocator() { return mClientAllocator; } Loading
services/audioflinger/AudioFlinger.h +3 −20 Original line number Diff line number Diff line Loading @@ -117,6 +117,8 @@ #include "android/media/BnAudioRecord.h" #include "android/media/BnEffect.h" #include "Client.h" // include AudioFlinger component interfaces #include "IAfEffect.h" Loading Loading @@ -146,6 +148,7 @@ using android::content::AttributionSourceState; class AudioFlinger : public AudioFlingerServerAdapter::Delegate { friend class sp<AudioFlinger>; friend class Client; // removeClient_l(); public: static void instantiate() ANDROID_API; Loading Loading @@ -497,26 +500,6 @@ public: private: void dumpToThreadLog_l(const sp<ThreadBase> &thread); public: // TODO(b/288339104) Move to separate file // --- Client --- class Client : public RefBase { public: Client(const sp<AudioFlinger>& audioFlinger, pid_t pid); virtual ~Client(); AllocatorFactory::ClientAllocator& allocator(); pid_t pid() const { return mPid; } sp<AudioFlinger> audioFlinger() const { return mAudioFlinger; } private: DISALLOW_COPY_AND_ASSIGN(Client); const sp<AudioFlinger> mAudioFlinger; const pid_t mPid; AllocatorFactory::ClientAllocator mClientAllocator; }; private: // --- Notification Client --- class NotificationClient : public IBinder::DeathRecipient { public: Loading
services/audioflinger/Client.h 0 → 100644 +43 −0 Original line number Diff line number Diff line /* * Copyright (C) 2023 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #pragma once // TODO(b/288339104) Move to nested namespace namespace android { class AudioFlinger; class Client : public RefBase { public: Client(const sp<AudioFlinger>& audioFlinger, pid_t pid); // TODO(b/289139675) make Client container. // Client destructor must be called with AudioFlinger::mClientLock held ~Client() override; AllocatorFactory::ClientAllocator& allocator(); pid_t pid() const { return mPid; } sp<AudioFlinger> audioFlinger() const { return mAudioFlinger; } private: DISALLOW_COPY_AND_ASSIGN(Client); const sp<AudioFlinger> mAudioFlinger; const pid_t mPid; AllocatorFactory::ClientAllocator mClientAllocator; }; } // namespace android
services/audioflinger/DeviceEffectManager.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -59,7 +59,7 @@ void AudioFlinger::DeviceEffectManager::onReleaseAudioPatch(audio_patch_handle_t sp<IAfEffectHandle> AudioFlinger::DeviceEffectManager::createEffect_l( effect_descriptor_t *descriptor, const AudioDeviceTypeAddr& device, const sp<AudioFlinger::Client>& client, const sp<Client>& client, const sp<IEffectClient>& effectClient, const std::map<audio_patch_handle_t, PatchPanel::Patch>& patches, int *enabled, Loading
services/audioflinger/DeviceEffectManager.h +1 −1 Original line number Diff line number Diff line Loading @@ -32,7 +32,7 @@ public: sp<IAfEffectHandle> createEffect_l(effect_descriptor_t *descriptor, const AudioDeviceTypeAddr& device, const sp<AudioFlinger::Client>& client, const sp<Client>& client, const sp<media::IEffectClient>& effectClient, const std::map<audio_patch_handle_t, PatchPanel::Patch>& patches, int *enabled, Loading