AudioFlinger: Create Thread callback
Test: atest AudioTrackTest AudioRecordTest
Test: Camera YouTube
Bug: 291012167
Bug: 291319167
Change-Id: I82024cc2bebe56282224efb4ffda1f5dcc513702
diff --git a/services/audioflinger/Tracks.cpp b/services/audioflinger/Tracks.cpp
index 979779d..257f9e4 100644
--- a/services/audioflinger/Tracks.cpp
+++ b/services/audioflinger/Tracks.cpp
@@ -1164,10 +1164,10 @@
const sp<IAfThreadBase> thread = mThread.promote();
if (thread != 0) {
if (isOffloaded()) {
- Mutex::Autolock _laf(thread->audioFlinger()->mLock);
+ Mutex::Autolock _laf(thread->afThreadCallback()->mutex());
Mutex::Autolock _lth(thread->mutex());
sp<IAfEffectChain> ec = thread->getEffectChain_l(mSessionId);
- if (thread->audioFlinger()->isNonOffloadableGlobalEffectEnabled_l() ||
+ if (thread->afThreadCallback()->isNonOffloadableGlobalEffectEnabled_l() ||
(ec != 0 && ec->isNonOffloadableEnabled())) {
invalidate();
return PERMISSION_DENIED;
@@ -1273,7 +1273,8 @@
}
if (status == NO_ERROR) {
// send format to AudioManager for playback activity monitoring
- const sp<IAudioManager> audioManager = thread->audioFlinger()->getOrCreateAudioManager();
+ const sp<IAudioManager> audioManager =
+ thread->afThreadCallback()->getOrCreateAudioManager();
if (audioManager && mPortId != AUDIO_PORT_HANDLE_NONE) {
std::unique_ptr<os::PersistableBundle> bundle =
std::make_unique<os::PersistableBundle>();