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

Commit 86edbb9b authored by android-merger's avatar android-merger
Browse files

temporary revert for testing

Revert "DO NOT MERGE: Make sure we restart the prefetcher immediately when trying to satisfy a read."

This reverts commit f0f1ceeb.
parent ba3bd6a5
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -1127,7 +1127,7 @@ void AwesomePlayer::finishSeekIfNecessary(int64_t videoTimeUs) {
    }

    if (mAudioPlayer != NULL) {
        LOGV("seeking audio to %lld us (%.2f secs).", videoTimeUs, videoTimeUs / 1E6);
        LOGV("seeking audio to %lld us (%.2f secs).", timeUs, timeUs / 1E6);

        // If we don't have a video time, seek audio to the originally
        // requested seek time instead.
+10 −24
Original line number Diff line number Diff line
@@ -326,31 +326,24 @@ void NuCachedSource2::onRead(const sp<AMessage> &msg) {
    mCondition.signal();
}

void NuCachedSource2::restartPrefetcherIfNecessary_l(bool force) {
void NuCachedSource2::restartPrefetcherIfNecessary_l() {
    static const size_t kGrayArea = 256 * 1024;

    if (mFetching || mFinalStatus != OK) {
        return;
    }

    size_t maxBytes;

    if (!force) {
    if (mCacheOffset + mCache->totalSize() - mLastAccessPos
            >= kLowWaterThreshold) {
        return;
    }

        maxBytes = mLastAccessPos - mCacheOffset;
    size_t maxBytes = mLastAccessPos - mCacheOffset;
    if (maxBytes < kGrayArea) {
        return;
    }

    maxBytes -= kGrayArea;
    } else {
        // Empty it all out.
        maxBytes = mLastAccessPos - mCacheOffset;
    }

    size_t actualBytes = mCache->releaseFromStart(maxBytes);
    mCacheOffset += actualBytes;
@@ -422,17 +415,10 @@ size_t NuCachedSource2::approxDataRemaining_l(bool *eos) {
}

ssize_t NuCachedSource2::readInternal(off_t offset, void *data, size_t size) {
    CHECK(size <= kHighWaterThreshold);

    LOGV("readInternal offset %ld size %d", offset, size);

    Mutex::Autolock autoLock(mLock);

    if (!mFetching) {
        mLastAccessPos = offset;
        restartPrefetcherIfNecessary_l(true /* force */);
    }

    if (offset < mCacheOffset
            || offset >= (off_t)(mCacheOffset + mCache->totalSize())) {
        static const off_t kPadding = 32768;
+1 −1
Original line number Diff line number Diff line
@@ -94,7 +94,7 @@ private:
    status_t seekInternal_l(off_t offset);

    size_t approxDataRemaining_l(bool *eos);
    void restartPrefetcherIfNecessary_l(bool force = false);
    void restartPrefetcherIfNecessary_l();

    DISALLOW_EVIL_CONSTRUCTORS(NuCachedSource2);
};