mirror of
https://github.com/Evolution-X/hardware_interfaces
synced 2026-02-01 16:23:37 +00:00
Merge changes If396a5ce,I8de367ce into main am: c546b2b1a6 am: 69d4854471
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/3313952 Change-Id: Ia8dcef626cca2efd3f8a69803a8f1b4559c01900 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -937,9 +937,12 @@ ndk::ScopedAStatus StreamIn::setHwGain(const std::vector<float>& in_channelGains
|
||||
}
|
||||
|
||||
StreamInHwGainHelper::StreamInHwGainHelper(const StreamContext* context)
|
||||
: mChannelCount(getChannelCount(context->getChannelLayout())), mHwGains(mChannelCount, 0.0f) {}
|
||||
: mChannelCount(getChannelCount(context->getChannelLayout())) {}
|
||||
|
||||
ndk::ScopedAStatus StreamInHwGainHelper::getHwGainImpl(std::vector<float>* _aidl_return) {
|
||||
if (mHwGains.empty()) {
|
||||
mHwGains.resize(mChannelCount, 0.0f);
|
||||
}
|
||||
*_aidl_return = mHwGains;
|
||||
LOG(DEBUG) << __func__ << ": returning " << ::android::internal::ToString(*_aidl_return);
|
||||
return ndk::ScopedAStatus::ok();
|
||||
@@ -1068,10 +1071,12 @@ ndk::ScopedAStatus StreamOut::selectPresentation(int32_t in_presentationId, int3
|
||||
}
|
||||
|
||||
StreamOutHwVolumeHelper::StreamOutHwVolumeHelper(const StreamContext* context)
|
||||
: mChannelCount(getChannelCount(context->getChannelLayout())),
|
||||
mHwVolumes(mChannelCount, 0.0f) {}
|
||||
: mChannelCount(getChannelCount(context->getChannelLayout())) {}
|
||||
|
||||
ndk::ScopedAStatus StreamOutHwVolumeHelper::getHwVolumeImpl(std::vector<float>* _aidl_return) {
|
||||
if (mHwVolumes.empty()) {
|
||||
mHwVolumes.resize(mChannelCount, 0.0f);
|
||||
}
|
||||
*_aidl_return = mHwVolumes;
|
||||
LOG(DEBUG) << __func__ << ": returning " << ::android::internal::ToString(*_aidl_return);
|
||||
return ndk::ScopedAStatus::ok();
|
||||
|
||||
@@ -218,11 +218,12 @@ ndk::ScopedAStatus StreamInPrimary::getHwGain(std::vector<float>* _aidl_return)
|
||||
if (isStubStream()) {
|
||||
return ndk::ScopedAStatus::fromExceptionCode(EX_UNSUPPORTED_OPERATION);
|
||||
}
|
||||
float gain;
|
||||
RETURN_STATUS_IF_ERROR(primary::PrimaryMixer::getInstance().getMicGain(&gain));
|
||||
_aidl_return->resize(0);
|
||||
_aidl_return->resize(mChannelCount, gain);
|
||||
RETURN_STATUS_IF_ERROR(setHwGainImpl(*_aidl_return));
|
||||
if (mHwGains.empty()) {
|
||||
float gain;
|
||||
RETURN_STATUS_IF_ERROR(primary::PrimaryMixer::getInstance().getMicGain(&gain));
|
||||
_aidl_return->resize(mChannelCount, gain);
|
||||
RETURN_STATUS_IF_ERROR(setHwGainImpl(*_aidl_return));
|
||||
}
|
||||
return getHwGainImpl(_aidl_return);
|
||||
}
|
||||
|
||||
@@ -241,6 +242,14 @@ ndk::ScopedAStatus StreamInPrimary::setHwGain(const std::vector<float>& in_chann
|
||||
mHwGains = currentGains;
|
||||
return status;
|
||||
}
|
||||
float gain;
|
||||
RETURN_STATUS_IF_ERROR(primary::PrimaryMixer::getInstance().getMicGain(&gain));
|
||||
// Due to rounding errors, round trip conversions between percents and indexed values may not
|
||||
// match.
|
||||
if (gain != in_channelGains[0]) {
|
||||
LOG(WARNING) << __func__ << ": unmatched gain: set: " << in_channelGains[0]
|
||||
<< ", from mixer: " << gain;
|
||||
}
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
@@ -254,9 +263,11 @@ ndk::ScopedAStatus StreamOutPrimary::getHwVolume(std::vector<float>* _aidl_retur
|
||||
if (isStubStream()) {
|
||||
return ndk::ScopedAStatus::fromExceptionCode(EX_UNSUPPORTED_OPERATION);
|
||||
}
|
||||
RETURN_STATUS_IF_ERROR(primary::PrimaryMixer::getInstance().getVolumes(_aidl_return));
|
||||
_aidl_return->resize(mChannelCount);
|
||||
RETURN_STATUS_IF_ERROR(setHwVolumeImpl(*_aidl_return));
|
||||
if (mHwVolumes.empty()) {
|
||||
RETURN_STATUS_IF_ERROR(primary::PrimaryMixer::getInstance().getVolumes(_aidl_return));
|
||||
_aidl_return->resize(mChannelCount);
|
||||
RETURN_STATUS_IF_ERROR(setHwVolumeImpl(*_aidl_return));
|
||||
}
|
||||
return getHwVolumeImpl(_aidl_return);
|
||||
}
|
||||
|
||||
@@ -272,6 +283,15 @@ ndk::ScopedAStatus StreamOutPrimary::setHwVolume(const std::vector<float>& in_ch
|
||||
mHwVolumes = currentVolumes;
|
||||
return status;
|
||||
}
|
||||
std::vector<float> volumes;
|
||||
RETURN_STATUS_IF_ERROR(primary::PrimaryMixer::getInstance().getVolumes(&volumes));
|
||||
// Due to rounding errors, round trip conversions between percents and indexed values may not
|
||||
// match.
|
||||
if (volumes != in_channelVolumes) {
|
||||
LOG(WARNING) << __func__ << ": unmatched volumes: set: "
|
||||
<< ::android::internal::ToString(in_channelVolumes)
|
||||
<< ", from mixer: " << ::android::internal::ToString(volumes);
|
||||
}
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user