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

Commit 2ea14e23 authored by Andreas Huber's avatar Andreas Huber
Browse files

Squashed commit of the following:

commit 144b1c40e9cf08a584c50e1bef7ba3f287e81a4f
Author: Andreas Huber <andih@google.com>
Date:   Wed Dec 16 09:28:23 2009 -0800

    This H264 file shows a certain problem even better.

commit 3245f1f3b7471975aeeb824a756c987abd610f55
Author: Andreas Huber <andih@google.com>
Date:   Wed Dec 16 09:20:08 2009 -0800

    Using only the QA testfiles now.

commit 074817eb3816c5dd70858a3594e3b92d799d873b
Author: Andreas Huber <andih@google.com>
Date:   Tue Dec 15 16:17:39 2009 -0800

    Yay, roles are back again now that the API is in place.

commit 6d847e4932cc38301ae27cb7283b7f1553a95457
Author: Andreas Huber <andih@google.com>
Date:   Tue Dec 15 13:01:20 2009 -0800

    Added commandline option for specifying the random seed for reproducable tests.

commit 62ab37b26336eaa67e49791c41c996acb6acee3f
Author: Andreas Huber <andih@google.com>
Date:   Mon Dec 14 10:53:27 2009 -0800

    When issuing a seek it is important that only the first MediaSource::read call has the seek option.

commit e77c46644b2fb6862bafa3569f7d304252074f1e
Author: Andreas Huber <andih@google.com>
Date:   Mon Dec 7 16:39:07 2009 -0800

    Make sure the tests are actually built, sp<OMXCodec> becomes sp<MediaSource>

commit 6df56915bd55a9445b3c6f953d3cc251d81579b8
Author: Andreas Huber <andih@google.com>
Date:   Thu Dec 3 14:25:36 2009 -0800

    Temporarily disable support for querying the roles of OMX components.

commit 31bb26930df9e3658dea684cedb4b0f1a06a4a88
Author: Andreas Huber <andih@google.com>
Date:   Tue Dec 1 13:36:52 2009 -0800

    Disregard EOS events, slightly change the way the EOS flag on output buffers is handled.

commit 4c382fbc9aebee8197d5988d04378062809e7c48
Author: Andreas Huber <andih@google.com>
Date:   Tue Dec 1 09:37:24 2009 -0800

    New random seek test for the codec tests. Fixed "sticky" end-of-output-buffers flag behaviour in OMXCodec.

commit c762eac3e44309592b61a168d66e091cf609fa03
Author: Andreas Huber <andih@google.com>
Date:   Tue Nov 3 14:13:43 2009 -0800

    Fix a typo.

commit 50540a59b65c7d476b0193c7494cd75895e6ca6d
Author: Andreas Huber <andih@google.com>
Date:   Tue Nov 3 09:48:35 2009 -0800

    Some more fine tuning of the unit tests, make MPEG4Extractor less verbose.

commit 1157a7e52a0636706caa235abe16d2ff8a0b8140
Author: Andreas Huber <andih@google.com>
Date:   Wed Oct 28 12:01:01 2009 -0700

    Changes to the IOMX::listNodes API, this now returns the component's roles as well, unit tests now test all components in all supported roles by default.

commit 30fbf2d8c6cb927689f7ba75eb550a81e9df488a
Author: Andreas Huber <andih@google.com>
Date:   Mon Oct 26 09:45:26 2009 -0700

    Initial check-in of unit tests for OMX components.
parent d980e656
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -345,12 +345,12 @@ int main(int argc, char **argv) {
        sp<IOMX> omx = service->getOMX();
        CHECK(omx.get() != NULL);

        List<String8> list;
        List<IOMX::ComponentInfo> list;
        omx->listNodes(&list);

        for (List<String8>::iterator it = list.begin();
        for (List<IOMX::ComponentInfo>::iterator it = list.begin();
             it != list.end(); ++it) {
            printf("%s\n", (*it).string());
            printf("%s\n", (*it).mName.string());
        }
    }

+5 −1
Original line number Diff line number Diff line
@@ -42,7 +42,11 @@ public:
    typedef void *buffer_id;
    typedef void *node_id;

    virtual status_t listNodes(List<String8> *list) = 0;
    struct ComponentInfo {
        String8 mName;
        List<String8> mRoles;
    };
    virtual status_t listNodes(List<ComponentInfo> *list) = 0;

    virtual status_t allocateNode(
            const char *name, const sp<IOMXObserver> &observer,
+18 −6
Original line number Diff line number Diff line
@@ -75,7 +75,7 @@ public:
        : BpInterface<IOMX>(impl) {
    }

    virtual status_t listNodes(List<String8> *list) {
    virtual status_t listNodes(List<ComponentInfo> *list) {
        list->clear();

        Parcel data, reply;
@@ -84,9 +84,14 @@ public:

        int32_t n = reply.readInt32();
        for (int32_t i = 0; i < n; ++i) {
            String8 s = reply.readString8();
            list->push_back(ComponentInfo());
            ComponentInfo &info = *--list->end();

            list->push_back(s);
            info.mName = reply.readString8();
            int32_t numRoles = reply.readInt32();
            for (int32_t j = 0; j < numRoles; ++j) {
                info.mRoles.push_back(reply.readString8());
            }
        }

        return OK;
@@ -368,13 +373,20 @@ status_t BnOMX::onTransact(
        {
            CHECK_INTERFACE(IOMX, data, reply);

            List<String8> list;
            List<ComponentInfo> list;
            listNodes(&list);

            reply->writeInt32(list.size());
            for (List<String8>::iterator it = list.begin();
            for (List<ComponentInfo>::iterator it = list.begin();
                 it != list.end(); ++it) {
                reply->writeString8(*it);
                ComponentInfo &cur = *it;

                reply->writeString8(cur.mName);
                reply->writeInt32(cur.mRoles.size());
                for (List<String8>::iterator role_it = cur.mRoles.begin();
                     role_it != cur.mRoles.end(); ++role_it) {
                    reply->writeString8(*role_it);
                }
            }

            return NO_ERROR;
+4 −4
Original line number Diff line number Diff line
@@ -534,8 +534,8 @@ status_t MPEG4Extractor::parseChunk(off_t *offset, int depth) {
            uint16_t sample_size = U16_AT(&buffer[18]);
            uint32_t sample_rate = U32_AT(&buffer[24]) >> 16;

            printf("*** coding='%s' %d channels, size %d, rate %d\n",
                   chunk, num_channels, sample_size, sample_rate);
            // printf("*** coding='%s' %d channels, size %d, rate %d\n",
            //        chunk, num_channels, sample_size, sample_rate);

            mLastTrack->meta->setCString(kKeyMIMEType, FourCC2MIME(chunk_type));
            mLastTrack->meta->setInt32(kKeyChannelCount, num_channels);
@@ -576,8 +576,8 @@ status_t MPEG4Extractor::parseChunk(off_t *offset, int depth) {
            uint16_t width = U16_AT(&buffer[6 + 18]);
            uint16_t height = U16_AT(&buffer[6 + 20]);

            printf("*** coding='%s' width=%d height=%d\n",
                   chunk, width, height);
            // printf("*** coding='%s' width=%d height=%d\n",
            //        chunk, width, height);

            mLastTrack->meta->setCString(kKeyMIMEType, FourCC2MIME(chunk_type));
            mLastTrack->meta->setInt32(kKeyWidth, width);
+27 −24
Original line number Diff line number Diff line
@@ -425,14 +425,9 @@ sp<MediaSource> OMXCodec::Create(
        esds.getCodecSpecificInfo(
                &codec_specific_data, &codec_specific_data_size);

        printf("found codec-specific data of size %d\n",
               codec_specific_data_size);

        codec->addCodecSpecificData(
                codec_specific_data, codec_specific_data_size);
    } else if (meta->findData(kKeyAVCC, &type, &data, &size)) {
        printf("found avcc of size %d\n", size);

        // Parse the AVCDecoderConfigurationRecord

        const uint8_t *ptr = (const uint8_t *)data;
@@ -1223,7 +1218,7 @@ status_t OMXCodec::allocateBuffersOnPort(OMX_U32 portIndex) {
             portIndex == kPortIndexInput ? "input" : "output");
    }

    dumpPortStatus(portIndex);
    // dumpPortStatus(portIndex);

    return OK;
}
@@ -1273,7 +1268,6 @@ void OMXCodec::on_message(const omx_message &msg) {
                CHECK_EQ(mPortStatus[kPortIndexInput], ENABLED);
                drainInputBuffer(&buffers->editItemAt(i));
            }

            break;
        }

@@ -1282,12 +1276,10 @@ void OMXCodec::on_message(const omx_message &msg) {
            IOMX::buffer_id buffer = msg.u.extended_buffer_data.buffer;
            OMX_U32 flags = msg.u.extended_buffer_data.flags;

            CODEC_LOGV("FILL_BUFFER_DONE(buffer: %p, size: %ld, flags: 0x%08lx)",
            CODEC_LOGV("FILL_BUFFER_DONE(buffer: %p, size: %ld, flags: 0x%08lx, timestamp: %lld us (%.2f secs))",
                 buffer,
                 msg.u.extended_buffer_data.range_length,
                 flags);

            CODEC_LOGV("FILL_BUFFER_DONE(timestamp: %lld us (%.2f secs))",
                 flags,
                 msg.u.extended_buffer_data.timestamp,
                 msg.u.extended_buffer_data.timestamp / 1E6);

@@ -1315,11 +1307,13 @@ void OMXCodec::on_message(const omx_message &msg) {
                CHECK_EQ(err, OK);

                buffers->removeAt(i);
#if 0
            } else if (mPortStatus[kPortIndexOutput] == ENABLED
                       && (flags & OMX_BUFFERFLAG_EOS)) {
                CODEC_LOGV("No more output data.");
                mNoMoreOutputData = true;
                mBufferFilled.signal();
#endif
            } else if (mPortStatus[kPortIndexOutput] != SHUTTING_DOWN) {
                CHECK_EQ(mPortStatus[kPortIndexOutput], ENABLED);

@@ -1351,6 +1345,11 @@ void OMXCodec::on_message(const omx_message &msg) {

                mFilledBuffers.push_back(i);
                mBufferFilled.signal();

                if (msg.u.extended_buffer_data.flags & OMX_BUFFERFLAG_EOS) {
                    CODEC_LOGV("No more output data.");
                    mNoMoreOutputData = true;
                }
            }

            break;
@@ -1374,7 +1373,7 @@ void OMXCodec::onEvent(OMX_EVENTTYPE event, OMX_U32 data1, OMX_U32 data2) {

        case OMX_EventError:
        {
            LOGE("ERROR(%ld, %ld)", data1, data2);
            LOGE("ERROR(0x%08lx, %ld)", data1, data2);

            setState(ERROR);
            break;
@@ -1386,6 +1385,7 @@ void OMXCodec::onEvent(OMX_EVENTTYPE event, OMX_U32 data1, OMX_U32 data2) {
            break;
        }

#if 0
        case OMX_EventBufferFlag:
        {
            CODEC_LOGV("EVENT_BUFFER_FLAG(%ld)", data1);
@@ -1395,6 +1395,7 @@ void OMXCodec::onEvent(OMX_EVENTTYPE event, OMX_U32 data1, OMX_U32 data2) {
            }
            break;
        }
#endif

        default:
        {
@@ -1565,13 +1566,6 @@ void OMXCodec::onCmdComplete(OMX_COMMANDTYPE cmd, OMX_U32 data) {
                    CODEC_LOGV("Finished flushing both ports, now continuing from"
                         " seek-time.");

                    // Clear this flag in case the decoder sent us either
                    // the EVENT_BUFFER_FLAG(1) or an output buffer with
                    // the EOS flag set _while_ flushing. Since we're going
                    // to submit "fresh" input data now, this flag no longer
                    // applies to our future.
                    mNoMoreOutputData = false;

                    drainInputBuffers();
                    fillOutputBuffers();
                }
@@ -1832,6 +1826,8 @@ void OMXCodec::drainInputBuffer(BufferInfo *info) {
            memcpy(info->mMem->pointer(), specific->mData, specific->mSize);
        }

        mNoMoreOutputData = false;

        status_t err = mOMX->emptyBuffer(
                mNode, info->mBuffer, 0, size,
                OMX_BUFFERFLAG_ENDOFFRAME | OMX_BUFFERFLAG_CODECCONFIG,
@@ -1849,7 +1845,9 @@ void OMXCodec::drainInputBuffer(BufferInfo *info) {
    if (mSeekTimeUs >= 0) {
        MediaSource::ReadOptions options;
        options.setSeekTo(mSeekTimeUs);

        mSeekTimeUs = -1;
        mBufferFilled.signal();

        err = mSource->read(&srcBuffer, &options);
    } else {
@@ -1866,6 +1864,8 @@ void OMXCodec::drainInputBuffer(BufferInfo *info) {

        mSignalledEOS = true;
    } else {
        mNoMoreOutputData = false;

        srcLength = srcBuffer->range_length();

        if (info->mMem->size() < srcLength) {
@@ -1878,9 +1878,9 @@ void OMXCodec::drainInputBuffer(BufferInfo *info) {
               srcLength);

        if (srcBuffer->meta_data()->findInt64(kKeyTime, &timestampUs)) {
            CODEC_LOGV("Calling emptyBuffer on buffer %p (length %d)",
                 info->mBuffer, srcLength);
            CODEC_LOGV("Calling emptyBuffer with timestamp %lld us (%.2f secs)",
            CODEC_LOGV("Calling emptyBuffer on buffer %p (length %d), "
                       "timestamp %lld us (%.2f secs)",
                       info->mBuffer, srcLength,
                       timestampUs, timestampUs / 1E6);
        }
    }
@@ -2298,7 +2298,6 @@ status_t OMXCodec::read(
        CODEC_LOGV("seeking to %lld us (%.2f secs)", seekTimeUs, seekTimeUs / 1E6);

        mSignalledEOS = false;
        mNoMoreOutputData = false;

        CHECK(seekTimeUs >= 0);
        mSeekTimeUs = seekTimeUs;
@@ -2317,6 +2316,10 @@ status_t OMXCodec::read(
        if (emulateOutputFlushCompletion) {
            onCmdComplete(OMX_CommandFlush, kPortIndexOutput);
        }

        while (mSeekTimeUs >= 0) {
            mBufferFilled.wait(mLock);
        }
    }

    while (mState != ERROR && !mNoMoreOutputData && mFilledBuffers.empty()) {
Loading