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

Commit 52f410e2 authored by Android (Google) Code Review's avatar Android (Google) Code Review
Browse files

Merge change Ifef6435a into eclair-mr2

* changes:
  Enable proper cleanup of OMX nodes managed through stagefright.
parents ed6dd2e6 fef6435a
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -36,6 +36,9 @@ struct OMXPluginBase {
            OMX_PTR appData,
            OMX_COMPONENTTYPE **component) = 0;

    virtual OMX_ERRORTYPE destroyComponentInstance(
            OMX_COMPONENTTYPE *component) = 0;

    virtual OMX_ERRORTYPE enumerateComponents(
            OMX_STRING name,
            size_t size,
+3 −2
Original line number Diff line number Diff line
@@ -26,6 +26,7 @@
namespace android {

class IOMXObserver;
struct OMXMaster;

struct OMXNodeInstance {
    OMXNodeInstance(
@@ -37,7 +38,7 @@ struct OMXNodeInstance {
    sp<IOMXObserver> observer();
    OMX::node_id nodeID();

    status_t freeNode();
    status_t freeNode(OMXMaster *master);

    status_t sendCommand(OMX_COMMANDTYPE cmd, OMX_S32 param);
    status_t getParameter(OMX_INDEXTYPE index, void *params, size_t size);
@@ -72,7 +73,7 @@ struct OMXNodeInstance {
            const char *parameterName, OMX_INDEXTYPE *index);

    void onMessage(const omx_message &msg);
    void onObserverDied();
    void onObserverDied(OMXMaster *master);
    void onGetHandleFailed();

    static OMX_CALLBACKTYPE kCallbacks;
+2 −2
Original line number Diff line number Diff line
@@ -205,7 +205,7 @@ void OMX::binderDied(const wp<IBinder> &the_late_who) {
        invalidateNodeID_l(instance->nodeID());
    }

    instance->onObserverDied();
    instance->onObserverDied(mMaster);
}

status_t OMX::listNodes(List<String8> *list) {
@@ -262,7 +262,7 @@ status_t OMX::freeNode(node_id node) {
    mLiveNodes.removeItemsAt(index);
    instance->observer()->asBinder()->unlinkToDeath(this);

    return instance->freeNode();
    return instance->freeNode(mMaster);
}

status_t OMX::sendCommand(
+29 −2
Original line number Diff line number Diff line
@@ -60,8 +60,10 @@ void OMXMaster::addVendorPlugin() {
        (CreateOMXPluginFunc)dlsym(
                mVendorLibHandle, "_ZN7android15createOMXPluginEv");

    if (createOMXPlugin) {
        addPlugin((*createOMXPlugin)());
    }
}

void OMXMaster::addPlugin(OMXPluginBase *plugin) {
    Mutex::Autolock autoLock(mLock);
@@ -118,7 +120,32 @@ OMX_ERRORTYPE OMXMaster::makeComponentInstance(
    }

    OMXPluginBase *plugin = mPluginByComponentName.valueAt(index);
    return plugin->makeComponentInstance(name, callbacks, appData, component);
    OMX_ERRORTYPE err =
        plugin->makeComponentInstance(name, callbacks, appData, component);

    if (err != OMX_ErrorNone) {
        return err;
    }

    mPluginByInstance.add(*component, plugin);

    return err;
}

OMX_ERRORTYPE OMXMaster::destroyComponentInstance(
        OMX_COMPONENTTYPE *component) {
    Mutex::Autolock autoLock(mLock);

    ssize_t index = mPluginByInstance.indexOfKey(component);

    if (index < 0) {
        return OMX_ErrorBadParameter;
    }

    OMXPluginBase *plugin = mPluginByInstance.valueAt(index);
    mPluginByInstance.removeItemsAt(index);

    return plugin->destroyComponentInstance(component);
}

OMX_ERRORTYPE OMXMaster::enumerateComponents(
+5 −0
Original line number Diff line number Diff line
@@ -37,6 +37,9 @@ struct OMXMaster : public OMXPluginBase {
            OMX_PTR appData,
            OMX_COMPONENTTYPE **component);

    virtual OMX_ERRORTYPE destroyComponentInstance(
            OMX_COMPONENTTYPE *component);

    virtual OMX_ERRORTYPE enumerateComponents(
            OMX_STRING name,
            size_t size,
@@ -46,6 +49,8 @@ private:
    Mutex mLock;
    List<OMXPluginBase *> mPlugins;
    KeyedVector<String8, OMXPluginBase *> mPluginByComponentName;
    KeyedVector<OMX_COMPONENTTYPE *, OMXPluginBase *> mPluginByInstance;

    void *mVendorLibHandle;

    void addVendorPlugin();
Loading