Merge changes from topic "CAP_AIDL_AUDIO_HAL" into main
* changes:
Configurable Audio Policy: migrate settings to AudioAIDL
Migrate forced config and force use to android.media.audio.common.types
diff --git a/media/codec2/hal/aidl/ComponentStore.cpp b/media/codec2/hal/aidl/ComponentStore.cpp
index ea4d045..356bf72 100644
--- a/media/codec2/hal/aidl/ComponentStore.cpp
+++ b/media/codec2/hal/aidl/ComponentStore.cpp
@@ -212,12 +212,20 @@
if (c2interface == nullptr) {
return nullptr;
}
+ // Framework support for Large audio frame feature depends on:
+ // 1. All feature flags enabled on platform
+ // 2. The capability of the implementation to use the same input buffer
+ // for different C2Work (C2Config::api_feature_t::API_SAME_INPUT_BUFFER)
+ // 3. Implementation does not inherently support C2LargeFrame::output::PARAM_TYPE param.
if (MultiAccessUnitHelper::isEnabledOnPlatform()) {
c2_status_t err = C2_OK;
C2ComponentDomainSetting domain;
std::vector<std::unique_ptr<C2Param>> heapParams;
- err = c2interface->query_vb({&domain}, {}, C2_MAY_BLOCK, &heapParams);
- if (err == C2_OK && (domain.value == C2Component::DOMAIN_AUDIO)) {
+ C2ApiFeaturesSetting features = (C2Config::api_feature_t)0;
+ err = c2interface->query_vb({&domain, &features}, {}, C2_MAY_BLOCK, &heapParams);
+ if (err == C2_OK
+ && (domain.value == C2Component::DOMAIN_AUDIO)
+ && ((features.value & C2Config::api_feature_t::API_SAME_INPUT_BUFFER) != 0)) {
std::vector<std::shared_ptr<C2ParamDescriptor>> params;
bool isComponentSupportsLargeAudioFrame = false;
c2interface->querySupportedParams_nb(¶ms);
@@ -232,9 +240,11 @@
// param reflectors. Currently filters work on video domain only,
// and the MultiAccessUnitHelper is only enabled on audio domain;
// thus we pass the component's param reflector, which is mParamReflectors[0].
+ std::shared_ptr<C2ReflectorHelper> multiAccessReflector(new C2ReflectorHelper());
multiAccessUnitIntf = std::make_shared<MultiAccessUnitInterface>(
c2interface,
- std::static_pointer_cast<C2ReflectorHelper>(mParamReflectors[0]));
+ multiAccessReflector);
+ mParamReflectors.push_back(multiAccessReflector);
}
}
}
diff --git a/media/codec2/hal/hidl/1.0/utils/ComponentStore.cpp b/media/codec2/hal/hidl/1.0/utils/ComponentStore.cpp
index 1ba1889..f09e232 100644
--- a/media/codec2/hal/hidl/1.0/utils/ComponentStore.cpp
+++ b/media/codec2/hal/hidl/1.0/utils/ComponentStore.cpp
@@ -207,12 +207,20 @@
if (c2interface == nullptr) {
return nullptr;
}
+ // Framework support for Large audio frame feature depends on:
+ // 1. All feature flags enabled on platform
+ // 2. The capability of the implementation to use the same input buffer
+ // for different C2Work (C2Config::api_feature_t::API_SAME_INPUT_BUFFER)
+ // 3. Implementation does not inherently support C2LargeFrame::output::PARAM_TYPE param.
if (MultiAccessUnitHelper::isEnabledOnPlatform()) {
c2_status_t err = C2_OK;
C2ComponentDomainSetting domain;
std::vector<std::unique_ptr<C2Param>> heapParams;
- err = c2interface->query_vb({&domain}, {}, C2_MAY_BLOCK, &heapParams);
- if (err == C2_OK && (domain.value == C2Component::DOMAIN_AUDIO)) {
+ C2ApiFeaturesSetting features = (C2Config::api_feature_t)0;
+ err = c2interface->query_vb({&domain, &features}, {}, C2_MAY_BLOCK, &heapParams);
+ if (err == C2_OK
+ && (domain.value == C2Component::DOMAIN_AUDIO)
+ && ((features.value & C2Config::api_feature_t::API_SAME_INPUT_BUFFER) != 0)) {
std::vector<std::shared_ptr<C2ParamDescriptor>> params;
bool isComponentSupportsLargeAudioFrame = false;
c2interface->querySupportedParams_nb(¶ms);
@@ -223,9 +231,12 @@
}
}
if (!isComponentSupportsLargeAudioFrame) {
+ std::shared_ptr<C2ReflectorHelper> multiAccessReflector(new C2ReflectorHelper());
multiAccessUnitIntf = std::make_shared<MultiAccessUnitInterface>(
c2interface,
- std::static_pointer_cast<C2ReflectorHelper>(mParamReflectors[0]));
+ multiAccessReflector);
+ mParamReflectors.push_back(multiAccessReflector);
+
}
}
}
diff --git a/media/codec2/hal/hidl/1.1/utils/ComponentStore.cpp b/media/codec2/hal/hidl/1.1/utils/ComponentStore.cpp
index 1b86958..009a326 100644
--- a/media/codec2/hal/hidl/1.1/utils/ComponentStore.cpp
+++ b/media/codec2/hal/hidl/1.1/utils/ComponentStore.cpp
@@ -207,12 +207,20 @@
if (c2interface == nullptr) {
return nullptr;
}
+ // Framework support for Large audio frame feature depends on:
+ // 1. All feature flags enabled on platform
+ // 2. The capability of the implementation to use the same input buffer
+ // for different C2Work (C2Config::api_feature_t::API_SAME_INPUT_BUFFER)
+ // 3. Implementation does not inherently support C2LargeFrame::output::PARAM_TYPE param.
if (MultiAccessUnitHelper::isEnabledOnPlatform()) {
c2_status_t err = C2_OK;
C2ComponentDomainSetting domain;
std::vector<std::unique_ptr<C2Param>> heapParams;
- err = c2interface->query_vb({&domain}, {}, C2_MAY_BLOCK, &heapParams);
- if (err == C2_OK && (domain.value == C2Component::DOMAIN_AUDIO)) {
+ C2ApiFeaturesSetting features = (C2Config::api_feature_t)0;
+ err = c2interface->query_vb({&domain, &features}, {}, C2_MAY_BLOCK, &heapParams);
+ if (err == C2_OK
+ && (domain.value == C2Component::DOMAIN_AUDIO)
+ && ((features.value & C2Config::api_feature_t::API_SAME_INPUT_BUFFER) != 0)) {
std::vector<std::shared_ptr<C2ParamDescriptor>> params;
bool isComponentSupportsLargeAudioFrame = false;
c2interface->querySupportedParams_nb(¶ms);
@@ -224,9 +232,11 @@
}
if (!isComponentSupportsLargeAudioFrame) {
+ std::shared_ptr<C2ReflectorHelper> multiAccessReflector(new C2ReflectorHelper());
multiAccessUnitIntf = std::make_shared<MultiAccessUnitInterface>(
c2interface,
- std::static_pointer_cast<C2ReflectorHelper>(mParamReflectors[0]));
+ multiAccessReflector);
+ mParamReflectors.push_back(multiAccessReflector);
}
}
}
diff --git a/media/codec2/hal/hidl/1.2/utils/ComponentStore.cpp b/media/codec2/hal/hidl/1.2/utils/ComponentStore.cpp
index 2e0386f..89f71a9 100644
--- a/media/codec2/hal/hidl/1.2/utils/ComponentStore.cpp
+++ b/media/codec2/hal/hidl/1.2/utils/ComponentStore.cpp
@@ -207,12 +207,20 @@
if (c2interface == nullptr) {
return nullptr;
}
+ // Framework support for Large audio frame feature depends on:
+ // 1. All feature flags enabled on platform
+ // 2. The capability of the implementation to use the same input buffer
+ // for different C2Work (C2Config::api_feature_t::API_SAME_INPUT_BUFFER)
+ // 3. Implementation does not inherently support C2LargeFrame::output::PARAM_TYPE param.
if (MultiAccessUnitHelper::isEnabledOnPlatform()) {
c2_status_t err = C2_OK;
C2ComponentDomainSetting domain;
std::vector<std::unique_ptr<C2Param>> heapParams;
- err = c2interface->query_vb({&domain}, {}, C2_MAY_BLOCK, &heapParams);
- if (err == C2_OK && (domain.value == C2Component::DOMAIN_AUDIO)) {
+ C2ApiFeaturesSetting features = (C2Config::api_feature_t)0;
+ err = c2interface->query_vb({&domain, &features}, {}, C2_MAY_BLOCK, &heapParams);
+ if (err == C2_OK
+ && (domain.value == C2Component::DOMAIN_AUDIO)
+ && ((features.value & C2Config::api_feature_t::API_SAME_INPUT_BUFFER) != 0)) {
std::vector<std::shared_ptr<C2ParamDescriptor>> params;
bool isComponentSupportsLargeAudioFrame = false;
c2interface->querySupportedParams_nb(¶ms);
@@ -223,9 +231,11 @@
}
}
if (!isComponentSupportsLargeAudioFrame) {
+ std::shared_ptr<C2ReflectorHelper> multiAccessReflector(new C2ReflectorHelper());
multiAccessUnitIntf = std::make_shared<MultiAccessUnitInterface>(
c2interface,
- std::static_pointer_cast<C2ReflectorHelper>(mParamReflectors[0]));
+ multiAccessReflector);
+ mParamReflectors.push_back(multiAccessReflector);
}
}
}