Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8b569618 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge changes from topic "cherrypicker-L02600000954235185:N86800001257976348" into tm-dev

* changes:
  CCodec: enable query & config subscribed indices
  codec2 components: fix subscribed indices setter
parents d093bb08 4eea3f4e
Loading
Loading
Loading
Loading
+9 −1
Original line number Diff line number Diff line
@@ -28,6 +28,14 @@ namespace android {

/* SimpleInterface */

static C2R SubscribedParamIndicesSetter(
        bool mayBlock, C2InterfaceHelper::C2P<C2SubscribedParamIndicesTuning> &me) {
    (void)mayBlock;
    (void)me;

    return C2R::Ok();
}

SimpleInterface<void>::BaseParams::BaseParams(
        const std::shared_ptr<C2ReflectorHelper> &reflector,
        C2String name,
@@ -186,7 +194,7 @@ SimpleInterface<void>::BaseParams::BaseParams(
            .withDefault(C2SubscribedParamIndicesTuning::AllocShared(0u))
            .withFields({ C2F(mSubscribedParamIndices, m.values[0]).any(),
                          C2F(mSubscribedParamIndices, m.values).any() })
            .withSetter(Setter<C2SubscribedParamIndicesTuning>::NonStrictValuesWithNoDeps)
            .withSetter(SubscribedParamIndicesSetter)
            .build());

    /* TODO
+1 −0
Original line number Diff line number Diff line
@@ -209,6 +209,7 @@ struct Setter {
        return me.F(me.v.value).validatePossible(me.v.value);
    }

    // TODO(b/230146771): fix crash
    static C2R NonStrictValuesWithNoDeps(
            bool mayBlock, C2InterfaceHelper::C2P<type> &me) {
        (void)mayBlock;
+13 −5
Original line number Diff line number Diff line
@@ -20,6 +20,8 @@
#include <log/log.h>
#include <utils/NativeHandle.h>

#include <android-base/properties.h>

#include <C2Component.h>
#include <C2Param.h>
#include <util/C2InterfaceHelper.h>
@@ -1111,15 +1113,21 @@ status_t CCodecConfig::subscribeToConfigUpdate(
        const std::shared_ptr<Codec2Client::Configurable> &configurable,
        const std::vector<C2Param::Index> &indices,
        c2_blocking_t blocking) {
    static const int32_t kProductFirstApiLevel =
        base::GetIntProperty<int32_t>("ro.product.first_api_level", 0);
    static const int32_t kBoardApiLevel =
        base::GetIntProperty<int32_t>("ro.board.first_api_level", 0);
    static const int32_t kFirstApiLevel =
        (kBoardApiLevel != 0) ? kBoardApiLevel : kProductFirstApiLevel;
    mSubscribedIndices.insert(indices.begin(), indices.end());
    // TODO: enable this when components no longer crash on this config
    if (mSubscribedIndices.size() != mSubscribedIndicesSize && false) {
        std::vector<uint32_t> indices;
    if (mSubscribedIndices.size() != mSubscribedIndicesSize
            && kFirstApiLevel >= __ANDROID_API_T__) {
        std::vector<uint32_t> indicesVector;
        for (C2Param::Index ix : mSubscribedIndices) {
            indices.push_back(ix);
            indicesVector.push_back(ix);
        }
        std::unique_ptr<C2SubscribedParamIndicesTuning> subscribeTuning =
            C2SubscribedParamIndicesTuning::AllocUnique(indices);
            C2SubscribedParamIndicesTuning::AllocUnique(indicesVector);
        std::vector<std::unique_ptr<C2SettingResult>> results;
        c2_status_t c2Err = configurable->config({ subscribeTuning.get() }, blocking, &results);
        if (c2Err != C2_OK && c2Err != C2_BAD_INDEX) {