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

Commit c9b4ca0d authored by Lajos Molnar's avatar Lajos Molnar
Browse files

codec2: signal aliases in XML vs. C2Store

AOSP codec aliases are meant to imitate OMX codec names, and this
is best done through XML.

Bug: 119631295
Bug: 112370870
Change-Id: I373db2f4c211d55056d397eb5a1dec8a37c60306
parent db5751f2
Loading
Loading
Loading
Loading
+94 −121
Original line number Original line Diff line number Diff line
@@ -517,7 +517,6 @@ private:
         *
         *
         * \note Only used by ComponentLoader.
         * \note Only used by ComponentLoader.
         *
         *
         * \param alias[in]   module alias
         * \param libPath[in] library path
         * \param libPath[in] library path
         *
         *
         * \retval C2_OK        the component module has been successfully loaded
         * \retval C2_OK        the component module has been successfully loaded
@@ -527,7 +526,7 @@ private:
         * \retval C2_REFUSED   permission denied to load the component module (unexpected)
         * \retval C2_REFUSED   permission denied to load the component module (unexpected)
         * \retval C2_TIMED_OUT could not load the module within the time limit (unexpected)
         * \retval C2_TIMED_OUT could not load the module within the time limit (unexpected)
         */
         */
        c2_status_t init(std::string alias, std::string libPath);
        c2_status_t init(std::string libPath);


        virtual ~ComponentModule() override;
        virtual ~ComponentModule() override;


@@ -570,7 +569,7 @@ private:
            std::shared_ptr<ComponentModule> localModule = mModule.lock();
            std::shared_ptr<ComponentModule> localModule = mModule.lock();
            if (localModule == nullptr) {
            if (localModule == nullptr) {
                localModule = std::make_shared<ComponentModule>();
                localModule = std::make_shared<ComponentModule>();
                res = localModule->init(mAlias, mLibPath);
                res = localModule->init(mLibPath);
                if (res == C2_OK) {
                if (res == C2_OK) {
                    mModule = localModule;
                    mModule = localModule;
                }
                }
@@ -582,13 +581,12 @@ private:
        /**
        /**
         * Creates a component loader for a specific library path (or name).
         * Creates a component loader for a specific library path (or name).
         */
         */
        ComponentLoader(std::string alias, std::string libPath)
        ComponentLoader(std::string libPath)
            : mAlias(alias), mLibPath(libPath) {}
            : mLibPath(libPath) {}


    private:
    private:
        std::mutex mMutex; ///< mutex guarding the module
        std::mutex mMutex; ///< mutex guarding the module
        std::weak_ptr<ComponentModule> mModule; ///< weak reference to the loaded module
        std::weak_ptr<ComponentModule> mModule; ///< weak reference to the loaded module
        std::string mAlias; ///< component alias
        std::string mLibPath; ///< library path
        std::string mLibPath; ///< library path
    };
    };


@@ -624,9 +622,10 @@ private:
    };
    };


    /**
    /**
     * Retrieves the component loader for a component.
     * Retrieves the component module for a component.
     *
     *
     * \return a non-ref-holding pointer to the component loader.
     * \param module pointer to a shared_pointer where the component module will be stored on
     *               success.
     *
     *
     * \retval C2_OK        the component loader has been successfully retrieved
     * \retval C2_OK        the component loader has been successfully retrieved
     * \retval C2_NO_MEMORY not enough memory to locate the component loader
     * \retval C2_NO_MEMORY not enough memory to locate the component loader
@@ -640,16 +639,25 @@ private:
     *                      component but some components could not be loaded due to lack of
     *                      component but some components could not be loaded due to lack of
     *                      permissions)
     *                      permissions)
     */
     */
    c2_status_t findComponent(C2String name, ComponentLoader **loader);
    c2_status_t findComponent(C2String name, std::shared_ptr<ComponentModule> *module);

    /**
     * Loads each component module and discover its contents.
     */
    void visitComponents();

    std::mutex mMutex; ///< mutex guarding the component lists during construction
    bool mVisited; ///< component modules visited
    std::map<C2String, ComponentLoader> mComponents; ///< path -> component module
    std::map<C2String, C2String> mComponentNameToPath; ///< name -> path
    std::vector<std::shared_ptr<const C2Component::Traits>> mComponentList;


    std::map<C2String, ComponentLoader> mComponents; ///< map of name -> components
    std::vector<C2String> mComponentsList; ///< list of components
    std::shared_ptr<C2ReflectorHelper> mReflector;
    std::shared_ptr<C2ReflectorHelper> mReflector;
    Interface mInterface;
    Interface mInterface;
};
};


c2_status_t C2PlatformComponentStore::ComponentModule::init(
c2_status_t C2PlatformComponentStore::ComponentModule::init(
        std::string alias, std::string libPath) {
        std::string libPath) {
    ALOGV("in %s", __func__);
    ALOGV("in %s", __func__);
    ALOGV("loading dll");
    ALOGV("loading dll");
    mLibHandle = dlopen(libPath.c_str(), RTLD_NOW|RTLD_NODELETE);
    mLibHandle = dlopen(libPath.c_str(), RTLD_NOW|RTLD_NODELETE);
@@ -684,10 +692,7 @@ c2_status_t C2PlatformComponentStore::ComponentModule::init(


    std::shared_ptr<C2Component::Traits> traits(new (std::nothrow) C2Component::Traits);
    std::shared_ptr<C2Component::Traits> traits(new (std::nothrow) C2Component::Traits);
    if (traits) {
    if (traits) {
        if (alias != intf->getName()) {
        traits->name = intf->getName();
            ALOGV("%s is alias to %s", alias.c_str(), intf->getName().c_str());
        }
        traits->name = alias; // TODO: this needs to be intf->getName() once aliases are supported


        C2ComponentKindSetting kind;
        C2ComponentKindSetting kind;
        C2ComponentDomainSetting domain;
        C2ComponentDomainSetting domain;
@@ -825,82 +830,45 @@ std::shared_ptr<const C2Component::Traits> C2PlatformComponentStore::ComponentMo
}
}


C2PlatformComponentStore::C2PlatformComponentStore()
C2PlatformComponentStore::C2PlatformComponentStore()
    : mReflector(std::make_shared<C2ReflectorHelper>()),
    : mVisited(false),
      mReflector(std::make_shared<C2ReflectorHelper>()),
      mInterface(mReflector) {
      mInterface(mReflector) {


    auto emplace = [this](const char *alias, const char *libPath) {
    auto emplace = [this](const char *libPath) {
        // ComponentLoader is neither copiable nor movable, so it must be
        mComponents.emplace(libPath, libPath);
        // constructed in-place. Now ComponentLoader takes two arguments in
        // constructor, so we need to use piecewise_construct to achieve this
        // behavior.
        mComponents.emplace(
                std::piecewise_construct,
                std::forward_as_tuple(alias),
                std::forward_as_tuple(alias, libPath));
        mComponentsList.emplace_back(alias);
    };
    };

    // TODO: move this also into a .so so it can be updated
    // TODO: move this also into a .so so it can be updated
    emplace("c2.android.avc.decoder", "libcodec2_soft_avcdec.so");
    emplace("libcodec2_soft_aacdec.so");
    emplace("c2.android.avc.encoder", "libcodec2_soft_avcenc.so");
    emplace("libcodec2_soft_aacenc.so");
    emplace("c2.android.aac.decoder", "libcodec2_soft_aacdec.so");
    emplace("libcodec2_soft_amrnbdec.so");
    emplace("c2.android.aac.encoder", "libcodec2_soft_aacenc.so");
    emplace("libcodec2_soft_amrnbenc.so");
    emplace("c2.android.amrnb.decoder", "libcodec2_soft_amrnbdec.so");
    emplace("libcodec2_soft_amrwbdec.so");
    emplace("c2.android.amrnb.encoder", "libcodec2_soft_amrnbenc.so");
    emplace("libcodec2_soft_amrwbenc.so");
    emplace("c2.android.amrwb.decoder", "libcodec2_soft_amrwbdec.so");
    emplace("libcodec2_soft_av1dec.so");
    emplace("c2.android.amrwb.encoder", "libcodec2_soft_amrwbenc.so");
    emplace("libcodec2_soft_avcdec.so");
    emplace("c2.android.hevc.decoder", "libcodec2_soft_hevcdec.so");
    emplace("libcodec2_soft_avcenc.so");
    emplace("c2.android.g711.alaw.decoder", "libcodec2_soft_g711alawdec.so");
    emplace("libcodec2_soft_flacdec.so");
    emplace("c2.android.g711.mlaw.decoder", "libcodec2_soft_g711mlawdec.so");
    emplace("libcodec2_soft_flacenc.so");
    emplace("c2.android.mpeg2.decoder", "libcodec2_soft_mpeg2dec.so");
    emplace("libcodec2_soft_g711alawdec.so");
    emplace("c2.android.h263.decoder", "libcodec2_soft_h263dec.so");
    emplace("libcodec2_soft_g711mlawdec.so");
    emplace("c2.android.h263.encoder", "libcodec2_soft_h263enc.so");
    emplace("libcodec2_soft_gsmdec.so");
    emplace("c2.android.mpeg4.decoder", "libcodec2_soft_mpeg4dec.so");
    emplace("libcodec2_soft_h263dec.so");
    emplace("c2.android.mpeg4.encoder", "libcodec2_soft_mpeg4enc.so");
    emplace("libcodec2_soft_h263enc.so");
    emplace("c2.android.mp3.decoder", "libcodec2_soft_mp3dec.so");
    emplace("libcodec2_soft_hevcdec.so");
    emplace("c2.android.vorbis.decoder", "libcodec2_soft_vorbisdec.so");
    emplace("libcodec2_soft_mp3dec.so");
    emplace("c2.android.opus.decoder", "libcodec2_soft_opusdec.so");
    emplace("libcodec2_soft_mpeg2dec.so");
    emplace("c2.android.opus.encoder", "libcodec2_soft_opusenc.so");
    emplace("libcodec2_soft_mpeg4dec.so");
    emplace("c2.android.vp8.decoder", "libcodec2_soft_vp8dec.so");
    emplace("libcodec2_soft_mpeg4enc.so");
    emplace("c2.android.vp9.decoder", "libcodec2_soft_vp9dec.so");
    emplace("libcodec2_soft_opusdec.so");
    emplace("c2.android.vp8.encoder", "libcodec2_soft_vp8enc.so");
    emplace("libcodec2_soft_opusenc.so");
    emplace("c2.android.vp9.encoder", "libcodec2_soft_vp9enc.so");
    emplace("libcodec2_soft_rawdec.so");
    emplace("c2.android.av1.decoder", "libcodec2_soft_av1dec.so");
    emplace("libcodec2_soft_vorbisdec.so");
    emplace("c2.android.raw.decoder", "libcodec2_soft_rawdec.so");
    emplace("libcodec2_soft_vp8dec.so");
    emplace("c2.android.flac.decoder", "libcodec2_soft_flacdec.so");
    emplace("libcodec2_soft_vp8enc.so");
    emplace("c2.android.flac.encoder", "libcodec2_soft_flacenc.so");
    emplace("libcodec2_soft_vp9dec.so");
    emplace("c2.android.gsm.decoder", "libcodec2_soft_gsmdec.so");
    emplace("libcodec2_soft_vp9enc.so");
    emplace("c2.android.xaac.decoder", "libcodec2_soft_xaacdec.so");
    emplace("libcodec2_soft_xaacdec.so");

    // "Aliases"
    // TODO: use aliases proper from C2Component::Traits
    emplace("OMX.google.h264.decoder", "libcodec2_soft_avcdec.so");
    emplace("OMX.google.h264.encoder", "libcodec2_soft_avcenc.so");
    emplace("OMX.google.aac.decoder", "libcodec2_soft_aacdec.so");
    emplace("OMX.google.aac.encoder", "libcodec2_soft_aacenc.so");
    emplace("OMX.google.amrnb.decoder", "libcodec2_soft_amrnbdec.so");
    emplace("OMX.google.amrnb.encoder", "libcodec2_soft_amrnbenc.so");
    emplace("OMX.google.amrwb.decoder", "libcodec2_soft_amrwbdec.so");
    emplace("OMX.google.amrwb.encoder", "libcodec2_soft_amrwbenc.so");
    emplace("OMX.google.hevc.decoder", "libcodec2_soft_hevcdec.so");
    emplace("OMX.google.g711.alaw.decoder", "libcodec2_soft_g711alawdec.so");
    emplace("OMX.google.g711.mlaw.decoder", "libcodec2_soft_g711mlawdec.so");
    emplace("OMX.google.mpeg2.decoder", "libcodec2_soft_mpeg2dec.so");
    emplace("OMX.google.h263.decoder", "libcodec2_soft_h263dec.so");
    emplace("OMX.google.h263.encoder", "libcodec2_soft_h263enc.so");
    emplace("OMX.google.mpeg4.decoder", "libcodec2_soft_mpeg4dec.so");
    emplace("OMX.google.mpeg4.encoder", "libcodec2_soft_mpeg4enc.so");
    emplace("OMX.google.mp3.decoder", "libcodec2_soft_mp3dec.so");
    emplace("OMX.google.vorbis.decoder", "libcodec2_soft_vorbisdec.so");
    emplace("OMX.google.opus.decoder", "libcodec2_soft_opusdec.so");
    emplace("OMX.google.vp8.decoder", "libcodec2_soft_vp8dec.so");
    emplace("OMX.google.vp9.decoder", "libcodec2_soft_vp9dec.so");
    emplace("OMX.google.vp8.encoder", "libcodec2_soft_vp8enc.so");
    emplace("OMX.google.vp9.encoder", "libcodec2_soft_vp9enc.so");
    emplace("OMX.google.raw.decoder", "libcodec2_soft_rawdec.so");
    emplace("OMX.google.flac.decoder", "libcodec2_soft_flacdec.so");
    emplace("OMX.google.flac.encoder", "libcodec2_soft_flacenc.so");
    emplace("OMX.google.gsm.decoder", "libcodec2_soft_gsmdec.so");
    emplace("OMX.google.xaac.decoder", "libcodec2_soft_xaacdec.so");
}
}


c2_status_t C2PlatformComponentStore::copyBuffer(
c2_status_t C2PlatformComponentStore::copyBuffer(
@@ -923,48 +891,57 @@ c2_status_t C2PlatformComponentStore::config_sm(
    return mInterface.config(params, C2_MAY_BLOCK, failures);
    return mInterface.config(params, C2_MAY_BLOCK, failures);
}
}


std::vector<std::shared_ptr<const C2Component::Traits>> C2PlatformComponentStore::listComponents() {
void C2PlatformComponentStore::visitComponents() {
    // This method SHALL return within 500ms.
    std::lock_guard<std::mutex> lock(mMutex);
    std::vector<std::shared_ptr<const C2Component::Traits>> list;
    if (mVisited) {
    for (const C2String &alias : mComponentsList) {
        return;
        ComponentLoader &loader = mComponents.at(alias);
    }
    for (auto &pathAndLoader : mComponents) {
        const C2String &path = pathAndLoader.first;
        ComponentLoader &loader = pathAndLoader.second;
        std::shared_ptr<ComponentModule> module;
        std::shared_ptr<ComponentModule> module;
        c2_status_t res = loader.fetchModule(&module);
        if (loader.fetchModule(&module) == C2_OK) {
        if (res == C2_OK) {
            std::shared_ptr<const C2Component::Traits> traits = module->getTraits();
            std::shared_ptr<const C2Component::Traits> traits = module->getTraits();
            if (traits) {
            if (traits) {
                list.push_back(traits);
                mComponentList.push_back(traits);
                mComponentNameToPath.emplace(traits->name, path);
                for (const C2String &alias : traits->aliases) {
                    mComponentNameToPath.emplace(alias, path);
                }
            }
            }
        }
        }
    }
    }
    return list;
    mVisited = true;
}
}


c2_status_t C2PlatformComponentStore::findComponent(C2String name, ComponentLoader **loader) {
std::vector<std::shared_ptr<const C2Component::Traits>> C2PlatformComponentStore::listComponents() {
    *loader = nullptr;
    // This method SHALL return within 500ms.
    auto pos = mComponents.find(name);
    visitComponents();
    // TODO: check aliases
    return mComponentList;
    if (pos == mComponents.end()) {
        return C2_NOT_FOUND;
}
}
    *loader = &pos->second;

    return C2_OK;
c2_status_t C2PlatformComponentStore::findComponent(
        C2String name, std::shared_ptr<ComponentModule> *module) {
    (*module).reset();
    visitComponents();

    auto pos = mComponentNameToPath.find(name);
    if (pos != mComponentNameToPath.end()) {
        return mComponents.at(pos->second).fetchModule(module);
    }
    return C2_NOT_FOUND;
}
}


c2_status_t C2PlatformComponentStore::createComponent(
c2_status_t C2PlatformComponentStore::createComponent(
        C2String name, std::shared_ptr<C2Component> *const component) {
        C2String name, std::shared_ptr<C2Component> *const component) {
    // This method SHALL return within 100ms.
    // This method SHALL return within 100ms.
    component->reset();
    component->reset();
    ComponentLoader *loader;
    c2_status_t res = findComponent(name, &loader);
    if (res == C2_OK) {
    std::shared_ptr<ComponentModule> module;
    std::shared_ptr<ComponentModule> module;
        res = loader->fetchModule(&module);
    c2_status_t res = findComponent(name, &module);
    if (res == C2_OK) {
    if (res == C2_OK) {
        // TODO: get a unique node ID
        // TODO: get a unique node ID
        res = module->createComponent(0, component);
        res = module->createComponent(0, component);
    }
    }
    }
    return res;
    return res;
}
}


@@ -972,16 +949,12 @@ c2_status_t C2PlatformComponentStore::createInterface(
        C2String name, std::shared_ptr<C2ComponentInterface> *const interface) {
        C2String name, std::shared_ptr<C2ComponentInterface> *const interface) {
    // This method SHALL return within 100ms.
    // This method SHALL return within 100ms.
    interface->reset();
    interface->reset();
    ComponentLoader *loader;
    c2_status_t res = findComponent(name, &loader);
    if (res == C2_OK) {
    std::shared_ptr<ComponentModule> module;
    std::shared_ptr<ComponentModule> module;
        res = loader->fetchModule(&module);
    c2_status_t res = findComponent(name, &module);
    if (res == C2_OK) {
    if (res == C2_OK) {
        // TODO: get a unique node ID
        // TODO: get a unique node ID
        res = module->createInterface(0, interface);
        res = module->createInterface(0, interface);
    }
    }
    }
    return res;
    return res;
}
}


+14 −0
Original line number Original line Diff line number Diff line
@@ -17,51 +17,61 @@
<Included>
<Included>
    <Decoders>
    <Decoders>
        <MediaCodec name="c2.android.mp3.decoder" type="audio/mpeg">
        <MediaCodec name="c2.android.mp3.decoder" type="audio/mpeg">
            <Alias name="OMX.google.mp3.decoder" />
            <Limit name="channel-count" max="2" />
            <Limit name="channel-count" max="2" />
            <Limit name="sample-rate" ranges="8000,11025,12000,16000,22050,24000,32000,44100,48000" />
            <Limit name="sample-rate" ranges="8000,11025,12000,16000,22050,24000,32000,44100,48000" />
            <Limit name="bitrate" range="8000-320000" />
            <Limit name="bitrate" range="8000-320000" />
        </MediaCodec>
        </MediaCodec>
        <MediaCodec name="c2.android.amrnb.decoder" type="audio/3gpp">
        <MediaCodec name="c2.android.amrnb.decoder" type="audio/3gpp">
            <Alias name="OMX.google.amrnb.decoder" />
            <Limit name="channel-count" max="1" />
            <Limit name="channel-count" max="1" />
            <Limit name="sample-rate" ranges="8000" />
            <Limit name="sample-rate" ranges="8000" />
            <Limit name="bitrate" range="4750-12200" />
            <Limit name="bitrate" range="4750-12200" />
        </MediaCodec>
        </MediaCodec>
        <MediaCodec name="c2.android.amrwb.decoder" type="audio/amr-wb">
        <MediaCodec name="c2.android.amrwb.decoder" type="audio/amr-wb">
            <Alias name="OMX.google.amrwb.decoder" />
            <Limit name="channel-count" max="1" />
            <Limit name="channel-count" max="1" />
            <Limit name="sample-rate" ranges="16000" />
            <Limit name="sample-rate" ranges="16000" />
            <Limit name="bitrate" range="6600-23850" />
            <Limit name="bitrate" range="6600-23850" />
        </MediaCodec>
        </MediaCodec>
        <MediaCodec name="c2.android.aac.decoder" type="audio/mp4a-latm">
        <MediaCodec name="c2.android.aac.decoder" type="audio/mp4a-latm">
            <Alias name="OMX.google.aac.decoder" />
            <Limit name="channel-count" max="8" />
            <Limit name="channel-count" max="8" />
            <Limit name="sample-rate" ranges="7350,8000,11025,12000,16000,22050,24000,32000,44100,48000" />
            <Limit name="sample-rate" ranges="7350,8000,11025,12000,16000,22050,24000,32000,44100,48000" />
            <Limit name="bitrate" range="8000-960000" />
            <Limit name="bitrate" range="8000-960000" />
        </MediaCodec>
        </MediaCodec>
        <MediaCodec name="c2.android.g711.alaw.decoder" type="audio/g711-alaw">
        <MediaCodec name="c2.android.g711.alaw.decoder" type="audio/g711-alaw">
            <Alias name="OMX.google.g711.alaw.decoder" />
            <Limit name="channel-count" max="1" />
            <Limit name="channel-count" max="1" />
            <Limit name="sample-rate" ranges="8000-48000" />
            <Limit name="sample-rate" ranges="8000-48000" />
            <Limit name="bitrate" range="64000" />
            <Limit name="bitrate" range="64000" />
        </MediaCodec>
        </MediaCodec>
        <MediaCodec name="c2.android.g711.mlaw.decoder" type="audio/g711-mlaw">
        <MediaCodec name="c2.android.g711.mlaw.decoder" type="audio/g711-mlaw">
            <Alias name="OMX.google.g711.mlaw.decoder" />
            <Limit name="channel-count" max="1" />
            <Limit name="channel-count" max="1" />
            <Limit name="sample-rate" ranges="8000-48000" />
            <Limit name="sample-rate" ranges="8000-48000" />
            <Limit name="bitrate" range="64000" />
            <Limit name="bitrate" range="64000" />
        </MediaCodec>
        </MediaCodec>
        <MediaCodec name="c2.android.vorbis.decoder" type="audio/vorbis">
        <MediaCodec name="c2.android.vorbis.decoder" type="audio/vorbis">
            <Alias name="OMX.google.vorbis.decoder" />
            <Limit name="channel-count" max="8" />
            <Limit name="channel-count" max="8" />
            <Limit name="sample-rate" ranges="8000-96000" />
            <Limit name="sample-rate" ranges="8000-96000" />
            <Limit name="bitrate" range="32000-500000" />
            <Limit name="bitrate" range="32000-500000" />
        </MediaCodec>
        </MediaCodec>
        <MediaCodec name="c2.android.opus.decoder" type="audio/opus">
        <MediaCodec name="c2.android.opus.decoder" type="audio/opus">
            <Alias name="OMX.google.opus.decoder" />
            <Limit name="channel-count" max="8" />
            <Limit name="channel-count" max="8" />
            <Limit name="sample-rate" ranges="48000" />
            <Limit name="sample-rate" ranges="48000" />
            <Limit name="bitrate" range="6000-510000" />
            <Limit name="bitrate" range="6000-510000" />
        </MediaCodec>
        </MediaCodec>
        <MediaCodec name="c2.android.raw.decoder" type="audio/raw">
        <MediaCodec name="c2.android.raw.decoder" type="audio/raw">
            <Alias name="OMX.google.raw.decoder" />
            <Limit name="channel-count" max="8" />
            <Limit name="channel-count" max="8" />
            <Limit name="sample-rate" ranges="8000-96000" />
            <Limit name="sample-rate" ranges="8000-96000" />
            <Limit name="bitrate" range="1-10000000" />
            <Limit name="bitrate" range="1-10000000" />
        </MediaCodec>
        </MediaCodec>
        <MediaCodec name="c2.android.flac.decoder" type="audio/flac">
        <MediaCodec name="c2.android.flac.decoder" type="audio/flac">
            <Alias name="OMX.google.flac.decoder" />
            <Limit name="channel-count" max="8" />
            <Limit name="channel-count" max="8" />
            <Limit name="sample-rate" ranges="1-655350" />
            <Limit name="sample-rate" ranges="1-655350" />
            <Limit name="bitrate" range="1-21000000" />
            <Limit name="bitrate" range="1-21000000" />
@@ -69,24 +79,28 @@
    </Decoders>
    </Decoders>
    <Encoders>
    <Encoders>
        <MediaCodec name="c2.android.aac.encoder" type="audio/mp4a-latm">
        <MediaCodec name="c2.android.aac.encoder" type="audio/mp4a-latm">
            <Alias name="OMX.google.aac.decoder" />
            <Limit name="channel-count" max="6" />
            <Limit name="channel-count" max="6" />
            <Limit name="sample-rate" ranges="8000,11025,12000,16000,22050,24000,32000,44100,48000" />
            <Limit name="sample-rate" ranges="8000,11025,12000,16000,22050,24000,32000,44100,48000" />
            <!-- also may support 64000, 88200  and 96000 Hz -->
            <!-- also may support 64000, 88200  and 96000 Hz -->
            <Limit name="bitrate" range="8000-960000" />
            <Limit name="bitrate" range="8000-960000" />
        </MediaCodec>
        </MediaCodec>
        <MediaCodec name="c2.android.amrnb.encoder" type="audio/3gpp">
        <MediaCodec name="c2.android.amrnb.encoder" type="audio/3gpp">
            <Alias name="OMX.google.amrnb.decoder" />
            <Limit name="channel-count" max="1" />
            <Limit name="channel-count" max="1" />
            <Limit name="sample-rate" ranges="8000" />
            <Limit name="sample-rate" ranges="8000" />
            <Limit name="bitrate" range="4750-12200" />
            <Limit name="bitrate" range="4750-12200" />
            <Feature name="bitrate-modes" value="CBR" />
            <Feature name="bitrate-modes" value="CBR" />
        </MediaCodec>
        </MediaCodec>
        <MediaCodec name="c2.android.amrwb.encoder" type="audio/amr-wb">
        <MediaCodec name="c2.android.amrwb.encoder" type="audio/amr-wb">
            <Alias name="OMX.google.amrwb.decoder" />
            <Limit name="channel-count" max="1" />
            <Limit name="channel-count" max="1" />
            <Limit name="sample-rate" ranges="16000" />
            <Limit name="sample-rate" ranges="16000" />
            <Limit name="bitrate" range="6600-23850" />
            <Limit name="bitrate" range="6600-23850" />
            <Feature name="bitrate-modes" value="CBR" />
            <Feature name="bitrate-modes" value="CBR" />
        </MediaCodec>
        </MediaCodec>
        <MediaCodec name="c2.android.flac.encoder" type="audio/flac">
        <MediaCodec name="c2.android.flac.encoder" type="audio/flac">
            <Alias name="OMX.google.flac.decoder" />
            <Limit name="channel-count" max="2" />
            <Limit name="channel-count" max="2" />
            <Limit name="sample-rate" ranges="1-655350" />
            <Limit name="sample-rate" ranges="1-655350" />
            <Limit name="bitrate" range="1-21000000" />
            <Limit name="bitrate" range="1-21000000" />
+1 −0
Original line number Original line Diff line number Diff line
@@ -17,6 +17,7 @@
<Included>
<Included>
    <Decoders>
    <Decoders>
        <MediaCodec name="c2.android.gsm.decoder" type="audio/gsm">
        <MediaCodec name="c2.android.gsm.decoder" type="audio/gsm">
            <Alias name="OMX.google.gsm.decoder" />
            <Limit name="channel-count" max="1" />
            <Limit name="channel-count" max="1" />
            <Limit name="sample-rate" ranges="8000" />
            <Limit name="sample-rate" ranges="8000" />
            <Limit name="bitrate" range="13000" />
            <Limit name="bitrate" range="13000" />
+1 −0
Original line number Original line Diff line number Diff line
@@ -17,6 +17,7 @@
<Included>
<Included>
    <Decoders>
    <Decoders>
        <MediaCodec name="c2.android.mpeg2.decoder" type="video/mpeg2">
        <MediaCodec name="c2.android.mpeg2.decoder" type="video/mpeg2">
            <Alias name="OMX.google.mpeg2.decoder" />
            <!-- profiles and levels:  ProfileMain : LevelHL -->
            <!-- profiles and levels:  ProfileMain : LevelHL -->
            <Limit name="size" min="16x16" max="1920x1088" />
            <Limit name="size" min="16x16" max="1920x1088" />
            <Limit name="alignment" value="2x2" />
            <Limit name="alignment" value="2x2" />
+11 −0
Original line number Original line Diff line number Diff line
@@ -17,6 +17,7 @@
<Included>
<Included>
    <Decoders>
    <Decoders>
        <MediaCodec name="c2.android.mpeg4.decoder" type="video/mp4v-es">
        <MediaCodec name="c2.android.mpeg4.decoder" type="video/mp4v-es">
            <Alias name="OMX.google.mpeg4.decoder" />
            <!-- profiles and levels:  ProfileSimple : Level3 -->
            <!-- profiles and levels:  ProfileSimple : Level3 -->
            <Limit name="size" min="2x2" max="352x288" />
            <Limit name="size" min="2x2" max="352x288" />
            <Limit name="alignment" value="2x2" />
            <Limit name="alignment" value="2x2" />
@@ -26,6 +27,7 @@
            <Feature name="adaptive-playback" />
            <Feature name="adaptive-playback" />
        </MediaCodec>
        </MediaCodec>
        <MediaCodec name="c2.android.h263.decoder" type="video/3gpp">
        <MediaCodec name="c2.android.h263.decoder" type="video/3gpp">
            <Alias name="OMX.google.h263.decoder" />
            <!-- profiles and levels:  ProfileBaseline : Level30, ProfileBaseline : Level45
            <!-- profiles and levels:  ProfileBaseline : Level30, ProfileBaseline : Level45
                    ProfileISWV2 : Level30, ProfileISWV2 : Level45 -->
                    ProfileISWV2 : Level30, ProfileISWV2 : Level45 -->
            <Limit name="size" min="2x2" max="352x288" />
            <Limit name="size" min="2x2" max="352x288" />
@@ -34,6 +36,7 @@
            <Feature name="adaptive-playback" />
            <Feature name="adaptive-playback" />
        </MediaCodec>
        </MediaCodec>
        <MediaCodec name="c2.android.avc.decoder" type="video/avc">
        <MediaCodec name="c2.android.avc.decoder" type="video/avc">
            <Alias name="OMX.google.h264.decoder" />
            <!-- profiles and levels:  ProfileHigh : Level52 -->
            <!-- profiles and levels:  ProfileHigh : Level52 -->
            <Limit name="size" min="2x2" max="4080x4080" />
            <Limit name="size" min="2x2" max="4080x4080" />
            <Limit name="alignment" value="2x2" />
            <Limit name="alignment" value="2x2" />
@@ -44,6 +47,7 @@
            <Feature name="adaptive-playback" />
            <Feature name="adaptive-playback" />
        </MediaCodec>
        </MediaCodec>
        <MediaCodec name="c2.android.hevc.decoder" type="video/hevc">
        <MediaCodec name="c2.android.hevc.decoder" type="video/hevc">
            <Alias name="OMX.google.hevc.decoder" />
            <!-- profiles and levels:  ProfileMain : MainTierLevel51 -->
            <!-- profiles and levels:  ProfileMain : MainTierLevel51 -->
            <Limit name="size" min="2x2" max="4096x4096" />
            <Limit name="size" min="2x2" max="4096x4096" />
            <Limit name="alignment" value="2x2" />
            <Limit name="alignment" value="2x2" />
@@ -54,6 +58,7 @@
            <Feature name="adaptive-playback" />
            <Feature name="adaptive-playback" />
        </MediaCodec>
        </MediaCodec>
        <MediaCodec name="c2.android.vp8.decoder" type="video/x-vnd.on2.vp8">
        <MediaCodec name="c2.android.vp8.decoder" type="video/x-vnd.on2.vp8">
            <Alias name="OMX.google.vp8.decoder" />
            <Limit name="size" min="2x2" max="2048x2048" />
            <Limit name="size" min="2x2" max="2048x2048" />
            <Limit name="alignment" value="2x2" />
            <Limit name="alignment" value="2x2" />
            <Limit name="block-size" value="16x16" />
            <Limit name="block-size" value="16x16" />
@@ -63,6 +68,7 @@
            <Feature name="adaptive-playback" />
            <Feature name="adaptive-playback" />
        </MediaCodec>
        </MediaCodec>
        <MediaCodec name="c2.android.vp9.decoder" type="video/x-vnd.on2.vp9">
        <MediaCodec name="c2.android.vp9.decoder" type="video/x-vnd.on2.vp9">
            <Alias name="OMX.google.vp9.decoder" />
            <Limit name="size" min="2x2" max="2048x2048" />
            <Limit name="size" min="2x2" max="2048x2048" />
            <Limit name="alignment" value="2x2" />
            <Limit name="alignment" value="2x2" />
            <Limit name="block-size" value="16x16" />
            <Limit name="block-size" value="16x16" />
@@ -84,12 +90,14 @@


    <Encoders>
    <Encoders>
        <MediaCodec name="c2.android.h263.encoder" type="video/3gpp">
        <MediaCodec name="c2.android.h263.encoder" type="video/3gpp">
            <Alias name="OMX.google.h263.encoder" />
            <!-- profiles and levels:  ProfileBaseline : Level45 -->
            <!-- profiles and levels:  ProfileBaseline : Level45 -->
            <Limit name="size" min="176x144" max="176x144" />
            <Limit name="size" min="176x144" max="176x144" />
            <Limit name="alignment" value="16x16" />
            <Limit name="alignment" value="16x16" />
            <Limit name="bitrate" range="1-128000" />
            <Limit name="bitrate" range="1-128000" />
        </MediaCodec>
        </MediaCodec>
        <MediaCodec name="c2.android.avc.encoder" type="video/avc">
        <MediaCodec name="c2.android.avc.encoder" type="video/avc">
            <Alias name="OMX.google.h264.encoder" />
            <!-- profiles and levels:  ProfileBaseline : Level41 -->
            <!-- profiles and levels:  ProfileBaseline : Level41 -->
            <Limit name="size" min="16x16" max="2048x2048" />
            <Limit name="size" min="16x16" max="2048x2048" />
            <Limit name="alignment" value="2x2" />
            <Limit name="alignment" value="2x2" />
@@ -100,6 +108,7 @@
            <Feature name="intra-refresh" />
            <Feature name="intra-refresh" />
        </MediaCodec>
        </MediaCodec>
        <MediaCodec name="c2.android.mpeg4.encoder" type="video/mp4v-es">
        <MediaCodec name="c2.android.mpeg4.encoder" type="video/mp4v-es">
            <Alias name="OMX.google.mpeg4.encoder" />
            <!-- profiles and levels:  ProfileCore : Level2 -->
            <!-- profiles and levels:  ProfileCore : Level2 -->
            <Limit name="size" min="16x16" max="176x144" />
            <Limit name="size" min="16x16" max="176x144" />
            <Limit name="alignment" value="16x16" />
            <Limit name="alignment" value="16x16" />
@@ -108,6 +117,7 @@
            <Limit name="bitrate" range="1-64000" />
            <Limit name="bitrate" range="1-64000" />
        </MediaCodec>
        </MediaCodec>
        <MediaCodec name="c2.android.vp8.encoder" type="video/x-vnd.on2.vp8">
        <MediaCodec name="c2.android.vp8.encoder" type="video/x-vnd.on2.vp8">
            <Alias name="OMX.google.vp8.encoder" />
            <!-- profiles and levels:  ProfileMain : Level_Version0-3 -->
            <!-- profiles and levels:  ProfileMain : Level_Version0-3 -->
            <Limit name="size" min="2x2" max="2048x2048" />
            <Limit name="size" min="2x2" max="2048x2048" />
            <Limit name="alignment" value="2x2" />
            <Limit name="alignment" value="2x2" />
@@ -118,6 +128,7 @@
            <Feature name="bitrate-modes" value="VBR,CBR" />
            <Feature name="bitrate-modes" value="VBR,CBR" />
        </MediaCodec>
        </MediaCodec>
        <MediaCodec name="c2.android.vp9.encoder" type="video/x-vnd.on2.vp9">
        <MediaCodec name="c2.android.vp9.encoder" type="video/x-vnd.on2.vp9">
            <Alias name="OMX.google.vp9.encoder" />
            <!-- profiles and levels:  ProfileMain : Level_Version0-3 -->
            <!-- profiles and levels:  ProfileMain : Level_Version0-3 -->
            <Limit name="size" min="2x2" max="2048x2048" />
            <Limit name="size" min="2x2" max="2048x2048" />
            <Limit name="alignment" value="2x2" />
            <Limit name="alignment" value="2x2" />