diff options
author | alk3pInjection <webmaster@raspii.tech> | 2023-07-04 20:04:45 +0800 |
---|---|---|
committer | alk3pInjection <webmaster@raspii.tech> | 2023-07-04 20:04:45 +0800 |
commit | e1390d22fae12df2784992b3ba238af8e90eaecc (patch) | |
tree | 52dfbc4cd9931c722b210f063c144fe97a706af5 /audio/effect/all-versions/default/Effect.cpp | |
parent | b3f20c2aa61e4a6e07e8c06cf3623f1666620e1f (diff) | |
parent | 7c8943fde12ec5fb0f9629746c65e8b1bc78d1b4 (diff) |
Merge tag 'LA.QSSI.13.0.r1-10700-qssi.0' into tachibana-mr1tachibana-mr1
"LA.QSSI.13.0.r1-10700-qssi.0"
Change-Id: I11f0f2cb764e800ff1fd298c5a6443b98cf9a8a3
Diffstat (limited to 'audio/effect/all-versions/default/Effect.cpp')
-rw-r--r-- | audio/effect/all-versions/default/Effect.cpp | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/audio/effect/all-versions/default/Effect.cpp b/audio/effect/all-versions/default/Effect.cpp index 87e1ab7a7d..5aecd324eb 100644 --- a/audio/effect/all-versions/default/Effect.cpp +++ b/audio/effect/all-versions/default/Effect.cpp @@ -240,16 +240,6 @@ class ProcessThread : public Thread { }; bool ProcessThread::threadLoop() { - // For a spatializer effect, we perform scheduler adjustments to reduce glitches and power. - { - effect_descriptor_t halDescriptor{}; - if ((*mEffect)->get_descriptor(mEffect, &halDescriptor) == NO_ERROR && - memcmp(&halDescriptor.type, FX_IID_SPATIALIZER, sizeof(effect_uuid_t)) == 0) { - const status_t status = scheduler::updateSpatializerPriority(gettid()); - ALOGW_IF(status != OK, "Failed to update Spatializer priority"); - } - } - // This implementation doesn't return control back to the Thread until it decides to stop, // as the Thread uses mutexes, and this can lead to priority inversion. while (!std::atomic_load_explicit(mStop, std::memory_order_acquire)) { @@ -570,6 +560,15 @@ Return<void> Effect::prepareForProcessing(prepareForProcessing_cb _hidl_cb) { return Void(); } + // For a spatializer effect, we perform scheduler adjustments to reduce glitches and power. + // We do it here instead of the ProcessThread::threadLoop to ensure that mHandle is valid. + if (effect_descriptor_t halDescriptor{}; + (*mHandle)->get_descriptor(mHandle, &halDescriptor) == NO_ERROR && + memcmp(&halDescriptor.type, FX_IID_SPATIALIZER, sizeof(effect_uuid_t)) == 0) { + const status_t status = scheduler::updateSpatializerPriority(mProcessThread->getTid()); + ALOGW_IF(status != OK, "Failed to update Spatializer priority"); + } + mStatusMQ = std::move(tempStatusMQ); _hidl_cb(Result::OK, *mStatusMQ->getDesc()); return Void(); |