AudioFlinger: Create Client callback
Test: atest AudioTrackTest AudioRecordTest
Test: Camera YouTube
Bug: 291319167
Merged-In: I09328a818726b2dcf6c68247643eae4ec4cb48b8
Change-Id: I09328a818726b2dcf6c68247643eae4ec4cb48b8
diff --git a/services/audioflinger/AudioFlinger.cpp b/services/audioflinger/AudioFlinger.cpp
index 3f37a2c..ae16fa9 100644
--- a/services/audioflinger/AudioFlinger.cpp
+++ b/services/audioflinger/AudioFlinger.cpp
@@ -1035,7 +1035,7 @@
// (for which promote() is always != 0), otherwise create a new entry and Client.
sp<Client> client = mClients.valueFor(pid).promote();
if (client == 0) {
- client = new Client(this, pid);
+ client = sp<Client>::make(sp<IAfClientCallback>::fromExisting(this), pid);
mClients.add(pid, client);
}
@@ -2310,16 +2310,16 @@
// ----------------------------------------------------------------------------
-Client::Client(const sp<AudioFlinger>& audioFlinger, pid_t pid)
+Client::Client(const sp<IAfClientCallback>& afClientCallback, pid_t pid)
: RefBase(),
- mAudioFlinger(audioFlinger),
+ mAfClientCallback(afClientCallback),
mPid(pid),
mClientAllocator(AllocatorFactory::getClientAllocator()) {}
// Client destructor must be called with AudioFlinger::mClientLock held
Client::~Client()
{
- mAudioFlinger->removeClient_l(mPid);
+ mAfClientCallback->removeClient_l(mPid);
}
AllocatorFactory::ClientAllocator& Client::allocator()