Loading services/audioflinger/MelReporter.cpp +4 −13 Original line number Diff line number Diff line Loading @@ -147,10 +147,6 @@ void AudioFlinger::MelReporter::onCreateAudioPatch(audio_patch_handle_t handle, ALOGV("%s csd is disabled", __func__); return; } if (useHalSoundDoseInterface()) { ALOGV("%s using HAL sound dose, ignore new patch", __func__); return; } ALOGV("%s: handle %d mHalHandle %d device sink %08x", __func__, handle, patch.mHalHandle, Loading Loading @@ -199,7 +195,7 @@ NO_THREAD_SAFETY_ANALYSIS // access of AudioFlinger::checkOutputThread_l ALOGI("%s add stream %d that uses device %d for CSD, nr of streams: %d", __func__, patch.streamHandle, deviceHandle, mActiveDevices[deviceHandle]); if (outputThread != nullptr) { if (outputThread != nullptr && !useHalSoundDoseInterface_l()) { outputThread->startMelComputation_l(mSoundDoseManager->getOrCreateProcessorForDevice( deviceHandle, patch.streamHandle, Loading Loading @@ -271,7 +267,7 @@ NO_THREAD_SAFETY_ANALYSIS // access of AudioFlinger::checkOutputThread_l } } if (outputThread != nullptr) { if (outputThread != nullptr && !useHalSoundDoseInterface_l()) { outputThread->stopMelComputation_l(); } } Loading @@ -287,13 +283,8 @@ std::optional<audio_patch_handle_t> AudioFlinger::MelReporter::activePatchStream return std::nullopt; } bool AudioFlinger::MelReporter::useHalSoundDoseInterface() { bool useHalSoundDoseInterface = !mSoundDoseManager->forceUseFrameworkMel(); { std::lock_guard _l(mLock); useHalSoundDoseInterface &= mUseHalSoundDoseInterface; } return useHalSoundDoseInterface; bool AudioFlinger::MelReporter::useHalSoundDoseInterface_l() { return !mSoundDoseManager->forceUseFrameworkMel() & mUseHalSoundDoseInterface; } std::string AudioFlinger::MelReporter::dump() { Loading services/audioflinger/MelReporter.h +1 −1 Original line number Diff line number Diff line Loading @@ -98,7 +98,7 @@ private: std::optional<audio_patch_handle_t> activePatchStreamHandle_l(audio_io_handle_t streamHandle) REQUIRES(mLock); bool useHalSoundDoseInterface(); bool useHalSoundDoseInterface_l() REQUIRES(mLock); AudioFlinger& mAudioFlinger; // does not own the object Loading services/audioflinger/sounddose/SoundDoseManager.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -216,7 +216,7 @@ ndk::ScopedAStatus SoundDoseManager::HalSoundDoseCallback::onMomentaryExposureWa if (id == AUDIO_PORT_HANDLE_NONE) { ALOGI("%s: no mapped id for audio device with type %d and address %s", __func__, in_audioDevice.type.type, in_audioDevice.address.get<AudioDeviceAddress::id>().c_str()); in_audioDevice.address.toString().c_str()); return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT); } soundDoseManager->onMomentaryExposure(in_currentDbA, id); Loading @@ -243,7 +243,7 @@ ndk::ScopedAStatus SoundDoseManager::HalSoundDoseCallback::onNewMelValues( if (id == AUDIO_PORT_HANDLE_NONE) { ALOGI("%s: no mapped id for audio device with type %d and address %s", __func__, in_audioDevice.type.type, in_audioDevice.address.get<AudioDeviceAddress::id>().c_str()); in_audioDevice.address.toString().c_str()); return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT); } // TODO: introduce timestamp in onNewMelValues callback Loading Loading
services/audioflinger/MelReporter.cpp +4 −13 Original line number Diff line number Diff line Loading @@ -147,10 +147,6 @@ void AudioFlinger::MelReporter::onCreateAudioPatch(audio_patch_handle_t handle, ALOGV("%s csd is disabled", __func__); return; } if (useHalSoundDoseInterface()) { ALOGV("%s using HAL sound dose, ignore new patch", __func__); return; } ALOGV("%s: handle %d mHalHandle %d device sink %08x", __func__, handle, patch.mHalHandle, Loading Loading @@ -199,7 +195,7 @@ NO_THREAD_SAFETY_ANALYSIS // access of AudioFlinger::checkOutputThread_l ALOGI("%s add stream %d that uses device %d for CSD, nr of streams: %d", __func__, patch.streamHandle, deviceHandle, mActiveDevices[deviceHandle]); if (outputThread != nullptr) { if (outputThread != nullptr && !useHalSoundDoseInterface_l()) { outputThread->startMelComputation_l(mSoundDoseManager->getOrCreateProcessorForDevice( deviceHandle, patch.streamHandle, Loading Loading @@ -271,7 +267,7 @@ NO_THREAD_SAFETY_ANALYSIS // access of AudioFlinger::checkOutputThread_l } } if (outputThread != nullptr) { if (outputThread != nullptr && !useHalSoundDoseInterface_l()) { outputThread->stopMelComputation_l(); } } Loading @@ -287,13 +283,8 @@ std::optional<audio_patch_handle_t> AudioFlinger::MelReporter::activePatchStream return std::nullopt; } bool AudioFlinger::MelReporter::useHalSoundDoseInterface() { bool useHalSoundDoseInterface = !mSoundDoseManager->forceUseFrameworkMel(); { std::lock_guard _l(mLock); useHalSoundDoseInterface &= mUseHalSoundDoseInterface; } return useHalSoundDoseInterface; bool AudioFlinger::MelReporter::useHalSoundDoseInterface_l() { return !mSoundDoseManager->forceUseFrameworkMel() & mUseHalSoundDoseInterface; } std::string AudioFlinger::MelReporter::dump() { Loading
services/audioflinger/MelReporter.h +1 −1 Original line number Diff line number Diff line Loading @@ -98,7 +98,7 @@ private: std::optional<audio_patch_handle_t> activePatchStreamHandle_l(audio_io_handle_t streamHandle) REQUIRES(mLock); bool useHalSoundDoseInterface(); bool useHalSoundDoseInterface_l() REQUIRES(mLock); AudioFlinger& mAudioFlinger; // does not own the object Loading
services/audioflinger/sounddose/SoundDoseManager.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -216,7 +216,7 @@ ndk::ScopedAStatus SoundDoseManager::HalSoundDoseCallback::onMomentaryExposureWa if (id == AUDIO_PORT_HANDLE_NONE) { ALOGI("%s: no mapped id for audio device with type %d and address %s", __func__, in_audioDevice.type.type, in_audioDevice.address.get<AudioDeviceAddress::id>().c_str()); in_audioDevice.address.toString().c_str()); return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT); } soundDoseManager->onMomentaryExposure(in_currentDbA, id); Loading @@ -243,7 +243,7 @@ ndk::ScopedAStatus SoundDoseManager::HalSoundDoseCallback::onNewMelValues( if (id == AUDIO_PORT_HANDLE_NONE) { ALOGI("%s: no mapped id for audio device with type %d and address %s", __func__, in_audioDevice.type.type, in_audioDevice.address.get<AudioDeviceAddress::id>().c_str()); in_audioDevice.address.toString().c_str()); return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT); } // TODO: introduce timestamp in onNewMelValues callback Loading