Loading media/libstagefright/NuCachedSource2.cpp +18 −6 Original line number Diff line number Diff line Loading @@ -323,25 +323,28 @@ void NuCachedSource2::onRead(const sp<AMessage> &msg) { } void NuCachedSource2::restartPrefetcherIfNecessary_l( bool ignoreLowWaterThreshold) { bool ignoreLowWaterThreshold, bool force) { static const size_t kGrayArea = 1024 * 1024; if (mFetching || mFinalStatus != OK) { return; } if (!ignoreLowWaterThreshold if (!ignoreLowWaterThreshold && !force && mCacheOffset + mCache->totalSize() - mLastAccessPos >= kLowWaterThreshold) { return; } size_t maxBytes = mLastAccessPos - mCacheOffset; if (!force) { if (maxBytes < kGrayArea) { return; } maxBytes -= kGrayArea; } size_t actualBytes = mCache->releaseFromStart(maxBytes); mCacheOffset += actualBytes; Loading Loading @@ -413,10 +416,19 @@ size_t NuCachedSource2::approxDataRemaining_l(status_t *finalStatus) { } ssize_t NuCachedSource2::readInternal(off64_t offset, void *data, size_t size) { CHECK_LE(size, (size_t)kHighWaterThreshold); LOGV("readInternal offset %lld size %d", offset, size); Mutex::Autolock autoLock(mLock); if (!mFetching) { mLastAccessPos = offset; restartPrefetcherIfNecessary_l( false, // ignoreLowWaterThreshold true); // force } if (offset < mCacheOffset || offset >= (off64_t)(mCacheOffset + mCache->totalSize())) { static const off64_t kPadding = 256 * 1024; Loading media/libstagefright/include/NuCachedSource2.h +3 −1 Original line number Diff line number Diff line Loading @@ -96,7 +96,9 @@ private: status_t seekInternal_l(off64_t offset); size_t approxDataRemaining_l(status_t *finalStatus); void restartPrefetcherIfNecessary_l(bool ignoreLowWaterThreshold = false); void restartPrefetcherIfNecessary_l( bool ignoreLowWaterThreshold = false, bool force = false); DISALLOW_EVIL_CONSTRUCTORS(NuCachedSource2); }; Loading Loading
media/libstagefright/NuCachedSource2.cpp +18 −6 Original line number Diff line number Diff line Loading @@ -323,25 +323,28 @@ void NuCachedSource2::onRead(const sp<AMessage> &msg) { } void NuCachedSource2::restartPrefetcherIfNecessary_l( bool ignoreLowWaterThreshold) { bool ignoreLowWaterThreshold, bool force) { static const size_t kGrayArea = 1024 * 1024; if (mFetching || mFinalStatus != OK) { return; } if (!ignoreLowWaterThreshold if (!ignoreLowWaterThreshold && !force && mCacheOffset + mCache->totalSize() - mLastAccessPos >= kLowWaterThreshold) { return; } size_t maxBytes = mLastAccessPos - mCacheOffset; if (!force) { if (maxBytes < kGrayArea) { return; } maxBytes -= kGrayArea; } size_t actualBytes = mCache->releaseFromStart(maxBytes); mCacheOffset += actualBytes; Loading Loading @@ -413,10 +416,19 @@ size_t NuCachedSource2::approxDataRemaining_l(status_t *finalStatus) { } ssize_t NuCachedSource2::readInternal(off64_t offset, void *data, size_t size) { CHECK_LE(size, (size_t)kHighWaterThreshold); LOGV("readInternal offset %lld size %d", offset, size); Mutex::Autolock autoLock(mLock); if (!mFetching) { mLastAccessPos = offset; restartPrefetcherIfNecessary_l( false, // ignoreLowWaterThreshold true); // force } if (offset < mCacheOffset || offset >= (off64_t)(mCacheOffset + mCache->totalSize())) { static const off64_t kPadding = 256 * 1024; Loading
media/libstagefright/include/NuCachedSource2.h +3 −1 Original line number Diff line number Diff line Loading @@ -96,7 +96,9 @@ private: status_t seekInternal_l(off64_t offset); size_t approxDataRemaining_l(status_t *finalStatus); void restartPrefetcherIfNecessary_l(bool ignoreLowWaterThreshold = false); void restartPrefetcherIfNecessary_l( bool ignoreLowWaterThreshold = false, bool force = false); DISALLOW_EVIL_CONSTRUCTORS(NuCachedSource2); }; Loading