diff options
author | Andreas Huber <andih@google.com> | 2010-11-11 15:37:17 -0800 |
---|---|---|
committer | Andreas Huber <andih@google.com> | 2010-11-11 15:37:17 -0800 |
commit | 34ef0f32c8fc0186236a27e07405328cc1f7c56d (patch) | |
tree | 0625b59a0b78550160ae46f047a8e7443664132e /media/libstagefright/AwesomePlayer.cpp | |
parent | 7ce05cf6009a2fbbceb3d2c0ff639473d0b7d6a9 (diff) | |
download | frameworks_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/AwesomePlayer.cpp')
-rw-r--r-- | media/libstagefright/AwesomePlayer.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/media/libstagefright/AwesomePlayer.cpp b/media/libstagefright/AwesomePlayer.cpp index 4e1969b..f084e28 100644 --- a/media/libstagefright/AwesomePlayer.cpp +++ b/media/libstagefright/AwesomePlayer.cpp @@ -564,6 +564,12 @@ bool AwesomePlayer::getCachedDuration_l(int64_t *durationUs, bool *eos) { return false; } +void AwesomePlayer::ensureCacheIsFetching_l() { + if (mCachedSource != NULL) { + mCachedSource->resumeFetchingIfNecessary(); + } +} + void AwesomePlayer::onBufferingUpdate() { Mutex::Autolock autoLock(mLock); if (!mBufferingEventPending) { @@ -606,6 +612,7 @@ void AwesomePlayer::onBufferingUpdate() { kLowWaterMarkBytes); mFlags |= CACHE_UNDERRUN; pause_l(); + ensureCacheIsFetching_l(); notifyListener_l(MEDIA_INFO, MEDIA_INFO_BUFFERING_START); } else if (eos || cachedDataRemaining > kHighWaterMarkBytes) { if (mFlags & CACHE_UNDERRUN) { @@ -627,12 +634,16 @@ void AwesomePlayer::onBufferingUpdate() { int64_t cachedDurationUs; bool eos; if (getCachedDuration_l(&cachedDurationUs, &eos)) { + LOGV("cachedDurationUs = %.2f secs, eos=%d", + cachedDurationUs / 1E6, eos); + if ((mFlags & PLAYING) && !eos && (cachedDurationUs < kLowWaterMarkUs)) { LOGI("cache is running low (%.2f secs) , pausing.", cachedDurationUs / 1E6); mFlags |= CACHE_UNDERRUN; pause_l(); + ensureCacheIsFetching_l(); notifyListener_l(MEDIA_INFO, MEDIA_INFO_BUFFERING_START); } else if (eos || cachedDurationUs > kHighWaterMarkUs) { if (mFlags & CACHE_UNDERRUN) { |