summaryrefslogtreecommitdiffstats
path: root/media/libstagefright/chromium_http
diff options
context:
space:
mode:
authorJames Dong <jdong@google.com>2011-05-25 19:37:03 -0700
committerJames Dong <jdong@google.com>2011-05-31 15:23:25 -0700
commit5b1b8a93a07326f1cbc627f09e02988375189e0a (patch)
tree1da7ba8c401fb96b4de5fab790fba8e51eea78f6 /media/libstagefright/chromium_http
parent65580f9adf6c4d98449ad0716488f9fe3869aa5a (diff)
downloadframeworks_av-5b1b8a93a07326f1cbc627f09e02988375189e0a.zip
frameworks_av-5b1b8a93a07326f1cbc627f09e02988375189e0a.tar.gz
frameworks_av-5b1b8a93a07326f1cbc627f09e02988375189e0a.tar.bz2
Send estimated bandwidth value as informational event when cache fetcher pauses
o Application can make informed decision about the available network bandwidth when cache fetcher pauses. o Application can also adjust how frequently the bandwidth is estimated within a range from one second to one minute. Change-Id: I90068001343e79da1886de03c565537787e1580b
Diffstat (limited to 'media/libstagefright/chromium_http')
-rw-r--r--media/libstagefright/chromium_http/ChromiumHTTPDataSource.cpp35
1 files changed, 1 insertions, 34 deletions
diff --git a/media/libstagefright/chromium_http/ChromiumHTTPDataSource.cpp b/media/libstagefright/chromium_http/ChromiumHTTPDataSource.cpp
index 1096717..ad1f342 100644
--- a/media/libstagefright/chromium_http/ChromiumHTTPDataSource.cpp
+++ b/media/libstagefright/chromium_http/ChromiumHTTPDataSource.cpp
@@ -34,9 +34,6 @@ ChromiumHTTPDataSource::ChromiumHTTPDataSource(uint32_t flags)
mCurrentOffset(0),
mIOResult(OK),
mContentSize(-1),
- mNumBandwidthHistoryItems(0),
- mTotalTransferTimeUs(0),
- mTotalTransferBytes(0),
mDecryptHandle(NULL),
mDrmManagerClient(NULL) {
mDelegate->setOwner(this);
@@ -188,7 +185,7 @@ ssize_t ChromiumHTTPDataSource::readAt(off64_t offset, void *data, size_t size)
// The read operation was successful, mIOResult contains
// the number of bytes read.
- addBandwidthMeasurement_l(mIOResult, delayUs);
+ addBandwidthMeasurement(mIOResult, delayUs);
mCurrentOffset += mIOResult;
return mIOResult;
@@ -246,36 +243,6 @@ void ChromiumHTTPDataSource::onDisconnectComplete() {
clearDRMState_l();
}
-void ChromiumHTTPDataSource::addBandwidthMeasurement_l(
- size_t numBytes, int64_t delayUs) {
- BandwidthEntry entry;
- entry.mDelayUs = delayUs;
- entry.mNumBytes = numBytes;
- mTotalTransferTimeUs += delayUs;
- mTotalTransferBytes += numBytes;
-
- mBandwidthHistory.push_back(entry);
- if (++mNumBandwidthHistoryItems > 100) {
- BandwidthEntry *entry = &*mBandwidthHistory.begin();
- mTotalTransferTimeUs -= entry->mDelayUs;
- mTotalTransferBytes -= entry->mNumBytes;
- mBandwidthHistory.erase(mBandwidthHistory.begin());
- --mNumBandwidthHistoryItems;
- }
-}
-
-bool ChromiumHTTPDataSource::estimateBandwidth(int32_t *bandwidth_bps) {
- Mutex::Autolock autoLock(mLock);
-
- if (mNumBandwidthHistoryItems < 2) {
- return false;
- }
-
- *bandwidth_bps = ((double)mTotalTransferBytes * 8E6 / mTotalTransferTimeUs);
-
- return true;
-}
-
sp<DecryptHandle> ChromiumHTTPDataSource::DrmInitialization() {
Mutex::Autolock autoLock(mLock);