am 1024b041: Part of fix for double spins & faster startup
* commit '1024b041e824bb6eb232971fc4a2984d63f7e079': Part of fix for double spins & faster startup
This commit is contained in:
@@ -35,6 +35,7 @@ WVMMediaSource::WVMMediaSource(WVSession *session, WVEsSelector esSelector,
|
||||
mIsLiveStream(isLive),
|
||||
mNewSegment(false),
|
||||
mCryptoInitialized(false),
|
||||
mIsStalled(false),
|
||||
mGroup(NULL),
|
||||
mKeyTime(0),
|
||||
mDts(0),
|
||||
@@ -203,6 +204,8 @@ status_t WVMMediaSource::read(MediaBuffer **buffer, const ReadOptions *options)
|
||||
{
|
||||
Mutex::Autolock autoLock(mLock);
|
||||
|
||||
mIsStalled = false;
|
||||
|
||||
CHECK(mStarted);
|
||||
|
||||
*buffer = NULL;
|
||||
@@ -333,16 +336,20 @@ 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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#define PCR_HZ 90000
|
||||
mKeyTime = (int64_t)mPts * 1000000 / PCR_HZ;
|
||||
|
||||
if (seekNextSync && ((mKeyTime < seekTimeUs) || !syncFrame)) {
|
||||
// drop frames up to next sync if requested
|
||||
mIsStalled = true;
|
||||
usleep(10000);
|
||||
#ifdef REQUIRE_SECURE_BUFFERS
|
||||
mDecryptContext.Initialize(mediaBuf);
|
||||
@@ -351,6 +358,8 @@ status_t WVMMediaSource::read(MediaBuffer **buffer, const ReadOptions *options)
|
||||
continue;
|
||||
}
|
||||
|
||||
mIsStalled = false;
|
||||
|
||||
if (offset + bytesRead < mediaBuf->size())
|
||||
break;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user