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

Commit e38187f3 authored by Wonsik Kim's avatar Wonsik Kim Committed by android-build-merger
Browse files

codecs: handle onReset() for a few encoders am: 5443b57c am: 89f501d0 am:...

codecs: handle onReset() for a few encoders am: 5443b57c am: 89f501d0 am: 4f428b7c am: a5e72ec7 am: 787a5136 am: 83485b61 am: 58f7175e am: 2430ff66 am: e80b15a6 am: c5343a57 am: 9224cc83
am: b67b0afb

Change-Id: I26a58fca276ac6d896d62ad4224fa6513bedf86e
parents 2138547c b67b0afb
Loading
Loading
Loading
Loading
+12 −2
Original line number Diff line number Diff line
@@ -62,8 +62,7 @@ SoftAACEncoder::SoftAACEncoder(
}

SoftAACEncoder::~SoftAACEncoder() {
    delete[] mInputFrame;
    mInputFrame = NULL;
    onReset();

    if (mEncoderHandle) {
        CHECK_EQ(VO_ERR_NONE, mApiHandle->Uninit(mEncoderHandle));
@@ -579,6 +578,17 @@ void SoftAACEncoder::onQueueFilled(OMX_U32 portIndex) {
    }
}

void SoftAACEncoder::onReset() {
    delete[] mInputFrame;
    mInputFrame = NULL;
    mInputSize = 0;

    mSentCodecSpecificData = false;
    mInputTimeUs = -1ll;
    mSawInputEOS = false;
    mSignalledError = false;
}

}  // namespace android

android::SoftOMXComponent *createSoftOMXComponent(
+2 −0
Original line number Diff line number Diff line
@@ -43,6 +43,8 @@ protected:

    virtual void onQueueFilled(OMX_U32 portIndex);

    virtual void onReset();

private:
    enum {
        kNumBuffers             = 4,
+12 −2
Original line number Diff line number Diff line
@@ -72,8 +72,7 @@ SoftAACEncoder2::SoftAACEncoder2(
SoftAACEncoder2::~SoftAACEncoder2() {
    aacEncClose(&mAACEncoder);

    delete[] mInputFrame;
    mInputFrame = NULL;
    onReset();
}

void SoftAACEncoder2::initPorts() {
@@ -703,6 +702,17 @@ void SoftAACEncoder2::onQueueFilled(OMX_U32 /* portIndex */) {
    }
}

void SoftAACEncoder2::onReset() {
    delete[] mInputFrame;
    mInputFrame = NULL;
    mInputSize = 0;

    mSentCodecSpecificData = false;
    mInputTimeUs = -1ll;
    mSawInputEOS = false;
    mSignalledError = false;
}

}  // namespace android

android::SoftOMXComponent *createSoftOMXComponent(
+2 −0
Original line number Diff line number Diff line
@@ -42,6 +42,8 @@ protected:

    virtual void onQueueFilled(OMX_U32 portIndex);

    virtual void onReset();

private:
    enum {
        kNumBuffers             = 4,
+21 −14
Original line number Diff line number Diff line
@@ -99,6 +99,7 @@ SoftMPEG4Encoder::SoftMPEG4Encoder(

SoftMPEG4Encoder::~SoftMPEG4Encoder() {
    ALOGV("Destruct SoftMPEG4Encoder");
    onReset();
    releaseEncoder();
    List<BufferInfo *> &outQueue = getPortQueue(1);
    List<BufferInfo *> &inQueue = getPortQueue(0);
@@ -201,22 +202,15 @@ OMX_ERRORTYPE SoftMPEG4Encoder::initEncoder() {
}

OMX_ERRORTYPE SoftMPEG4Encoder::releaseEncoder() {
    if (!mStarted) {
        return OMX_ErrorNone;
    }

    PVCleanUpVideoEncoder(mHandle);

    free(mInputFrameData);
    mInputFrameData = NULL;

    if (mEncParams) {
        delete mEncParams;
        mEncParams = NULL;
    }

    if (mHandle) {
        delete mHandle;
        mHandle = NULL;

    mStarted = false;
    }

    return OMX_ErrorNone;
}
@@ -514,6 +508,19 @@ void SoftMPEG4Encoder::onQueueFilled(OMX_U32 /* portIndex */) {
    }
}

void SoftMPEG4Encoder::onReset() {
    if (!mStarted) {
        return;
    }

    PVCleanUpVideoEncoder(mHandle);

    free(mInputFrameData);
    mInputFrameData = NULL;

    mStarted = false;
}

}  // namespace android

android::SoftOMXComponent *createSoftOMXComponent(
Loading