diff options
author | Andy Hung <hunga@google.com> | 2022-12-05 13:55:31 -0800 |
---|---|---|
committer | Andy Hung <hunga@google.com> | 2022-12-05 14:42:48 -0800 |
commit | 43966208b7ef50c51a58e82c6d7c10ee9e115860 (patch) | |
tree | 770a65fa1c2bda2e84ea7c9339cfda7994f3ea53 /audio/core/all-versions/default/Device.cpp | |
parent | 2c7c34e466586c927d16aa44be8da97574040194 (diff) |
audio HAL: set minimum Binder access priority
Use setMinSchedulerPolicy to enforce minimum thread priority
when accessing the audio HAL to ANDROID_PRIORITY_AUDIO
Test: instrumented
Bug: 261496726
Change-Id: I700b04d3060e9405b1445206882a6131cea0d045
Diffstat (limited to 'audio/core/all-versions/default/Device.cpp')
-rw-r--r-- | audio/core/all-versions/default/Device.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/audio/core/all-versions/default/Device.cpp b/audio/core/all-versions/default/Device.cpp index b954fcd6f8..d03118ae5d 100644 --- a/audio/core/all-versions/default/Device.cpp +++ b/audio/core/all-versions/default/Device.cpp @@ -30,6 +30,7 @@ #include <algorithm> #include <android/log.h> +#include <hidl/HidlTransportSupport.h> #include <mediautils/MemoryLeakTrackUtil.h> #include <memunreachable/memunreachable.h> @@ -183,6 +184,7 @@ std::tuple<Result, sp<IStreamOut>> Device::openOutputStreamCore(int32_t ioHandle if (status == OK) { streamOut = new StreamOut(this, halStream); ++mOpenedStreamsCount; + android::hardware::setMinSchedulerPolicy(streamOut, SCHED_NORMAL, ANDROID_PRIORITY_AUDIO); } status_t convertStatus = HidlUtils::audioConfigFromHal(halConfig, false /*isInput*/, suggestedConfig); @@ -220,6 +222,7 @@ std::tuple<Result, sp<IStreamIn>> Device::openInputStreamCore( if (status == OK) { streamIn = new StreamIn(this, halStream); ++mOpenedStreamsCount; + android::hardware::setMinSchedulerPolicy(streamIn, SCHED_NORMAL, ANDROID_PRIORITY_AUDIO); } status_t convertStatus = HidlUtils::audioConfigFromHal(halConfig, true /*isInput*/, suggestedConfig); |