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

Commit 1277aea8 authored by Marco Nelissen's avatar Marco Nelissen
Browse files

Make SoftVorbis fail more gracefully on errors

Change-Id: Idf047810580387a9e04a71ec27a5dd0cd910bc43
parent 9436e48e
Loading
Loading
Loading
Loading
+15 −3
Original line number Diff line number Diff line
@@ -56,6 +56,7 @@ SoftVorbis::SoftVorbis(
      mNumFramesLeftOnPage(-1),
      mSawInputEos(false),
      mSignalledOutputEos(false),
      mSignalledError(false),
      mOutputPortSettingsChange(NONE) {
    initPorts();
    CHECK_EQ(initDecoder(), (status_t)OK);
@@ -247,7 +248,7 @@ void SoftVorbis::onQueueFilled(OMX_U32 portIndex) {
    List<BufferInfo *> &inQueue = getPortQueue(0);
    List<BufferInfo *> &outQueue = getPortQueue(1);

    if (mOutputPortSettingsChange != NONE) {
    if (mSignalledError || mOutputPortSettingsChange != NONE) {
        return;
    }

@@ -271,9 +272,19 @@ void SoftVorbis::onQueueFilled(OMX_U32 portIndex) {
            mVi = new vorbis_info;
            vorbis_info_init(mVi);

            CHECK_EQ(0, _vorbis_unpack_info(mVi, &bits));
            int ret = _vorbis_unpack_info(mVi, &bits);
            if (ret != 0) {
                notify(OMX_EventError, OMX_ErrorUndefined, ret, NULL);
                mSignalledError = true;
                return;
            }
        } else {
            CHECK_EQ(0, _vorbis_unpack_books(mVi, &bits));
            int ret = _vorbis_unpack_books(mVi, &bits);
            if (ret != 0) {
                notify(OMX_EventError, OMX_ErrorUndefined, ret, NULL);
                mSignalledError = true;
                return;
            }

            CHECK(mState == NULL);
            mState = new vorbis_dsp_state;
@@ -439,6 +450,7 @@ void SoftVorbis::onReset() {

    mSawInputEos = false;
    mSignalledOutputEos = false;
    mSignalledError = false;
    mOutputPortSettingsChange = NONE;
}

+1 −0
Original line number Diff line number Diff line
@@ -61,6 +61,7 @@ private:
    int32_t mNumFramesLeftOnPage;
    bool mSawInputEos;
    bool mSignalledOutputEos;
    bool mSignalledError;

    enum {
        NONE,