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

Commit 31a17033 authored by Jean-Baptiste Queru's avatar Jean-Baptiste Queru
Browse files

fix unintentional drift

Change-Id: I0bbf3d3f95296a41d71558d8de1ed2ed021f21cf
parent 0b23c143
Loading
Loading
Loading
Loading
+4 −2
Original line number Original line Diff line number Diff line
@@ -444,6 +444,8 @@ void AwesomePlayer::onBufferingUpdate() {
        notifyListener_l(MEDIA_BUFFERING_UPDATE, percentage * 100.0);
        notifyListener_l(MEDIA_BUFFERING_UPDATE, percentage * 100.0);


        postBufferingEvent_l();
        postBufferingEvent_l();
    } else {
        LOGE("Not sending buffering status because duration is unknown.");
    }
    }
}
}


@@ -552,8 +554,6 @@ status_t AwesomePlayer::play_l() {
        seekAudioIfNecessary_l();
        seekAudioIfNecessary_l();
    }
    }


    postBufferingEvent_l();

    if (mFlags & AT_EOS) {
    if (mFlags & AT_EOS) {
        // Legacy behaviour, if a stream finishes playing and then
        // Legacy behaviour, if a stream finishes playing and then
        // is started again, we play from the start...
        // is started again, we play from the start...
@@ -1230,6 +1230,8 @@ void AwesomePlayer::onPrepareAsyncEvent() {
    mFlags |= PREPARED;
    mFlags |= PREPARED;
    mAsyncPrepareEvent = NULL;
    mAsyncPrepareEvent = NULL;
    mPreparedCondition.broadcast();
    mPreparedCondition.broadcast();

    postBufferingEvent_l();
}
}


status_t AwesomePlayer::suspend() {
status_t AwesomePlayer::suspend() {
+19 −12
Original line number Original line Diff line number Diff line
@@ -203,18 +203,24 @@ status_t AACDecoder::read(


    Int decoderErr = PVMP4AudioDecodeFrame(mConfig, mDecoderBuf);
    Int decoderErr = PVMP4AudioDecodeFrame(mConfig, mDecoderBuf);


    size_t numOutBytes =
        mConfig->frameLength * sizeof(int16_t) * mConfig->desiredChannels;

    if (decoderErr != MP4AUDEC_SUCCESS) {
    if (decoderErr != MP4AUDEC_SUCCESS) {
        LOGE("AAC decoder returned error %d", decoderErr);
        LOGW("AAC decoder returned error %d, substituting silence", decoderErr);


        buffer->release();
        memset(buffer->data(), 0, numOutBytes);
        buffer = NULL;


        return ERROR_MALFORMED;
        // Discard input buffer.
        mInputBuffer->release();
        mInputBuffer = NULL;

        // fall through
    }
    }


    buffer->set_range(
    buffer->set_range(0, numOutBytes);
            0, mConfig->frameLength * sizeof(int16_t) * mConfig->desiredChannels);


    if (mInputBuffer != NULL) {
        mInputBuffer->set_range(
        mInputBuffer->set_range(
                mInputBuffer->range_offset() + mConfig->inputBufferUsedLength,
                mInputBuffer->range_offset() + mConfig->inputBufferUsedLength,
                mInputBuffer->range_length() - mConfig->inputBufferUsedLength);
                mInputBuffer->range_length() - mConfig->inputBufferUsedLength);
@@ -223,6 +229,7 @@ status_t AACDecoder::read(
            mInputBuffer->release();
            mInputBuffer->release();
            mInputBuffer = NULL;
            mInputBuffer = NULL;
        }
        }
    }


    buffer->meta_data()->setInt64(
    buffer->meta_data()->setInt64(
            kKeyTime,
            kKeyTime,