CCodec: handle vendor parameters
Bug: 142705928
Test: atest ccodec_unit_test:CCodecConfigTest
Change-Id: Ib3fe12d8e6f6785567c9f0ebd74e8ffce6a84322
diff --git a/media/codec2/sfplugin/CCodec.cpp b/media/codec2/sfplugin/CCodec.cpp
index 39263f9..cc07f29 100644
--- a/media/codec2/sfplugin/CCodec.cpp
+++ b/media/codec2/sfplugin/CCodec.cpp
@@ -668,7 +668,7 @@
// initialize config here in case setParameters is called prior to configure
Mutexed<std::unique_ptr<Config>>::Locked configLocked(mConfig);
const std::unique_ptr<Config> &config = *configLocked;
- status_t err = config->initialize(mClient, comp);
+ status_t err = config->initialize(mClient->getParamReflector(), comp);
if (err != OK) {
ALOGW("Failed to initialize configuration support");
// TODO: report error once we complete implementation.
@@ -884,6 +884,13 @@
}
}
+ int32_t subscribeToAllVendorParams;
+ if (msg->findInt32("x-*", &subscribeToAllVendorParams) && subscribeToAllVendorParams) {
+ if (config->subscribeToAllVendorParams(comp, C2_MAY_BLOCK) != OK) {
+ ALOGD("[%s] Failed to subscribe to all vendor params", comp->getName().c_str());
+ }
+ }
+
std::vector<std::unique_ptr<C2Param>> configUpdate;
// NOTE: We used to ignore "video-bitrate" at configure; replicate
// the behavior here.
@@ -1192,7 +1199,7 @@
// we are now using surface - apply default color aspects to input format - as well as
// get dataspace
- bool inputFormatChanged = config->updateFormats(config->IS_INPUT);
+ bool inputFormatChanged = config->updateFormats(Config::IS_INPUT);
ALOGD("input format %s to %s",
inputFormatChanged ? "changed" : "unchanged",
config->mInputFormat->debugString().c_str());
@@ -1207,7 +1214,7 @@
if (err != OK) {
// undo input format update
config->mUsingSurface = false;
- (void)config->updateFormats(config->IS_INPUT);
+ (void)config->updateFormats(Config::IS_INPUT);
return err;
}
config->mInputSurface = surface;
@@ -1617,7 +1624,8 @@
* Handle input surface parameters
*/
if ((config->mDomain & (Config::IS_VIDEO | Config::IS_IMAGE))
- && (config->mDomain & Config::IS_ENCODER) && config->mInputSurface && config->mISConfig) {
+ && (config->mDomain & Config::IS_ENCODER)
+ && config->mInputSurface && config->mISConfig) {
(void)params->findInt64(PARAMETER_KEY_OFFSET_TIME, &config->mISConfig->mTimeOffsetUs);
if (params->findInt64("skip-frames-before", &config->mISConfig->mStartAtUs)) {