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

Commit d459b485 authored by Andreas Huber's avatar Andreas Huber
Browse files

Slighly improve the API to discover if the OMX stack is running in the local

process.

Change-Id: Idd3c2f0d4a9542af01a3fdfd3b0bfab90e083505
parent bb62819a
Loading
Loading
Loading
Loading
+2 −2
Original line number Original line Diff line number Diff line
@@ -42,10 +42,10 @@ public:
    typedef void *buffer_id;
    typedef void *buffer_id;
    typedef void *node_id;
    typedef void *node_id;


    // Given the calling process' pid, returns true iff
    // Given a node_id and the calling process' pid, returns true iff
    // the implementation of the OMX interface lives in the same
    // the implementation of the OMX interface lives in the same
    // process.
    // process.
    virtual bool livesLocally(pid_t pid) = 0;
    virtual bool livesLocally(node_id node, pid_t pid) = 0;


    struct ComponentInfo {
    struct ComponentInfo {
        String8 mName;
        String8 mName;
+5 −2
Original line number Original line Diff line number Diff line
@@ -59,9 +59,10 @@ public:
        : BpInterface<IOMX>(impl) {
        : BpInterface<IOMX>(impl) {
    }
    }


    virtual bool livesLocally(pid_t pid) {
    virtual bool livesLocally(node_id node, pid_t pid) {
        Parcel data, reply;
        Parcel data, reply;
        data.writeInterfaceToken(IOMX::getInterfaceDescriptor());
        data.writeInterfaceToken(IOMX::getInterfaceDescriptor());
        data.writeIntPtr((intptr_t)node);
        data.writeInt32(pid);
        data.writeInt32(pid);
        remote()->transact(LIVES_LOCALLY, data, &reply);
        remote()->transact(LIVES_LOCALLY, data, &reply);


@@ -417,7 +418,9 @@ status_t BnOMX::onTransact(
        case LIVES_LOCALLY:
        case LIVES_LOCALLY:
        {
        {
            CHECK_INTERFACE(IOMX, data, reply);
            CHECK_INTERFACE(IOMX, data, reply);
            reply->writeInt32(livesLocally((pid_t)data.readInt32()));
            node_id node = (void *)data.readIntPtr();
            pid_t pid = (pid_t)data.readInt32();
            reply->writeInt32(livesLocally(node, pid));


            return OK;
            return OK;
        }
        }
+4 −4
Original line number Original line Diff line number Diff line
@@ -34,7 +34,7 @@ struct MuxOMX : public IOMX {


    virtual IBinder *onAsBinder() { return NULL; }
    virtual IBinder *onAsBinder() { return NULL; }


    virtual bool livesLocally(pid_t pid);
    virtual bool livesLocally(node_id node, pid_t pid);


    virtual status_t listNodes(List<ComponentInfo> *list);
    virtual status_t listNodes(List<ComponentInfo> *list);


@@ -155,8 +155,8 @@ const sp<IOMX> &MuxOMX::getOMX_l(node_id node) const {
    return isLocalNode_l(node) ? mLocalOMX : mRemoteOMX;
    return isLocalNode_l(node) ? mLocalOMX : mRemoteOMX;
}
}


bool MuxOMX::livesLocally(pid_t pid) {
bool MuxOMX::livesLocally(node_id node, pid_t pid) {
    return true;
    return getOMX(node)->livesLocally(node, pid);
}
}


status_t MuxOMX::listNodes(List<ComponentInfo> *list) {
status_t MuxOMX::listNodes(List<ComponentInfo> *list) {
@@ -326,7 +326,7 @@ status_t OMXClient::connect() {
    mOMX = service->getOMX();
    mOMX = service->getOMX();
    CHECK(mOMX.get() != NULL);
    CHECK(mOMX.get() != NULL);


    if (!mOMX->livesLocally(getpid())) {
    if (!mOMX->livesLocally(NULL /* node */, getpid())) {
        ALOGI("Using client-side OMX mux.");
        ALOGI("Using client-side OMX mux.");
        mOMX = new MuxOMX(mOMX);
        mOMX = new MuxOMX(mOMX);
    }
    }
+1 −1
Original line number Original line Diff line number Diff line
@@ -1479,7 +1479,7 @@ OMXCodec::OMXCodec(
        const sp<MediaSource> &source,
        const sp<MediaSource> &source,
        const sp<ANativeWindow> &nativeWindow)
        const sp<ANativeWindow> &nativeWindow)
    : mOMX(omx),
    : mOMX(omx),
      mOMXLivesLocally(omx->livesLocally(getpid())),
      mOMXLivesLocally(omx->livesLocally(node, getpid())),
      mNode(node),
      mNode(node),
      mQuirks(quirks),
      mQuirks(quirks),
      mFlags(flags),
      mFlags(flags),
+1 −1
Original line number Original line Diff line number Diff line
@@ -31,7 +31,7 @@ class OMX : public BnOMX,
public:
public:
    OMX();
    OMX();


    virtual bool livesLocally(pid_t pid);
    virtual bool livesLocally(node_id node, pid_t pid);


    virtual status_t listNodes(List<ComponentInfo> *list);
    virtual status_t listNodes(List<ComponentInfo> *list);


Loading