summaryrefslogtreecommitdiffstats
path: root/media/libstagefright/NuCachedSource2.cpp
diff options
context:
space:
mode:
authorAndreas Huber <andih@google.com>2010-11-11 15:37:17 -0800
committerAndreas Huber <andih@google.com>2010-11-11 15:37:17 -0800
commit34ef0f32c8fc0186236a27e07405328cc1f7c56d (patch)
tree0625b59a0b78550160ae46f047a8e7443664132e /media/libstagefright/NuCachedSource2.cpp
parent7ce05cf6009a2fbbceb3d2c0ff639473d0b7d6a9 (diff)
downloadframeworks_av-34ef0f32c8fc0186236a27e07405328cc1f7c56d.zip
frameworks_av-34ef0f32c8fc0186236a27e07405328cc1f7c56d.tar.gz
frameworks_av-34ef0f32c8fc0186236a27e07405328cc1f7c56d.tar.bz2
Make sure the prefetcher is actively fetching data if we pause playback due to cache underrun.
Change-Id: Id5f4b7a0387137380dcd39995390a8e0d084b4b3 Conflicts: media/libstagefright/AwesomePlayer.cpp
Diffstat (limited to 'media/libstagefright/NuCachedSource2.cpp')
-rw-r--r--media/libstagefright/NuCachedSource2.cpp14
1 files changed, 11 insertions, 3 deletions
diff --git a/media/libstagefright/NuCachedSource2.cpp b/media/libstagefright/NuCachedSource2.cpp
index a69c396..4a2402b 100644
--- a/media/libstagefright/NuCachedSource2.cpp
+++ b/media/libstagefright/NuCachedSource2.cpp
@@ -325,15 +325,17 @@ void NuCachedSource2::onRead(const sp<AMessage> &msg) {
mCondition.signal();
}
-void NuCachedSource2::restartPrefetcherIfNecessary_l() {
+void NuCachedSource2::restartPrefetcherIfNecessary_l(
+ bool ignoreLowWaterThreshold) {
static const size_t kGrayArea = 256 * 1024;
if (mFetching || mFinalStatus != OK) {
return;
}
- if (mCacheOffset + mCache->totalSize() - mLastAccessPos
- >= kLowWaterThreshold) {
+ if (!ignoreLowWaterThreshold
+ && mCacheOffset + mCache->totalSize() - mLastAccessPos
+ >= kLowWaterThreshold) {
return;
}
@@ -510,6 +512,12 @@ void NuCachedSource2::onSuspend() {
mSuspended = true;
}
+void NuCachedSource2::resumeFetchingIfNecessary() {
+ Mutex::Autolock autoLock(mLock);
+
+ restartPrefetcherIfNecessary_l(true /* ignore low water threshold */);
+}
+
DecryptHandle* NuCachedSource2::DrmInitialization(DrmManagerClient* client) {
return mSource->DrmInitialization(client);
}