[WVDRM] Fix for stuttering on low bandwidth

Reintroduces the play/pause rebuffering logic we eliminated
in JB zero day to fix double spins and slow startup - but
activates that logic only based on a comparison of the
current bandwidth measurement and the lowest bitrate track
in the movie.

Needs to be submitted with related changes in /frameworks/av

bug: 7230071
Change-Id: Ib3859a961bd3901a9c4df01eeab2b8b75f49aefe
This commit is contained in:
Jeff Tinker
2012-10-01 13:08:11 -07:00
parent 59e30852dd
commit 54993c50e9
3 changed files with 24 additions and 17 deletions

View File

@@ -37,7 +37,6 @@ WVMMediaSource::WVMMediaSource(WVSession *session, WVEsSelector esSelector,
mIsLiveStream(isLive),
mNewSegment(false),
mCryptoInitialized(false),
mIsStalled(false),
mStripADTS(false),
mGroup(NULL),
mKeyTime(0),
@@ -214,8 +213,6 @@ status_t WVMMediaSource::read(MediaBuffer **buffer, const ReadOptions *options)
{
Mutex::Autolock autoLock(mLock);
mIsStalled = false;
CHECK(mStarted);
*buffer = NULL;
@@ -351,8 +348,6 @@ status_t WVMMediaSource::read(MediaBuffer **buffer, const ReadOptions *options)
return ERROR_IO;
} else {
// Didn't get anything, sleep a bit so we don't hog the CPU then try again
if (retryCount > 10)
mIsStalled = true;
usleep(10000);
continue;
}
@@ -364,15 +359,12 @@ status_t WVMMediaSource::read(MediaBuffer **buffer, const ReadOptions *options)
if (seekNextSync && ((mKeyTime < seekTimeUs) || !syncFrame)) {
// drop frames up to next sync if requested
mIsStalled = true;
usleep(10000);
mDecryptContext.Initialize(mediaBuf);
mEncryptedSizes.clear();
continue;
}
mIsStalled = false;
if (offset + bytesRead < mediaBuf->size())
break;