am 3a4d547c: Merge "Don\'t report 100% buffered when the stream ends prematurely." into honeycomb
* commit '3a4d547c588dc3a1abb48988595dc17874660bb8': Don't report 100% buffered when the stream ends prematurely.
This commit is contained in:
@@ -520,8 +520,10 @@ bool AwesomePlayer::getCachedDuration_l(int64_t *durationUs, bool *eos) {
|
||||
*durationUs = mRTSPController->getQueueDurationUs(eos);
|
||||
return true;
|
||||
} else if (mCachedSource != NULL && getBitrate(&bitrate)) {
|
||||
size_t cachedDataRemaining = mCachedSource->approxDataRemaining(eos);
|
||||
status_t finalStatus;
|
||||
size_t cachedDataRemaining = mCachedSource->approxDataRemaining(&finalStatus);
|
||||
*durationUs = cachedDataRemaining * 8000000ll / bitrate;
|
||||
*eos = (finalStatus != OK);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -564,11 +566,14 @@ void AwesomePlayer::onBufferingUpdate() {
|
||||
mBufferingEventPending = false;
|
||||
|
||||
if (mCachedSource != NULL) {
|
||||
bool eos;
|
||||
size_t cachedDataRemaining = mCachedSource->approxDataRemaining(&eos);
|
||||
status_t finalStatus;
|
||||
size_t cachedDataRemaining = mCachedSource->approxDataRemaining(&finalStatus);
|
||||
bool eos = (finalStatus != OK);
|
||||
|
||||
if (eos) {
|
||||
notifyListener_l(MEDIA_BUFFERING_UPDATE, 100);
|
||||
if (finalStatus == ERROR_END_OF_STREAM) {
|
||||
notifyListener_l(MEDIA_BUFFERING_UPDATE, 100);
|
||||
}
|
||||
if (mFlags & PREPARING) {
|
||||
LOGV("cache has reached EOS, prepare is done.");
|
||||
finishAsyncPrepare_l();
|
||||
|
||||
@@ -393,13 +393,13 @@ size_t NuCachedSource2::cachedSize() {
|
||||
return mCacheOffset + mCache->totalSize();
|
||||
}
|
||||
|
||||
size_t NuCachedSource2::approxDataRemaining(bool *eos) {
|
||||
size_t NuCachedSource2::approxDataRemaining(status_t *finalStatus) {
|
||||
Mutex::Autolock autoLock(mLock);
|
||||
return approxDataRemaining_l(eos);
|
||||
return approxDataRemaining_l(finalStatus);
|
||||
}
|
||||
|
||||
size_t NuCachedSource2::approxDataRemaining_l(bool *eos) {
|
||||
*eos = (mFinalStatus != OK);
|
||||
size_t NuCachedSource2::approxDataRemaining_l(status_t *finalStatus) {
|
||||
*finalStatus = mFinalStatus;
|
||||
off64_t lastBytePosCached = mCacheOffset + mCache->totalSize();
|
||||
if (mLastAccessPos < lastBytePosCached) {
|
||||
return lastBytePosCached - mLastAccessPos;
|
||||
@@ -488,4 +488,3 @@ String8 NuCachedSource2::getUri() {
|
||||
return mSource->getUri();
|
||||
}
|
||||
} // namespace android
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@ struct NuCachedSource2 : public DataSource {
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
size_t cachedSize();
|
||||
size_t approxDataRemaining(bool *eos);
|
||||
size_t approxDataRemaining(status_t *finalStatus);
|
||||
|
||||
void resumeFetchingIfNecessary();
|
||||
|
||||
@@ -92,7 +92,7 @@ private:
|
||||
ssize_t readInternal(off64_t offset, void *data, size_t size);
|
||||
status_t seekInternal_l(off64_t offset);
|
||||
|
||||
size_t approxDataRemaining_l(bool *eos);
|
||||
size_t approxDataRemaining_l(status_t *finalStatus);
|
||||
void restartPrefetcherIfNecessary_l(bool ignoreLowWaterThreshold = false);
|
||||
|
||||
DISALLOW_EVIL_CONSTRUCTORS(NuCachedSource2);
|
||||
|
||||
Reference in New Issue
Block a user