AudioFlinger: Create MelReporter callback
Test: atest AudioTrackTest AudioRecordTest
Test: Camera YouTube
Bug: 291319167
Change-Id: Icd73c1e4d47f6a8eac85001771fc356d161b4f08
diff --git a/services/audioflinger/AudioFlinger.h b/services/audioflinger/AudioFlinger.h
index d64c92e..ce9597a 100644
--- a/services/audioflinger/AudioFlinger.h
+++ b/services/audioflinger/AudioFlinger.h
@@ -166,10 +166,10 @@
: public AudioFlingerServerAdapter::Delegate // IAudioFlinger client interface
, public IAfClientCallback
, public IAfDeviceEffectManagerCallback
+ , public IAfMelReporterCallback
{
friend class sp<AudioFlinger>;
// TODO(b/291319167) Create interface and remove friends.
- friend class MelReporter;
friend class PatchPanel;
// TODO(b/291012167) replace the Thread friends with an interface.
friend class DirectOutputThread;
@@ -375,6 +375,7 @@
// ---- begin IAfDeviceEffectManagerCallback interface
bool isAudioPolicyReady() const final { return mAudioPolicyReady.load(); }
+ // below also used by IAfMelReporterCallback
const sp<PatchCommandThread>& getPatchCommandThread() final { return mPatchCommandThread; }
status_t addEffectToHal(
const struct audio_port_config* device, const sp<EffectHalInterface>& effect) final;
@@ -383,6 +384,13 @@
// ---- end of IAfDeviceEffectManagerCallback interface
+ // ---- begin IAfMelReporterCallback interface
+
+ Mutex& mutex() const final { return mLock; }
+ sp<IAfThreadBase> checkOutputThread_l(audio_io_handle_t ioHandle) const final REQUIRES(mLock);
+
+ // ---- end of IAfMelReporterCallback interface
+
/* List available audio ports and their attributes */
status_t listAudioPorts(unsigned int* num_ports, struct audio_port* ports) const;
@@ -620,7 +628,6 @@
}
IAfThreadBase* checkThread_l(audio_io_handle_t ioHandle) const;
- sp<IAfThreadBase> checkOutputThread_l(audio_io_handle_t ioHandle) const REQUIRES(mLock);
IAfPlaybackThread* checkPlaybackThread_l(audio_io_handle_t output) const;
IAfPlaybackThread* checkMixerThread_l(audio_io_handle_t output) const;
IAfRecordThread* checkRecordThread_l(audio_io_handle_t input) const;
@@ -881,7 +888,7 @@
const sp<PatchCommandThread> mPatchCommandThread;
/* const */ sp<DeviceEffectManager> mDeviceEffectManager; // set onFirstRef
- sp<MelReporter> mMelReporter;
+ /* const */ sp<MelReporter> mMelReporter; // set onFirstRef
bool mSystemReady;
std::atomic_bool mAudioPolicyReady{};