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

Commit 1c356d38 authored by James Dong's avatar James Dong Committed by Android (Google) Code Review
Browse files

Merge "Fixed a native crash due to unexpected state at destroy time when...

Merge "Fixed a native crash due to unexpected state at destroy time when encoder component's source fails to start" into jb-mr1-dev
parents 69092192 aa8879d3
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -354,6 +354,8 @@ private:
            const void *data, size_t size,
            unsigned *profile, unsigned *level);

    status_t stopOmxComponent_l();

    OMXCodec(const OMXCodec &);
    OMXCodec &operator=(const OMXCodec &);
};
+14 −6
Original line number Diff line number Diff line
@@ -3621,7 +3621,11 @@ status_t OMXCodec::start(MetaData *meta) {
        }

        params->setInt32(kKeyNumBuffers, mPortBuffers[kPortIndexInput].size());
        return mSource->start(params.get());
        err = mSource->start(params.get());
        if (err != OK) {
            stopOmxComponent_l();
        }
        return err;
    }

    // Decoder case
@@ -3633,8 +3637,16 @@ status_t OMXCodec::start(MetaData *meta) {

status_t OMXCodec::stop() {
    CODEC_LOGV("stop mState=%d", mState);

    Mutex::Autolock autoLock(mLock);
    status_t err = stopOmxComponent_l();
    mSource->stop();

    CODEC_LOGV("stopped in state %d", mState);
    return err;
}

status_t OMXCodec::stopOmxComponent_l() {
    CODEC_LOGV("stopOmxComponent_l mState=%d", mState);

    while (isIntermediateState(mState)) {
        mAsyncCompletion.wait(mLock);
@@ -3732,10 +3744,6 @@ status_t OMXCodec::stop() {
        mLeftOverBuffer = NULL;
    }

    mSource->stop();

    CODEC_LOGV("stopped in state %d", mState);

    return OK;
}