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

Commit d78bc77d authored by Andreas Huber's avatar Andreas Huber Committed by Android Git Automerger
Browse files

am e71a6408: Merge change I1bceff91 into eclair-mr2

Merge commit 'e71a6408867a80f847cd3f7671f6ef009f67a78e' into eclair-mr2-plus-aosp

* commit 'e71a6408867a80f847cd3f7671f6ef009f67a78e':
  Make sure the decoder's input buffers are large enough to hold the largest input data. Verify that the setting actually sticks.
parents 72b0e784 738c4315
Loading
Loading
Loading
Loading
+12 −8
Original line number Diff line number Diff line
@@ -635,6 +635,15 @@ status_t MPEG4Extractor::parseChunk(off_t *offset, int depth) {
                return err;
            }

            size_t max_size;
            CHECK_EQ(mLastTrack->sampleTable->getMaxSampleSize(&max_size), OK);

            // Assume that a given buffer only contains at most 10 fragments,
            // each fragment originally prefixed with a 2 byte length will
            // have a 4 byte header (0x00 0x00 0x00 0x01) after conversion,
            // and thus will grow by 2 bytes per fragment.
            mLastTrack->meta->setInt32(kKeyMaxInputSize, max_size + 10 * 2);

            *offset += chunk_size;
            break;
        }
@@ -792,15 +801,10 @@ status_t MPEG4Source::start(MetaData *params) {

    mGroup = new MediaBufferGroup;

    size_t max_size;
    status_t err = mSampleTable->getMaxSampleSize(&max_size);
    CHECK_EQ(err, OK);
    int32_t max_size;
    CHECK(mFormat->findInt32(kKeyMaxInputSize, &max_size));

    // Assume that a given buffer only contains at most 10 fragments,
    // each fragment originally prefixed with a 2 byte length will
    // have a 4 byte header (0x00 0x00 0x00 0x01) after conversion,
    // and thus will grow by 2 bytes per fragment.
    mGroup->add_buffer(new MediaBuffer(max_size + 10 * 2));
    mGroup->add_buffer(new MediaBuffer(max_size));

    mSrcBuffer = new uint8_t[max_size];

+8 −2
Original line number Diff line number Diff line
@@ -462,7 +462,7 @@ sp<OMXCodec> OMXCodec::Create(
    }

    int32_t maxInputSize;
    if (createEncoder && meta->findInt32(kKeyMaxInputSize, &maxInputSize)) {
    if (meta->findInt32(kKeyMaxInputSize, &maxInputSize)) {
        codec->setMinBufferSize(kPortIndexInput, (OMX_U32)maxInputSize);
    }

@@ -487,12 +487,18 @@ void OMXCodec::setMinBufferSize(OMX_U32 portIndex, OMX_U32 size) {

    if (def.nBufferSize < size) {
        def.nBufferSize = size;

    }

    err = mOMX->setParameter(
            mNode, OMX_IndexParamPortDefinition, &def, sizeof(def));
    CHECK_EQ(err, OK);

    err = mOMX->getParameter(
            mNode, OMX_IndexParamPortDefinition, &def, sizeof(def));
    CHECK_EQ(err, OK);

    // Make sure the setting actually stuck.
    CHECK(def.nBufferSize >= size);
}

status_t OMXCodec::setVideoPortFormatType(