AudioFlinger: Create MelReporter callback
Test: atest AudioTrackTest AudioRecordTest
Test: Camera YouTube
Bug: 291319167
Change-Id: Icd73c1e4d47f6a8eac85001771fc356d161b4f08
diff --git a/services/audioflinger/MelReporter.h b/services/audioflinger/MelReporter.h
index f191c9c..0dbb5f8 100644
--- a/services/audioflinger/MelReporter.h
+++ b/services/audioflinger/MelReporter.h
@@ -25,14 +25,21 @@
constexpr static int kMaxTimestampDeltaInSec = 120;
+class IAfMelReporterCallback : public virtual RefBase {
+public:
+ virtual Mutex& mutex() const = 0;
+ virtual const sp<PatchCommandThread>& getPatchCommandThread() = 0;
+ virtual sp<IAfThreadBase> checkOutputThread_l(audio_io_handle_t ioHandle) const = 0;
+};
+
/**
* Class for listening to new patches and starting the MEL computation. MelReporter is
* concealed within AudioFlinger, their lifetimes are the same.
*/
class MelReporter : public PatchCommandThread::PatchCommandListener {
public:
- explicit MelReporter(AudioFlinger& audioFlinger)
- : mAudioFlinger(audioFlinger),
+ explicit MelReporter(const sp<IAfMelReporterCallback>& afMelReporterCallback)
+ : mAfMelReporterCallback(afMelReporterCallback),
mSoundDoseManager(sp<SoundDoseManager>::make()) {}
void onFirstRef() override;
@@ -103,7 +110,7 @@
bool useHalSoundDoseInterface_l() REQUIRES(mLock);
- AudioFlinger& mAudioFlinger; // does not own the object
+ const sp<IAfMelReporterCallback> mAfMelReporterCallback;
sp<SoundDoseManager> mSoundDoseManager;