Loading audio/aidl/default/EffectConfig.cpp +7 −9 Original line number Diff line number Diff line Loading @@ -37,7 +37,6 @@ namespace aidl::android::hardware::audio::effect { EffectConfig::EffectConfig(const std::string& file) { tinyxml2::XMLDocument doc; doc.LoadFile(file.c_str()); LOG(DEBUG) << __func__ << " loading " << file; // parse the xml file into maps if (doc.Error()) { LOG(ERROR) << __func__ << " tinyxml2 failed to load " << file Loading Loading @@ -143,7 +142,7 @@ bool EffectConfig::parseEffect(const tinyxml2::XMLElement& xml) { std::string name = xml.Attribute("name"); RETURN_VALUE_IF(name == "", false, "effectsNoName"); LOG(DEBUG) << __func__ << dump(xml); LOG(VERBOSE) << __func__ << dump(xml); struct Library library; if (std::strcmp(xml.Name(), "effectProxy") == 0) { // proxy lib and uuid Loading Loading @@ -187,7 +186,7 @@ bool EffectConfig::parseLibrary(const tinyxml2::XMLElement& xml, struct Library& } RETURN_VALUE_IF((library.uuid == getEffectUuidZero()), false, "invalidUuidAttribute"); LOG(DEBUG) << __func__ << (isProxy ? " proxy " : library.name) << " : uuid " LOG(VERBOSE) << __func__ << (isProxy ? " proxy " : library.name) << " : uuid " << ::android::audio::utils::toString(library.uuid) << (library.type.has_value() ? ::android::audio::utils::toString(library.type.value()) Loading Loading @@ -245,7 +244,7 @@ std::optional<Processing::Type> EffectConfig::stringToProcessingType(Processing: } bool EffectConfig::parseProcessing(Processing::Type::Tag typeTag, const tinyxml2::XMLElement& xml) { LOG(DEBUG) << __func__ << dump(xml); LOG(VERBOSE) << __func__ << dump(xml); const char* typeStr = xml.Attribute("type"); auto aidlType = stringToProcessingType(typeTag, typeStr); RETURN_VALUE_IF(!aidlType.has_value(), false, "illegalStreamType"); Loading @@ -259,7 +258,6 @@ bool EffectConfig::parseProcessing(Processing::Type::Tag typeTag, const tinyxml2 } RETURN_VALUE_IF(!name, false, "noEffectAttribute"); mProcessingMap[aidlType.value()].emplace_back(mEffectsMap[name]); LOG(WARNING) << __func__ << " " << typeStr << " : " << name; } return true; } Loading audio/aidl/default/EffectContext.cpp +1 −3 Original line number Diff line number Diff line Loading @@ -157,7 +157,6 @@ Parameter::VolumeStereo EffectContext::getVolumeStereo() { } RetCode EffectContext::setCommon(const Parameter::Common& common) { LOG(VERBOSE) << __func__ << common.toString(); auto& input = common.input; auto& output = common.output; Loading Loading @@ -186,7 +185,6 @@ RetCode EffectContext::setCommon(const Parameter::Common& common) { } Parameter::Common EffectContext::getCommon() { LOG(VERBOSE) << __func__ << mCommon.toString(); return mCommon; } Loading Loading @@ -241,7 +239,7 @@ RetCode EffectContext::notifyDataMqUpdate() { LOG(ERROR) << __func__ << ": wake failure with ret " << ret; return RetCode::ERROR_EVENT_FLAG_ERROR; } LOG(DEBUG) << __func__ << " : signal client for reopen"; LOG(VERBOSE) << __func__ << " : signal client for reopen"; return RetCode::SUCCESS; } } // namespace aidl::android::hardware::audio::effect audio/aidl/default/EffectFactory.cpp +15 −16 Original line number Diff line number Diff line Loading @@ -43,11 +43,11 @@ Factory::Factory(const std::string& file) : mConfig(EffectConfig(file)) { Factory::~Factory() { if (auto count = mEffectMap.size()) { LOG(ERROR) << __func__ << " remaining " << count LOG(WARNING) << __func__ << " remaining " << count << " effect instances not destroyed indicating resource leak!"; for (const auto& it : mEffectMap) { if (auto spEffect = it.first.lock()) { LOG(ERROR) << __func__ << " erase remaining instance UUID " LOG(WARNING) << __func__ << " erase remaining instance UUID " << ::android::audio::utils::toString(it.second.first); destroyEffectImpl_l(spEffect); } Loading Loading @@ -139,7 +139,7 @@ ndk::ScopedAStatus Factory::createEffect(const AudioUuid& in_impl_uuid, std::shared_ptr<IEffect> effectSp; RETURN_IF_BINDER_EXCEPTION(libInterface->createEffectFunc(&in_impl_uuid, &effectSp)); if (!effectSp) { LOG(ERROR) << __func__ << ": library created null instance without return error!"; LOG(WARNING) << __func__ << ": library created null instance without return error!"; return ndk::ScopedAStatus::fromExceptionCode(EX_TRANSACTION_FAILED); } *_aidl_return = effectSp; Loading @@ -147,7 +147,6 @@ ndk::ScopedAStatus Factory::createEffect(const AudioUuid& in_impl_uuid, AIBinder_setMinSchedulerPolicy(effectBinder.get(), SCHED_NORMAL, ANDROID_PRIORITY_AUDIO); mEffectMap[std::weak_ptr<IEffect>(effectSp)] = std::make_pair(in_impl_uuid, std::move(effectBinder)); LOG(DEBUG) << __func__ << ": instance " << effectSp.get() << " created successfully"; return ndk::ScopedAStatus::ok(); } else { LOG(ERROR) << __func__ << ": library doesn't exist"; Loading Loading @@ -192,7 +191,6 @@ void Factory::cleanupEffectMap_l() { } ndk::ScopedAStatus Factory::destroyEffect(const std::shared_ptr<IEffect>& in_handle) { LOG(DEBUG) << __func__ << ": instance " << in_handle.get(); std::lock_guard lg(mMutex); ndk::ScopedAStatus status = destroyEffectImpl_l(in_handle); // always do the cleanup Loading @@ -215,7 +213,7 @@ bool Factory::openEffectLibrary(const AudioUuid& impl, return false; } LOG(INFO) << __func__ << " dlopen lib:" << path LOG(DEBUG) << __func__ << " dlopen lib: " << path << "\nimpl:" << ::android::audio::utils::toString(impl) << "\nhandle:" << libHandle; auto interface = new effect_dl_interface_s{nullptr, nullptr, nullptr}; mEffectLibMap.insert( Loading @@ -235,10 +233,11 @@ void Factory::createIdentityWithConfig( id.type = typeUuid; id.uuid = configLib.uuid; id.proxy = proxyUuid; LOG(DEBUG) << __func__ << " loading lib " << path->second << ": typeUuid " LOG(WARNING) << __func__ << " loading lib " << path->second << ": typeUuid " << ::android::audio::utils::toString(id.type) << "\nimplUuid " << ::android::audio::utils::toString(id.uuid) << " proxyUuid " << (proxyUuid.has_value() ? ::android::audio::utils::toString(proxyUuid.value()) << (proxyUuid.has_value() ? ::android::audio::utils::toString(proxyUuid.value()) : "null"); if (openEffectLibrary(id.uuid, path->second)) { mIdentitySet.insert(std::move(id)); Loading @@ -263,8 +262,8 @@ void Factory::loadEffectLibs() { createIdentityWithConfig(configLib, type, proxyUuid); } } else { LOG(ERROR) << __func__ << ": can not find type UUID for effect " << configEffects.first << " skipping!"; LOG(WARNING) << __func__ << ": can not find type UUID for effect " << configEffects.first << " skipping!"; } } } Loading audio/aidl/default/EffectImpl.cpp +6 −11 Original line number Diff line number Diff line Loading @@ -35,7 +35,6 @@ extern "C" binder_exception_t destroyEffect(const std::shared_ptr<IEffect>& inst << " in state: " << toString(state) << ", status: " << status.getDescription(); return EX_ILLEGAL_STATE; } LOG(DEBUG) << __func__ << " instance " << instanceSp.get() << " destroyed"; return EX_NONE; } Loading Loading @@ -91,7 +90,7 @@ ndk::ScopedAStatus EffectImpl::close() { } RETURN_IF(notifyEventFlag(kEventFlagNotEmpty) != RetCode::SUCCESS, EX_ILLEGAL_STATE, "notifyEventFlagFailed"); "notifyEventFlagNotEmptyFailed"); // stop the worker thread, ignore the return code RETURN_IF(destroyThread() != RetCode::SUCCESS, EX_UNSUPPORTED_OPERATION, "FailedToDestroyWorker"); Loading Loading @@ -231,8 +230,6 @@ ndk::ScopedAStatus EffectImpl::getState(State* state) NO_THREAD_SAFETY_ANALYSIS ndk::ScopedAStatus EffectImpl::command(CommandId command) { std::lock_guard lg(mImplMutex); RETURN_IF(mState == State::INIT, EX_ILLEGAL_STATE, "instanceNotOpen"); LOG(DEBUG) << getEffectName() << __func__ << ": receive command: " << toString(command) << " at state " << toString(mState); switch (command) { case CommandId::START: Loading @@ -240,7 +237,7 @@ ndk::ScopedAStatus EffectImpl::command(CommandId command) { RETURN_IF_ASTATUS_NOT_OK(commandImpl(command), "commandImplFailed"); mState = State::PROCESSING; RETURN_IF(notifyEventFlag(kEventFlagNotEmpty) != RetCode::SUCCESS, EX_ILLEGAL_STATE, "notifyEventFlagFailed"); "notifyEventFlagNotEmptyFailed"); startThread(); break; case CommandId::STOP: Loading @@ -248,7 +245,7 @@ ndk::ScopedAStatus EffectImpl::command(CommandId command) { RETURN_OK_IF(mState == State::IDLE); mState = State::IDLE; RETURN_IF(notifyEventFlag(kEventFlagNotEmpty) != RetCode::SUCCESS, EX_ILLEGAL_STATE, "notifyEventFlagFailed"); "notifyEventFlagNotEmptyFailed"); stopThread(); RETURN_IF_ASTATUS_NOT_OK(commandImpl(command), "commandImplFailed"); break; Loading @@ -257,7 +254,7 @@ ndk::ScopedAStatus EffectImpl::command(CommandId command) { return ndk::ScopedAStatus::fromExceptionCodeWithMessage(EX_ILLEGAL_ARGUMENT, "CommandIdNotSupported"); } LOG(DEBUG) << getEffectName() << __func__ << " transfer to state: " << toString(mState); LOG(VERBOSE) << getEffectName() << __func__ << " transfer to state: " << toString(mState); return ndk::ScopedAStatus::ok(); } Loading Loading @@ -294,6 +291,7 @@ RetCode EffectImpl::notifyEventFlag(uint32_t flag) { LOG(ERROR) << getEffectName() << __func__ << ": wake failure with ret " << ret; return RetCode::ERROR_EVENT_FLAG_ERROR; } LOG(VERBOSE) << getEffectName() << __func__ << ": " << std::hex << mEventFlag; return RetCode::SUCCESS; } Loading @@ -306,7 +304,7 @@ IEffect::Status EffectImpl::status(binder_status_t status, size_t consumed, size } void EffectImpl::process() { ATRACE_CALL(); ATRACE_NAME(getEffectName().c_str()); /** * wait for the EventFlag without lock, it's ok because the mEfGroup pointer will not change * in the life cycle of workerThread (threadLoop). Loading Loading @@ -344,8 +342,6 @@ void EffectImpl::process() { IEffect::Status status = effectProcessImpl(buffer, buffer, processSamples); outputMQ->write(buffer, status.fmqProduced); statusMQ->writeBlocking(&status, 1); LOG(VERBOSE) << getEffectName() << __func__ << ": done processing, effect consumed " << status.fmqConsumed << " produced " << status.fmqProduced; } } } Loading @@ -355,7 +351,6 @@ IEffect::Status EffectImpl::effectProcessImpl(float* in, float* out, int samples for (int i = 0; i < samples; i++) { *out++ = *in++; } LOG(VERBOSE) << getEffectName() << __func__ << " done processing " << samples << " samples"; return {STATUS_OK, samples, samples}; } Loading audio/aidl/default/EffectThread.cpp +5 −10 Original line number Diff line number Diff line Loading @@ -27,13 +27,8 @@ namespace aidl::android::hardware::audio::effect { EffectThread::EffectThread() { LOG(DEBUG) << __func__; } EffectThread::~EffectThread() { destroyThread(); LOG(DEBUG) << __func__ << " done"; } RetCode EffectThread::createThread(const std::string& name, int priority) { Loading @@ -51,7 +46,7 @@ RetCode EffectThread::createThread(const std::string& name, int priority) { } mThread = std::thread(&EffectThread::threadLoop, this); LOG(DEBUG) << mName << __func__ << " priority " << mPriority << " done"; LOG(VERBOSE) << mName << __func__ << " priority " << mPriority << " done"; return RetCode::SUCCESS; } Loading @@ -66,7 +61,7 @@ RetCode EffectThread::destroyThread() { mThread.join(); } LOG(DEBUG) << mName << __func__; LOG(VERBOSE) << mName << __func__; return RetCode::SUCCESS; } Loading @@ -77,7 +72,7 @@ RetCode EffectThread::startThread() { mCv.notify_one(); } LOG(DEBUG) << mName << __func__; LOG(VERBOSE) << mName << __func__; return RetCode::SUCCESS; } Loading @@ -88,7 +83,7 @@ RetCode EffectThread::stopThread() { mCv.notify_one(); } LOG(DEBUG) << mName << __func__; LOG(VERBOSE) << mName << __func__; return RetCode::SUCCESS; } Loading @@ -101,7 +96,7 @@ void EffectThread::threadLoop() { ::android::base::ScopedLockAssertion lock_assertion(mThreadMutex); mCv.wait(l, [&]() REQUIRES(mThreadMutex) { return mExit || !mStop; }); if (mExit) { LOG(INFO) << __func__ << " EXIT!"; LOG(VERBOSE) << mName << " threadLoop EXIT!"; return; } } Loading Loading
audio/aidl/default/EffectConfig.cpp +7 −9 Original line number Diff line number Diff line Loading @@ -37,7 +37,6 @@ namespace aidl::android::hardware::audio::effect { EffectConfig::EffectConfig(const std::string& file) { tinyxml2::XMLDocument doc; doc.LoadFile(file.c_str()); LOG(DEBUG) << __func__ << " loading " << file; // parse the xml file into maps if (doc.Error()) { LOG(ERROR) << __func__ << " tinyxml2 failed to load " << file Loading Loading @@ -143,7 +142,7 @@ bool EffectConfig::parseEffect(const tinyxml2::XMLElement& xml) { std::string name = xml.Attribute("name"); RETURN_VALUE_IF(name == "", false, "effectsNoName"); LOG(DEBUG) << __func__ << dump(xml); LOG(VERBOSE) << __func__ << dump(xml); struct Library library; if (std::strcmp(xml.Name(), "effectProxy") == 0) { // proxy lib and uuid Loading Loading @@ -187,7 +186,7 @@ bool EffectConfig::parseLibrary(const tinyxml2::XMLElement& xml, struct Library& } RETURN_VALUE_IF((library.uuid == getEffectUuidZero()), false, "invalidUuidAttribute"); LOG(DEBUG) << __func__ << (isProxy ? " proxy " : library.name) << " : uuid " LOG(VERBOSE) << __func__ << (isProxy ? " proxy " : library.name) << " : uuid " << ::android::audio::utils::toString(library.uuid) << (library.type.has_value() ? ::android::audio::utils::toString(library.type.value()) Loading Loading @@ -245,7 +244,7 @@ std::optional<Processing::Type> EffectConfig::stringToProcessingType(Processing: } bool EffectConfig::parseProcessing(Processing::Type::Tag typeTag, const tinyxml2::XMLElement& xml) { LOG(DEBUG) << __func__ << dump(xml); LOG(VERBOSE) << __func__ << dump(xml); const char* typeStr = xml.Attribute("type"); auto aidlType = stringToProcessingType(typeTag, typeStr); RETURN_VALUE_IF(!aidlType.has_value(), false, "illegalStreamType"); Loading @@ -259,7 +258,6 @@ bool EffectConfig::parseProcessing(Processing::Type::Tag typeTag, const tinyxml2 } RETURN_VALUE_IF(!name, false, "noEffectAttribute"); mProcessingMap[aidlType.value()].emplace_back(mEffectsMap[name]); LOG(WARNING) << __func__ << " " << typeStr << " : " << name; } return true; } Loading
audio/aidl/default/EffectContext.cpp +1 −3 Original line number Diff line number Diff line Loading @@ -157,7 +157,6 @@ Parameter::VolumeStereo EffectContext::getVolumeStereo() { } RetCode EffectContext::setCommon(const Parameter::Common& common) { LOG(VERBOSE) << __func__ << common.toString(); auto& input = common.input; auto& output = common.output; Loading Loading @@ -186,7 +185,6 @@ RetCode EffectContext::setCommon(const Parameter::Common& common) { } Parameter::Common EffectContext::getCommon() { LOG(VERBOSE) << __func__ << mCommon.toString(); return mCommon; } Loading Loading @@ -241,7 +239,7 @@ RetCode EffectContext::notifyDataMqUpdate() { LOG(ERROR) << __func__ << ": wake failure with ret " << ret; return RetCode::ERROR_EVENT_FLAG_ERROR; } LOG(DEBUG) << __func__ << " : signal client for reopen"; LOG(VERBOSE) << __func__ << " : signal client for reopen"; return RetCode::SUCCESS; } } // namespace aidl::android::hardware::audio::effect
audio/aidl/default/EffectFactory.cpp +15 −16 Original line number Diff line number Diff line Loading @@ -43,11 +43,11 @@ Factory::Factory(const std::string& file) : mConfig(EffectConfig(file)) { Factory::~Factory() { if (auto count = mEffectMap.size()) { LOG(ERROR) << __func__ << " remaining " << count LOG(WARNING) << __func__ << " remaining " << count << " effect instances not destroyed indicating resource leak!"; for (const auto& it : mEffectMap) { if (auto spEffect = it.first.lock()) { LOG(ERROR) << __func__ << " erase remaining instance UUID " LOG(WARNING) << __func__ << " erase remaining instance UUID " << ::android::audio::utils::toString(it.second.first); destroyEffectImpl_l(spEffect); } Loading Loading @@ -139,7 +139,7 @@ ndk::ScopedAStatus Factory::createEffect(const AudioUuid& in_impl_uuid, std::shared_ptr<IEffect> effectSp; RETURN_IF_BINDER_EXCEPTION(libInterface->createEffectFunc(&in_impl_uuid, &effectSp)); if (!effectSp) { LOG(ERROR) << __func__ << ": library created null instance without return error!"; LOG(WARNING) << __func__ << ": library created null instance without return error!"; return ndk::ScopedAStatus::fromExceptionCode(EX_TRANSACTION_FAILED); } *_aidl_return = effectSp; Loading @@ -147,7 +147,6 @@ ndk::ScopedAStatus Factory::createEffect(const AudioUuid& in_impl_uuid, AIBinder_setMinSchedulerPolicy(effectBinder.get(), SCHED_NORMAL, ANDROID_PRIORITY_AUDIO); mEffectMap[std::weak_ptr<IEffect>(effectSp)] = std::make_pair(in_impl_uuid, std::move(effectBinder)); LOG(DEBUG) << __func__ << ": instance " << effectSp.get() << " created successfully"; return ndk::ScopedAStatus::ok(); } else { LOG(ERROR) << __func__ << ": library doesn't exist"; Loading Loading @@ -192,7 +191,6 @@ void Factory::cleanupEffectMap_l() { } ndk::ScopedAStatus Factory::destroyEffect(const std::shared_ptr<IEffect>& in_handle) { LOG(DEBUG) << __func__ << ": instance " << in_handle.get(); std::lock_guard lg(mMutex); ndk::ScopedAStatus status = destroyEffectImpl_l(in_handle); // always do the cleanup Loading @@ -215,7 +213,7 @@ bool Factory::openEffectLibrary(const AudioUuid& impl, return false; } LOG(INFO) << __func__ << " dlopen lib:" << path LOG(DEBUG) << __func__ << " dlopen lib: " << path << "\nimpl:" << ::android::audio::utils::toString(impl) << "\nhandle:" << libHandle; auto interface = new effect_dl_interface_s{nullptr, nullptr, nullptr}; mEffectLibMap.insert( Loading @@ -235,10 +233,11 @@ void Factory::createIdentityWithConfig( id.type = typeUuid; id.uuid = configLib.uuid; id.proxy = proxyUuid; LOG(DEBUG) << __func__ << " loading lib " << path->second << ": typeUuid " LOG(WARNING) << __func__ << " loading lib " << path->second << ": typeUuid " << ::android::audio::utils::toString(id.type) << "\nimplUuid " << ::android::audio::utils::toString(id.uuid) << " proxyUuid " << (proxyUuid.has_value() ? ::android::audio::utils::toString(proxyUuid.value()) << (proxyUuid.has_value() ? ::android::audio::utils::toString(proxyUuid.value()) : "null"); if (openEffectLibrary(id.uuid, path->second)) { mIdentitySet.insert(std::move(id)); Loading @@ -263,8 +262,8 @@ void Factory::loadEffectLibs() { createIdentityWithConfig(configLib, type, proxyUuid); } } else { LOG(ERROR) << __func__ << ": can not find type UUID for effect " << configEffects.first << " skipping!"; LOG(WARNING) << __func__ << ": can not find type UUID for effect " << configEffects.first << " skipping!"; } } } Loading
audio/aidl/default/EffectImpl.cpp +6 −11 Original line number Diff line number Diff line Loading @@ -35,7 +35,6 @@ extern "C" binder_exception_t destroyEffect(const std::shared_ptr<IEffect>& inst << " in state: " << toString(state) << ", status: " << status.getDescription(); return EX_ILLEGAL_STATE; } LOG(DEBUG) << __func__ << " instance " << instanceSp.get() << " destroyed"; return EX_NONE; } Loading Loading @@ -91,7 +90,7 @@ ndk::ScopedAStatus EffectImpl::close() { } RETURN_IF(notifyEventFlag(kEventFlagNotEmpty) != RetCode::SUCCESS, EX_ILLEGAL_STATE, "notifyEventFlagFailed"); "notifyEventFlagNotEmptyFailed"); // stop the worker thread, ignore the return code RETURN_IF(destroyThread() != RetCode::SUCCESS, EX_UNSUPPORTED_OPERATION, "FailedToDestroyWorker"); Loading Loading @@ -231,8 +230,6 @@ ndk::ScopedAStatus EffectImpl::getState(State* state) NO_THREAD_SAFETY_ANALYSIS ndk::ScopedAStatus EffectImpl::command(CommandId command) { std::lock_guard lg(mImplMutex); RETURN_IF(mState == State::INIT, EX_ILLEGAL_STATE, "instanceNotOpen"); LOG(DEBUG) << getEffectName() << __func__ << ": receive command: " << toString(command) << " at state " << toString(mState); switch (command) { case CommandId::START: Loading @@ -240,7 +237,7 @@ ndk::ScopedAStatus EffectImpl::command(CommandId command) { RETURN_IF_ASTATUS_NOT_OK(commandImpl(command), "commandImplFailed"); mState = State::PROCESSING; RETURN_IF(notifyEventFlag(kEventFlagNotEmpty) != RetCode::SUCCESS, EX_ILLEGAL_STATE, "notifyEventFlagFailed"); "notifyEventFlagNotEmptyFailed"); startThread(); break; case CommandId::STOP: Loading @@ -248,7 +245,7 @@ ndk::ScopedAStatus EffectImpl::command(CommandId command) { RETURN_OK_IF(mState == State::IDLE); mState = State::IDLE; RETURN_IF(notifyEventFlag(kEventFlagNotEmpty) != RetCode::SUCCESS, EX_ILLEGAL_STATE, "notifyEventFlagFailed"); "notifyEventFlagNotEmptyFailed"); stopThread(); RETURN_IF_ASTATUS_NOT_OK(commandImpl(command), "commandImplFailed"); break; Loading @@ -257,7 +254,7 @@ ndk::ScopedAStatus EffectImpl::command(CommandId command) { return ndk::ScopedAStatus::fromExceptionCodeWithMessage(EX_ILLEGAL_ARGUMENT, "CommandIdNotSupported"); } LOG(DEBUG) << getEffectName() << __func__ << " transfer to state: " << toString(mState); LOG(VERBOSE) << getEffectName() << __func__ << " transfer to state: " << toString(mState); return ndk::ScopedAStatus::ok(); } Loading Loading @@ -294,6 +291,7 @@ RetCode EffectImpl::notifyEventFlag(uint32_t flag) { LOG(ERROR) << getEffectName() << __func__ << ": wake failure with ret " << ret; return RetCode::ERROR_EVENT_FLAG_ERROR; } LOG(VERBOSE) << getEffectName() << __func__ << ": " << std::hex << mEventFlag; return RetCode::SUCCESS; } Loading @@ -306,7 +304,7 @@ IEffect::Status EffectImpl::status(binder_status_t status, size_t consumed, size } void EffectImpl::process() { ATRACE_CALL(); ATRACE_NAME(getEffectName().c_str()); /** * wait for the EventFlag without lock, it's ok because the mEfGroup pointer will not change * in the life cycle of workerThread (threadLoop). Loading Loading @@ -344,8 +342,6 @@ void EffectImpl::process() { IEffect::Status status = effectProcessImpl(buffer, buffer, processSamples); outputMQ->write(buffer, status.fmqProduced); statusMQ->writeBlocking(&status, 1); LOG(VERBOSE) << getEffectName() << __func__ << ": done processing, effect consumed " << status.fmqConsumed << " produced " << status.fmqProduced; } } } Loading @@ -355,7 +351,6 @@ IEffect::Status EffectImpl::effectProcessImpl(float* in, float* out, int samples for (int i = 0; i < samples; i++) { *out++ = *in++; } LOG(VERBOSE) << getEffectName() << __func__ << " done processing " << samples << " samples"; return {STATUS_OK, samples, samples}; } Loading
audio/aidl/default/EffectThread.cpp +5 −10 Original line number Diff line number Diff line Loading @@ -27,13 +27,8 @@ namespace aidl::android::hardware::audio::effect { EffectThread::EffectThread() { LOG(DEBUG) << __func__; } EffectThread::~EffectThread() { destroyThread(); LOG(DEBUG) << __func__ << " done"; } RetCode EffectThread::createThread(const std::string& name, int priority) { Loading @@ -51,7 +46,7 @@ RetCode EffectThread::createThread(const std::string& name, int priority) { } mThread = std::thread(&EffectThread::threadLoop, this); LOG(DEBUG) << mName << __func__ << " priority " << mPriority << " done"; LOG(VERBOSE) << mName << __func__ << " priority " << mPriority << " done"; return RetCode::SUCCESS; } Loading @@ -66,7 +61,7 @@ RetCode EffectThread::destroyThread() { mThread.join(); } LOG(DEBUG) << mName << __func__; LOG(VERBOSE) << mName << __func__; return RetCode::SUCCESS; } Loading @@ -77,7 +72,7 @@ RetCode EffectThread::startThread() { mCv.notify_one(); } LOG(DEBUG) << mName << __func__; LOG(VERBOSE) << mName << __func__; return RetCode::SUCCESS; } Loading @@ -88,7 +83,7 @@ RetCode EffectThread::stopThread() { mCv.notify_one(); } LOG(DEBUG) << mName << __func__; LOG(VERBOSE) << mName << __func__; return RetCode::SUCCESS; } Loading @@ -101,7 +96,7 @@ void EffectThread::threadLoop() { ::android::base::ScopedLockAssertion lock_assertion(mThreadMutex); mCv.wait(l, [&]() REQUIRES(mThreadMutex) { return mExit || !mStop; }); if (mExit) { LOG(INFO) << __func__ << " EXIT!"; LOG(VERBOSE) << mName << " threadLoop EXIT!"; return; } } Loading