diff --git a/audio/impl/Device.cpp b/audio/impl/Device.cpp index 6e55e7b..ae015a3 100644 --- a/audio/impl/Device.cpp +++ b/audio/impl/Device.cpp @@ -30,6 +30,7 @@ #include #include +#include #include #include @@ -183,6 +184,7 @@ std::tuple> 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> 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); diff --git a/audio/impl/DevicesFactory.cpp b/audio/impl/DevicesFactory.cpp index f44daf0..011f9ac 100644 --- a/audio/impl/DevicesFactory.cpp +++ b/audio/impl/DevicesFactory.cpp @@ -23,6 +23,8 @@ #include #include +#include +#include namespace android { namespace hardware { @@ -103,6 +105,7 @@ Return DevicesFactory::openDevice(const char* moduleName, Callback _hidl_c int halStatus = loadAudioInterface(moduleName, &halDevice); if (halStatus == OK) { result = new DeviceShim(halDevice); + android::hardware::setMinSchedulerPolicy(result, SCHED_NORMAL, ANDROID_PRIORITY_AUDIO); retval = Result::OK; } else if (halStatus == -EINVAL) { retval = Result::NOT_INITIALIZED;