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

Commit 72a52e7b authored by James Dong's avatar James Dong Committed by Android (Google) Code Review
Browse files

Merge "Removed a loop for buffer lookup"

parents 225400f7 99b252a4
Loading
Loading
Loading
Loading
+18 −17
Original line number Diff line number Diff line
@@ -333,8 +333,9 @@ OMX_ERRORTYPE SimpleSoftOMXComponent::getState(OMX_STATETYPE *state) {

void SimpleSoftOMXComponent::onMessageReceived(const sp<AMessage> &msg) {
    Mutex::Autolock autoLock(mLock);

    switch (msg->what()) {
    uint32_t msgType = msg->what();
    ALOGV("msgType = %d", msgType);
    switch (msgType) {
        case kWhatSendCommand:
        {
            int32_t cmd, param;
@@ -354,8 +355,9 @@ void SimpleSoftOMXComponent::onMessageReceived(const sp<AMessage> &msg) {
            CHECK(mState == OMX_StateExecuting && mTargetState == mState);

            bool found = false;
            for (size_t i = 0; i < mPorts.size(); ++i) {
                PortInfo *port = &mPorts.editItemAt(i);
            size_t portIndex = (kWhatEmptyThisBuffer == msgType)?
                    header->nInputPortIndex: header->nOutputPortIndex;
            PortInfo *port = &mPorts.editItemAt(portIndex);

            for (size_t j = 0; j < port->mBuffers.size(); ++j) {
                BufferInfo *buffer = &port->mBuffers.editItemAt(j);
@@ -365,18 +367,17 @@ void SimpleSoftOMXComponent::onMessageReceived(const sp<AMessage> &msg) {

                    buffer->mOwnedByUs = true;

                        CHECK((msg->what() == kWhatEmptyThisBuffer
                    CHECK((msgType == kWhatEmptyThisBuffer
                            && port->mDef.eDir == OMX_DirInput)
                            || (port->mDef.eDir == OMX_DirOutput));

                    port->mQueue.push_back(buffer);
                        onQueueFilled(i);
                    onQueueFilled(portIndex);

                    found = true;
                    break;
                }
            }
            }

            CHECK(found);
            break;