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

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

codecs: handle onReset() for a few encoders

am: 5443b57c

Change-Id: Ifd851c8840abc615eecf0da1f6b32f30cfb4e0b2
parents b0896dfc 5443b57c
Loading
Loading
Loading
Loading
+12 −2
Original line number Original line Diff line number Diff line
@@ -62,8 +62,7 @@ SoftAACEncoder::SoftAACEncoder(
}
}


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


    if (mEncoderHandle) {
    if (mEncoderHandle) {
        CHECK_EQ(VO_ERR_NONE, mApiHandle->Uninit(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
}  // namespace android


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


    virtual void onQueueFilled(OMX_U32 portIndex);
    virtual void onQueueFilled(OMX_U32 portIndex);


    virtual void onReset();

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


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


void SoftAACEncoder2::initPorts() {
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
}  // namespace android


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


    virtual void onQueueFilled(OMX_U32 portIndex);
    virtual void onQueueFilled(OMX_U32 portIndex);


    virtual void onReset();

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


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


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

    PVCleanUpVideoEncoder(mHandle);

    free(mInputFrameData);
    mInputFrameData = NULL;

        delete mEncParams;
        delete mEncParams;
        mEncParams = NULL;
        mEncParams = NULL;
    }


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

    }
    mStarted = false;


    return OMX_ErrorNone;
    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
}  // namespace android


android::SoftOMXComponent *createSoftOMXComponent(
android::SoftOMXComponent *createSoftOMXComponent(
Loading