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

Commit b3361ebd authored by Treehugger Robot's avatar Treehugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Do not create Codec2Client when IConfigurable is not accessible" into udc-dev am: 4d9b2dab

parents db1df361 4d9b2dab
Loading
Loading
Loading
Loading
+7 −10
Original line number Diff line number Diff line
@@ -610,16 +610,9 @@ struct Codec2Client::Component::OutputBufferQueue :

// Codec2Client
Codec2Client::Codec2Client(sp<Base> const& base,
                           sp<IConfigurable> const& configurable,
                           size_t serviceIndex)
      : Configurable{
            [base]() -> sp<IConfigurable> {
                Return<sp<IConfigurable>> transResult =
                        base->getConfigurable();
                return transResult.isOk() ?
                        static_cast<sp<IConfigurable>>(transResult) :
                        nullptr;
            }()
        },
      : Configurable{configurable},
        mBase1_0{base},
        mBase1_1{Base1_1::castFrom(base)},
        mBase1_2{Base1_2::castFrom(base)},
@@ -1003,7 +996,11 @@ std::shared_ptr<Codec2Client> Codec2Client::_CreateFromIndex(size_t index) {
    CHECK(baseStore) << "Codec2 service \"" << name << "\""
                        " inaccessible for unknown reasons.";
    LOG(VERBOSE) << "Client to Codec2 service \"" << name << "\" created";
    return std::make_shared<Codec2Client>(baseStore, index);
    Return<sp<IConfigurable>> transResult = baseStore->getConfigurable();
    CHECK(transResult.isOk()) << "Codec2 service \"" << name << "\""
                                "does not have IConfigurable.";
    sp<IConfigurable> configurable = static_cast<sp<IConfigurable>>(transResult);
    return std::make_shared<Codec2Client>(baseStore, configurable, index);
}

c2_status_t Codec2Client::ForAllServices(
+7 −2
Original line number Diff line number Diff line
@@ -146,6 +146,8 @@ struct Codec2Client : public Codec2ConfigurableClient {
    typedef ::android::hardware::media::c2::V1_2::IComponentStore Base1_2;
    typedef Base1_0 Base;

    typedef ::android::hardware::media::c2::V1_0::IConfigurable IConfigurable;

    struct Listener;

    typedef Codec2ConfigurableClient Configurable;
@@ -230,8 +232,11 @@ struct Codec2Client : public Codec2ConfigurableClient {
    static std::shared_ptr<InputSurface> CreateInputSurface(
            char const* serviceName = nullptr);

    // base cannot be null.
    Codec2Client(sp<Base> const& base, size_t serviceIndex);
    // base and/or configurable cannot be null.
    Codec2Client(
            sp<Base> const& base,
            sp<IConfigurable> const& configurable,
            size_t serviceIndex);

protected:
    sp<Base1_0> mBase1_0;