CSD: notify when RS2 momentary exposure is reached
RS2 is defined in IEC 62368-1 3rd edition as 100dBA. Added however the
possibility to further restrict this value as part of the momentary
exposure API.
Test: UT and manual tests
Bug: 256616352
Change-Id: I004a620e5e7915824d390f7ddc41c16f9675d45a
diff --git a/services/audioflinger/MelReporter.cpp b/services/audioflinger/MelReporter.cpp
index 88500b8..6fc756b 100644
--- a/services/audioflinger/MelReporter.cpp
+++ b/services/audioflinger/MelReporter.cpp
@@ -65,9 +65,12 @@
std::lock_guard _lAf(mAudioFlinger.mLock);
auto thread = mAudioFlinger.checkPlaybackThread_l(streamHandle);
if (thread != nullptr) {
- thread->startMelComputation(mSoundDoseManager.getOrCreateCallbackForDevice(
+ thread->startMelComputation(mSoundDoseManager.getOrCreateProcessorForDevice(
deviceId,
- newPatch.streamHandle));
+ newPatch.streamHandle,
+ thread->mSampleRate,
+ thread->mChannelCount,
+ thread->mFormat));
}
}
}
@@ -97,11 +100,11 @@
// Stop MEL calculation for the PlaybackThread
std::lock_guard _lAf(mAudioFlinger.mLock);
+ mSoundDoseManager.removeStreamProcessor(melPatch.streamHandle);
auto thread = mAudioFlinger.checkPlaybackThread_l(melPatch.streamHandle);
if (thread != nullptr) {
thread->stopMelComputation();
}
- mSoundDoseManager.removeStreamCallback(melPatch.streamHandle);
}
std::string AudioFlinger::MelReporter::dump() {