Merge "audio: Enable RT priority inheritance for service clients" into main
diff --git a/media/codec2/sfplugin/CCodec.cpp b/media/codec2/sfplugin/CCodec.cpp
index ca0aabb..39aadd7 100644
--- a/media/codec2/sfplugin/CCodec.cpp
+++ b/media/codec2/sfplugin/CCodec.cpp
@@ -2633,6 +2633,15 @@
if (config->mInputSurface == nullptr
&& (property_get_bool("debug.stagefright.ccodec_delayed_params", false)
|| comp->getName().find("c2.android.") == 0)) {
+ std::vector<std::unique_ptr<C2Param>> localConfigUpdate;
+ for (const std::unique_ptr<C2Param> ¶m : configUpdate) {
+ if (param && param->coreIndex().coreIndex() == C2StreamSurfaceScalingInfo::CORE_INDEX) {
+ localConfigUpdate.push_back(C2Param::Copy(*param));
+ }
+ }
+ if (!localConfigUpdate.empty()) {
+ (void)config->setParameters(comp, localConfigUpdate, C2_MAY_BLOCK);
+ }
mChannel->setParameters(configUpdate);
} else {
sp<AMessage> outputFormat = config->mOutputFormat;
diff --git a/media/libaudiohal/impl/effectsAidlConversion/AidlConversionEq.cpp b/media/libaudiohal/impl/effectsAidlConversion/AidlConversionEq.cpp
index ca6ff88..7879200 100644
--- a/media/libaudiohal/impl/effectsAidlConversion/AidlConversionEq.cpp
+++ b/media/libaudiohal/impl/effectsAidlConversion/AidlConversionEq.cpp
@@ -17,6 +17,7 @@
#include <cstdint>
#include <cstring>
#include <optional>
+#include <unordered_set>
#define LOG_TAG "AidlConversionEQ"
//#define LOG_NDEBUG 0
@@ -262,10 +263,21 @@
}
case EQ_PARAM_GET_NUM_OF_PRESETS: {
Parameter aidlParam = VALUE_OR_RETURN_STATUS(getAidlParameter(Equalizer::presets));
- const auto& presets = VALUE_OR_RETURN_STATUS(GET_PARAMETER_SPECIFIC_FIELD(
+ auto presets = VALUE_OR_RETURN_STATUS(GET_PARAMETER_SPECIFIC_FIELD(
aidlParam, Equalizer, equalizer, Equalizer::presets,
std::vector<Equalizer::Preset>));
- uint16_t num = presets.size();
+ // it was assumed the presets index in the range of [0, NUM_OF_PRESETS - 1], so
+ // filter out presets out of this range (one example is preset {-1, "custom"})
+ std::erase_if(presets, [](const auto& preset) { return preset.index < 0; });
+ // validate remaining indexes are unique [0, num - 1]
+ std::unordered_set<uint16_t> uniqueIndices;
+ const uint16_t num = presets.size();
+ for (const auto& preset : presets) {
+ if (preset.index >= num || 0 != uniqueIndices.count(preset.index)) {
+ return BAD_VALUE;
+ }
+ uniqueIndices.insert(preset.index);
+ }
return param.writeToValue(&num);
}
case EQ_PARAM_GET_PRESET_NAME: {
diff --git a/media/libeffects/lvm/wrapper/Aidl/BundleContext.cpp b/media/libeffects/lvm/wrapper/Aidl/BundleContext.cpp
index fff2feb..d5e3cf7 100644
--- a/media/libeffects/lvm/wrapper/Aidl/BundleContext.cpp
+++ b/media/libeffects/lvm/wrapper/Aidl/BundleContext.cpp
@@ -185,7 +185,6 @@
}
RETURN_VALUE_IF(LVM_SUCCESS != LVM_SetControlParameters(mInstance, ¶ms),
RetCode::ERROR_EFFECT_LIB_ERROR, "failSetControlParams");
- mEnabled = false;
return limitLevel();
}
diff --git a/media/module/foundation/tests/AData_test.cpp b/media/module/foundation/tests/AData_test.cpp
index 2628a47..87b69a6 100644
--- a/media/module/foundation/tests/AData_test.cpp
+++ b/media/module/foundation/tests/AData_test.cpp
@@ -392,7 +392,7 @@
EXPECT_EQ(2L, _shared.use_count()); // still both u and _shared contains the object
EXPECT_TRUE(u.clear());
- EXPECT_TRUE(_shared.unique()); // now only _shared contains the object
+ EXPECT_EQ(1L, _shared.use_count()); // now only _shared contains the object
EXPECT_TRUE(u.set(_constShared));
EXPECT_EQ(2L, _constShared.use_count()); // even though it is const, we can add a use count
@@ -591,7 +591,7 @@
EXPECT_EQ(2L, _shared.use_count()); // still both u and _shared contains the object
EXPECT_TRUE(u.clear());
- EXPECT_TRUE(_shared.unique()); // now only _shared contains the object
+ EXPECT_EQ(1L, _shared.use_count()); // now only _shared contains the object
EXPECT_TRUE(u.set(_constShared));
EXPECT_EQ(2L, _constShared.use_count()); // even though it is const, we can add a use count
diff --git a/media/utils/tests/static_string_view_tests.cpp b/media/utils/tests/static_string_view_tests.cpp
index c00de68..1dd2370 100644
--- a/media/utils/tests/static_string_view_tests.cpp
+++ b/media/utils/tests/static_string_view_tests.cpp
@@ -37,14 +37,12 @@
// const std::array<char,2> nonstatic = {'a', 'b'};
// static_assert(can_assign<nonstatic>::value == false);
static std::array<char, 2> nonconst = {'a', 'b'};
- static const std::array<char, 2> nonconstexpr = {'a', 'b'};
static constexpr std::array<int, 2> nonchar = {1, 2};
static constexpr size_t nonarray = 2;
static_assert(CanCreate<nonconst>::value == false);
static_assert(CanCreate<nonarray>::value == false);
static_assert(CanCreate<nonchar>::value == false);
- static_assert(CanCreate<nonconstexpr>::value == false);
static constexpr std::array<char, 2> scoped = {'a', 'b'};
constexpr StaticStringView Ticket1 = StaticStringView::create<global>();
diff --git a/services/audiopolicy/managerdefault/AudioPolicyManager.cpp b/services/audiopolicy/managerdefault/AudioPolicyManager.cpp
index 15c6a75..95bbc25 100644
--- a/services/audiopolicy/managerdefault/AudioPolicyManager.cpp
+++ b/services/audiopolicy/managerdefault/AudioPolicyManager.cpp
@@ -7862,9 +7862,10 @@
}
if (Volume::getDeviceForVolume(deviceTypes) != AUDIO_DEVICE_OUT_SPEAKER
&& !Intersection(deviceTypes, {AUDIO_DEVICE_OUT_BLUETOOTH_A2DP,
- AUDIO_DEVICE_OUT_BLUETOOTH_A2DP_HEADPHONES}).empty()) {
- // on A2DP, also ensure notification volume is not too low compared to media when
- // intended to be played
+ AUDIO_DEVICE_OUT_BLUETOOTH_A2DP_HEADPHONES,
+ AUDIO_DEVICE_OUT_BLE_HEADSET}).empty()) {
+ // on A2DP/BLE, also ensure notification volume is not too low compared to media
+ // when intended to be played.
if ((volumeDb > -96.0f) &&
(musicVolDb - SONIFICATION_A2DP_MAX_MEDIA_DIFF_DB > volumeDb)) {
ALOGV("%s increasing volume for volume source=%d device=%s from %f to %f",