summaryrefslogtreecommitdiff
path: root/audio
diff options
context:
space:
mode:
authorAndy Hung <hunga@google.com>2022-10-18 18:03:54 -0700
committerAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2022-11-15 01:49:10 +0000
commitf75880001f62d323ac3e9f1628524e1974672d9b (patch)
treec4eb625fe896e89b28550185b40ffdcd7601de2e /audio
parent5590d5a43648027c54469d61b958c9bc26a271e9 (diff)
EffectHal: Support retrieving worker thread tid
Use 'gtid' as the command, returns the worker thread tid. Test: see bug Bug: 253276925 Change-Id: Ia4fa129c62cf6df97821c34876b517944bc5322f (cherry picked from commit 7d5eb5c8371cd881d8d2fd7b57a6d2803206fd59) Merged-In: Ia4fa129c62cf6df97821c34876b517944bc5322f
Diffstat (limited to 'audio')
-rw-r--r--audio/effect/all-versions/default/Effect.cpp17
1 files changed, 15 insertions, 2 deletions
diff --git a/audio/effect/all-versions/default/Effect.cpp b/audio/effect/all-versions/default/Effect.cpp
index b57dc63368..5dc42dc70d 100644
--- a/audio/effect/all-versions/default/Effect.cpp
+++ b/audio/effect/all-versions/default/Effect.cpp
@@ -700,8 +700,21 @@ Return<void> Effect::command(uint32_t commandId, const hidl_vec<uint8_t>& data,
void* dataPtr = halDataSize > 0 ? &halData[0] : NULL;
void* resultPtr = halResultSize > 0 ? &halResult[0] : NULL;
- status_t status =
- (*mHandle)->command(mHandle, commandId, halDataSize, dataPtr, &halResultSize, resultPtr);
+ status_t status = BAD_VALUE;
+ switch (commandId) {
+ case 'gtid': // retrieve the tid, used for spatializer priority boost
+ if (halDataSize == 0 && resultMaxSize == sizeof(int32_t)) {
+ auto ptid = (int32_t*)resultPtr;
+ ptid[0] = mProcessThread ? mProcessThread->getTid() : -1;
+ status = OK;
+ break; // we have handled 'gtid' here.
+ }
+ [[fallthrough]]; // allow 'gtid' overload (checked halDataSize and resultMaxSize).
+ default:
+ status = (*mHandle)->command(mHandle, commandId, halDataSize, dataPtr, &halResultSize,
+ resultPtr);
+ break;
+ }
hidl_vec<uint8_t> result;
if (status == OK && resultPtr != NULL) {
result.setToExternal(&halResult[0], halResultSize);