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

Commit 291a39b9 authored by Andy Hung's avatar Andy Hung Committed by Android (Google) Code Review
Browse files

Merge "Omx: Return an error if no IOMX is available" into mnc-dev

parents ccae9e1b 48a31bf3
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -4909,7 +4909,10 @@ bool ACodec::UninitializedState::onAllocateComponent(const sp<AMessage> &msg) {
    CHECK(mCodec->mNode == 0);

    OMXClient client;
    CHECK_EQ(client.connect(), (status_t)OK);
    if (client.connect() != OK) {
        mCodec->signalError(OMX_ErrorUndefined, NO_INIT);
        return false;
    }

    sp<IOMX> omx = client.interface();

+4 −0
Original line number Diff line number Diff line
@@ -392,6 +392,10 @@ status_t MediaCodec::init(const AString &name, bool nameIsType, bool encoder) {
            tmp.erase(tmp.size() - 7, 7);
        }
        const sp<IMediaCodecList> mcl = MediaCodecList::getInstance();
        if (mcl == NULL) {
            mCodec = NULL;  // remove the codec.
            return NO_INIT; // if called from Java should raise IOException
        }
        ssize_t codecIdx = mcl->findCodecByName(tmp.c_str());
        if (codecIdx >= 0) {
            const sp<MediaCodecInfo> info = mcl->getCodecInfo(codecIdx);
+5 −1
Original line number Diff line number Diff line
@@ -80,6 +80,10 @@ sp<IMediaCodecList> MediaCodecList::getLocalInstance() {
                        infos.push_back(gCodecList->getCodecInfo(i));
                    }
                }
            } else {
                // failure to initialize may be temporary. retry on next call.
                delete gCodecList;
                gCodecList = NULL;
            }
        }
    }
@@ -168,7 +172,7 @@ void MediaCodecList::parseTopLevelXMLFile(const char *codecs_xml, bool ignore_er
    OMXClient client;
    mInitCheck = client.connect();
    if (mInitCheck != OK) {
        return;
        return;  // this may fail if IMediaPlayerService is not available.
    }
    mOMX = client.interface();
    parseXMLFile(codecs_xml);
+8 −2
Original line number Diff line number Diff line
@@ -400,10 +400,16 @@ status_t OMXClient::connect() {
    sp<IBinder> binder = sm->getService(String16("media.player"));
    sp<IMediaPlayerService> service = interface_cast<IMediaPlayerService>(binder);

    CHECK(service.get() != NULL);
    if (service.get() == NULL) {
        ALOGE("Cannot obtain IMediaPlayerService");
        return NO_INIT;
    }

    mOMX = service->getOMX();
    CHECK(mOMX.get() != NULL);
    if (mOMX.get() == NULL) {
        ALOGE("Cannot obtain IOMX");
        return NO_INIT;
    }

    if (!mOMX->livesLocally(0 /* node */, getpid())) {
        ALOGI("Using client-side OMX mux.");