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

Commit 4f428b7c 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

Change-Id: I81e3dbdd87d61a9d624d576458b4adcb8cf13fc1
parents b9e070af 89f501d0
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
@@ -62,8 +62,7 @@ SoftAACEncoder2::SoftAACEncoder2(
SoftAACEncoder2::~SoftAACEncoder2() {
    aacEncClose(&mAACEncoder);

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

void SoftAACEncoder2::initPorts() {
@@ -670,6 +669,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);
@@ -208,22 +209,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;
}
@@ -526,6 +520,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