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

Commit 41c60ea3 authored by Venkatarama Avadhani's avatar Venkatarama Avadhani Committed by android-build-merger
Browse files

Merge "Notify Errors Appropriately from SoftMPEG2" into mnc-dev am: 74a2af11

am: 0817640c

Change-Id: If72152b0e19ab8942d56d99819f5670950770a91
parents aff0808b 0817640c
Loading
Loading
Loading
Loading
+46 −7
Original line number Diff line number Diff line
@@ -81,11 +81,21 @@ SoftMPEG2::SoftMPEG2(
    GENERATE_FILE_NAMES();
    CREATE_DUMP_FILE(mInFile);

    CHECK_EQ(initDecoder(), (status_t)OK);
    if (OK != initDecoder()) {
        ALOGE("Failed to initialize decoder");
        notify(OMX_EventError, OMX_ErrorUnsupportedSetting, 0, NULL);
        mSignalledError = true;
        return;
    }
}

SoftMPEG2::~SoftMPEG2() {
    CHECK_EQ(deInitDecoder(), (status_t)OK);
    if (OK != deInitDecoder()) {
        ALOGE("Failed to deinit decoder");
        notify(OMX_EventError, OMX_ErrorUnsupportedSetting, 0, NULL);
        mSignalledError = true;
        return;
    }
}


@@ -202,6 +212,9 @@ status_t SoftMPEG2::resetDecoder() {
    /* Set number of cores/threads to be used by the codec */
    setNumCores();

    mStride = 0;
    mSignalledError = false;

    return OK;
}

@@ -384,7 +397,8 @@ status_t SoftMPEG2::initDecoder() {
    resetPlugin();

    /* Set the run time (dynamic) parameters */
    setParams(displayStride);
    mStride = outputBufferWidth();
    setParams(mStride);

    /* Set number of cores/threads to be used by the codec */
    setNumCores();
@@ -429,6 +443,7 @@ status_t SoftMPEG2::deInitDecoder() {

    mInitNeeded = true;
    mChangingResolution = false;
    mCodecCtx = NULL;

    return OK;
}
@@ -440,10 +455,13 @@ status_t SoftMPEG2::reInitDecoder() {

    ret = initDecoder();
    if (OK != ret) {
        ALOGE("Create failure");
        ALOGE("Failed to initialize decoder");
        deInitDecoder();
        return NO_MEMORY;
        notify(OMX_EventError, OMX_ErrorUnsupportedSetting, 0, NULL);
        mSignalledError = true;
        return ret;
    }
    mSignalledError = false;
    return OK;
}

@@ -541,6 +559,9 @@ void SoftMPEG2::onPortFlushCompleted(OMX_U32 portIndex) {
void SoftMPEG2::onQueueFilled(OMX_U32 portIndex) {
    UNUSED(portIndex);

    if (mSignalledError) {
        return;
    }
    if (mOutputPortSettingsChange != NONE) {
        return;
    }
@@ -548,6 +569,12 @@ void SoftMPEG2::onQueueFilled(OMX_U32 portIndex) {
    List<BufferInfo *> &inQueue = getPortQueue(kInputPortIndex);
    List<BufferInfo *> &outQueue = getPortQueue(kOutputPortIndex);

    if (outputBufferWidth() != mStride) {
        /* Set the run-time (dynamic) parameters */
        mStride = outputBufferWidth();
        setParams(mStride);
    }

    /* If input EOS is seen and decoder is not in flush mode,
     * set the decoder in flush mode.
     * There can be a case where EOS is sent along with last picture data
@@ -601,7 +628,12 @@ void SoftMPEG2::onQueueFilled(OMX_U32 portIndex) {
            bool portWillReset = false;
            handlePortSettingsChange(&portWillReset, mNewWidth, mNewHeight);

            CHECK_EQ(reInitDecoder(), (status_t)OK);
            if (OK != reInitDecoder()) {
                ALOGE("Failed to reinitialize decoder");
                notify(OMX_EventError, OMX_ErrorUnsupportedSetting, 0, NULL);
                mSignalledError = true;
                return;
            }
            return;
        }

@@ -672,7 +704,12 @@ void SoftMPEG2::onQueueFilled(OMX_U32 portIndex) {
                bool portWillReset = false;
                handlePortSettingsChange(&portWillReset, s_dec_op.u4_pic_wd, s_dec_op.u4_pic_ht);

                CHECK_EQ(reInitDecoder(), (status_t)OK);
                if (OK != reInitDecoder()) {
                    ALOGE("Failed to reinitialize decoder");
                    notify(OMX_EventError, OMX_ErrorUnsupportedSetting, 0, NULL);
                    mSignalledError = true;
                    return;
                }

                if (setDecodeArgs(&s_dec_ip, &s_dec_op, inHeader, outHeader, timeStampIx)) {
                    ivdec_api_function(mCodecCtx, (void *)&s_dec_ip, (void *)&s_dec_op);
@@ -686,6 +723,8 @@ void SoftMPEG2::onQueueFilled(OMX_U32 portIndex) {
                mChangingResolution = false;
                resetDecoder();
                resetPlugin();
                mStride = outputBufferWidth();
                setParams(mStride);
                continue;
            }

+2 −0
Original line number Diff line number Diff line
@@ -105,7 +105,9 @@ private:
    // codec. So the codec is switching to decode the new resolution.
    bool mChangingResolution;
    bool mFlushNeeded;
    bool mSignalledError;
    bool mWaitForI;
    size_t mStride;

    status_t initDecoder();
    status_t deInitDecoder();