Merge "audio: Allow to inherit Binder RT priority in AIDL" into 24D1-dev

This commit is contained in:
Mikhail Naganov
2024-03-27 16:11:18 +00:00
committed by Android (Google) Code Review
3 changed files with 10 additions and 7 deletions

View File

@@ -145,6 +145,7 @@ ndk::ScopedAStatus Factory::createEffect(const AudioUuid& in_impl_uuid,
*_aidl_return = effectSp;
ndk::SpAIBinder effectBinder = effectSp->asBinder();
AIBinder_setMinSchedulerPolicy(effectBinder.get(), SCHED_NORMAL, ANDROID_PRIORITY_AUDIO);
AIBinder_setInheritRt(effectBinder.get(), true);
mEffectMap[std::weak_ptr<IEffect>(effectSp)] =
std::make_pair(in_impl_uuid, std::move(effectBinder));
return ndk::ScopedAStatus::ok();

View File

@@ -855,8 +855,9 @@ ndk::ScopedAStatus Module::openInputStream(const OpenInputStreamArguments& in_ar
RETURN_STATUS_IF_ERROR(
streamWrapper.setConnectedDevices(findConnectedDevices(in_args.portConfigId)));
}
AIBinder_setMinSchedulerPolicy(streamWrapper.getBinder().get(), SCHED_NORMAL,
ANDROID_PRIORITY_AUDIO);
auto streamBinder = streamWrapper.getBinder();
AIBinder_setMinSchedulerPolicy(streamBinder.get(), SCHED_NORMAL, ANDROID_PRIORITY_AUDIO);
AIBinder_setInheritRt(streamBinder.get(), true);
mStreams.insert(port->id, in_args.portConfigId, std::move(streamWrapper));
_aidl_return->stream = std::move(stream);
return ndk::ScopedAStatus::ok();
@@ -901,8 +902,9 @@ ndk::ScopedAStatus Module::openOutputStream(const OpenOutputStreamArguments& in_
RETURN_STATUS_IF_ERROR(
streamWrapper.setConnectedDevices(findConnectedDevices(in_args.portConfigId)));
}
AIBinder_setMinSchedulerPolicy(streamWrapper.getBinder().get(), SCHED_NORMAL,
ANDROID_PRIORITY_AUDIO);
auto streamBinder = streamWrapper.getBinder();
AIBinder_setMinSchedulerPolicy(streamBinder.get(), SCHED_NORMAL, ANDROID_PRIORITY_AUDIO);
AIBinder_setInheritRt(streamBinder.get(), true);
mStreams.insert(port->id, in_args.portConfigId, std::move(streamWrapper));
_aidl_return->stream = std::move(stream);
return ndk::ScopedAStatus::ok();

View File

@@ -48,9 +48,9 @@ struct ChildInterface : private std::pair<std::shared_ptr<C>, ndk::SpAIBinder> {
}
AIBinder* getBinder() {
if (this->second.get() == nullptr) {
this->second = this->first->asBinder();
AIBinder_setMinSchedulerPolicy(this->second.get(), SCHED_NORMAL,
ANDROID_PRIORITY_AUDIO);
const auto binder = this->second = this->first->asBinder();
AIBinder_setMinSchedulerPolicy(binder.get(), SCHED_NORMAL, ANDROID_PRIORITY_AUDIO);
AIBinder_setInheritRt(binder.get(), true);
}
return this->second.get();
}