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

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

am 45bd1159: am 02654f01: Merge "On this particular device the hardware video...

am 45bd1159: am 02654f01: Merge "On this particular device the hardware video decoder spits out buffers that don\'t actually contain our video data, so we cannot use them to restore the video frame after suspend/resume." into gingerbread

Merge commit '45bd1159'

* commit '45bd1159':
  On this particular device the hardware video decoder spits out buffers that don't actually contain our video data, so we cannot use them to restore the video frame after suspend/resume.
parents 7a2eff1f 45bd1159
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -97,6 +97,8 @@ enum {
    kKeyAutoLoop          = 'autL',  // bool (int32_t)

    kKeyValidSamples      = 'valD',  // int32_t

    kKeyIsUnreadable      = 'unre',  // bool (int32_t)
};

enum {
+3 −1
Original line number Diff line number Diff line
@@ -103,6 +103,7 @@ private:
        kSupportsMultipleFramesPerInputBuffer = 1024,
        kAvoidMemcopyInputRecordingFrames     = 2048,
        kRequiresLargerEncoderOutputBuffer    = 4096,
        kOutputBuffersAreUnreadable           = 8192,
    };

    struct BufferInfo {
@@ -249,7 +250,8 @@ private:

    status_t configureCodec(const sp<MetaData> &meta);

    static uint32_t getComponentQuirks(const char *componentName);
    static uint32_t getComponentQuirks(
            const char *componentName, bool isEncoder);

    static void findMatchingCodecs(
            const char *mime,
+23 −14
Original line number Diff line number Diff line
@@ -1593,7 +1593,12 @@ status_t AwesomePlayer::suspend() {

    if (mLastVideoBuffer) {
        size_t size = mLastVideoBuffer->range_length();

        if (size) {
            int32_t unreadable;
            if (!mLastVideoBuffer->meta_data()->findInt32(
                        kKeyIsUnreadable, &unreadable)
                    || unreadable == 0) {
                state->mLastVideoFrameSize = size;
                state->mLastVideoFrame = malloc(size);
                memcpy(state->mLastVideoFrame,
@@ -1608,6 +1613,10 @@ status_t AwesomePlayer::suspend() {
                CHECK(meta->findInt32(kKeyColorFormat, &state->mColorFormat));
                CHECK(meta->findInt32(kKeyWidth, &state->mDecodedWidth));
                CHECK(meta->findInt32(kKeyHeight, &state->mDecodedHeight));
            } else {
                LOGV("Unable to save last video frame, we have no access to "
                     "the decoded video data.");
            }
        }
    }

+14 −2
Original line number Diff line number Diff line
@@ -356,7 +356,8 @@ static int CompareSoftwareCodecsFirst(
}

// static
uint32_t OMXCodec::getComponentQuirks(const char *componentName) {
uint32_t OMXCodec::getComponentQuirks(
        const char *componentName, bool isEncoder) {
    uint32_t quirks = 0;

    if (!strcmp(componentName, "OMX.Nvidia.amr.decoder") ||
@@ -421,6 +422,13 @@ uint32_t OMXCodec::getComponentQuirks(const char *componentName) {
        quirks |= kInputBufferSizesAreBogus;
    }

    if (!strncmp(componentName, "OMX.SEC.", 8) && !isEncoder) {
        // These output buffers contain no video data, just some
        // opaque information that allows the overlay to display their
        // contents.
        quirks |= kOutputBuffersAreUnreadable;
    }

    return quirks;
}

@@ -507,7 +515,7 @@ sp<MediaSource> OMXCodec::Create(
            LOGV("Successfully allocated OMX node '%s'", componentName);

            sp<OMXCodec> codec = new OMXCodec(
                    omx, node, getComponentQuirks(componentName),
                    omx, node, getComponentQuirks(componentName, createEncoder),
                    createEncoder, mime, componentName,
                    source);

@@ -1772,6 +1780,10 @@ void OMXCodec::on_message(const omx_message &msg) {
                    buffer->meta_data()->setInt32(kKeyIsCodecConfig, true);
                }

                if (mQuirks & kOutputBuffersAreUnreadable) {
                    buffer->meta_data()->setInt32(kKeyIsUnreadable, true);
                }

                buffer->meta_data()->setPointer(
                        kKeyPlatformPrivate,
                        msg.u.extended_buffer_data.platform_private);
+14 −0
Original line number Diff line number Diff line
@@ -159,6 +159,20 @@ static VideoFrame *extractVideoFrameWithCodecFlags(

    LOGV("successfully decoded video frame.");

    int32_t unreadable;
    if (buffer->meta_data()->findInt32(kKeyIsUnreadable, &unreadable)
            && unreadable != 0) {
        LOGV("video frame is unreadable, decoder does not give us access "
             "to the video data.");

        buffer->release();
        buffer = NULL;

        decoder->stop();

        return NULL;
    }

    int64_t timeUs;
    CHECK(buffer->meta_data()->findInt64(kKeyTime, &timeUs));
    if (thumbNailTime >= 0) {