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

Commit 1b50fe29 authored by Andreas Huber's avatar Andreas Huber Committed by Android (Google) Code Review
Browse files

Merge "Make sure the software mpeg4 decoder supports multiple input frames per input buffer"

parents 7eaa5e57 60a3cb81
Loading
Loading
Loading
Loading
+19 −8
Original line number Diff line number Diff line
@@ -360,10 +360,14 @@ void SoftMPEG4::onQueueFilled(OMX_U32 portIndex) {
            mFramesConfigured = true;
        }

        uint32_t timestamp = 0xFFFFFFFF;
        uint32_t useExtTimestamp = (inHeader->nOffset == 0);

        // decoder deals in ms, OMX in us.
        uint32_t timestamp =
            useExtTimestamp ? (inHeader->nTimeStamp + 500) / 1000 : 0xFFFFFFFF;

        int32_t bufferSize = inHeader->nFilledLen;

        uint32_t useExtTimestamp = 0;
        if (PVDecodeVideoFrame(
                    mHandle, &bitstream, &timestamp, &bufferSize,
                    &useExtTimestamp,
@@ -379,13 +383,20 @@ void SoftMPEG4::onQueueFilled(OMX_U32 portIndex) {
            return;
        }

        outHeader->nTimeStamp = inHeader->nTimeStamp;
        // decoder deals in ms, OMX in us.
        outHeader->nTimeStamp = timestamp * 1000;

        CHECK_LE(bufferSize, inHeader->nFilledLen);
        inHeader->nOffset += inHeader->nFilledLen - bufferSize;
        inHeader->nFilledLen = bufferSize;

        if (inHeader->nFilledLen == 0) {
            inInfo->mOwnedByUs = false;
            inQueue.erase(inQueue.begin());
            inInfo = NULL;
            notifyEmptyBufferDone(inHeader);
            inHeader = NULL;
        }

        ++mInputBufferCount;

+2 −0
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@
#include "SoftOMXPlugin.h"
#include "include/SoftOMXComponent.h"

#include <media/stagefright/foundation/ADebug.h>
#include <media/stagefright/foundation/AString.h>

#include <dlfcn.h>
@@ -128,6 +129,7 @@ OMX_ERRORTYPE SoftOMXPlugin::destroyComponentInstance(

    void *libHandle = me->libHandle();

    CHECK_EQ(me->getStrongCount(), 1);
    me->decStrong(this);
    me = NULL;