diff options
author | James Dong <jdong@google.com> | 2011-04-28 11:15:01 -0700 |
---|---|---|
committer | James Dong <jdong@google.com> | 2011-04-28 17:16:03 -0700 |
commit | ae23aaee377578d9601db8d0acff66a4dd40920a (patch) | |
tree | 8d233077e775bf921e55166e10ecb99580c2a49f /media/libstagefright/NuHTTPDataSource.cpp | |
parent | 84f64d2a48a267c6517df69dd757c1ead54db036 (diff) | |
download | frameworks_av-ae23aaee377578d9601db8d0acff66a4dd40920a.zip frameworks_av-ae23aaee377578d9601db8d0acff66a4dd40920a.tar.gz frameworks_av-ae23aaee377578d9601db8d0acff66a4dd40920a.tar.bz2 |
Add avg bandwidth estimate every 2 seconds - do not merge.
This patch is meant for testing only.
We will remove this patch once we tracked down all those spinning issues.
related-to-bug: 4339075
Change-Id: I4cf1927f1067d4f7dbc589ceb3c47407eaf40ae7
Diffstat (limited to 'media/libstagefright/NuHTTPDataSource.cpp')
-rw-r--r-- | media/libstagefright/NuHTTPDataSource.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/media/libstagefright/NuHTTPDataSource.cpp b/media/libstagefright/NuHTTPDataSource.cpp index bee0d5e..62fb732 100644 --- a/media/libstagefright/NuHTTPDataSource.cpp +++ b/media/libstagefright/NuHTTPDataSource.cpp @@ -100,6 +100,7 @@ NuHTTPDataSource::NuHTTPDataSource(uint32_t flags) mNumBandwidthHistoryItems(0), mTotalTransferTimeUs(0), mTotalTransferBytes(0), + mPrevBandwidthMeasureTimeUs(0), mDecryptHandle(NULL), mDrmManagerClient(NULL) { } @@ -534,6 +535,16 @@ void NuHTTPDataSource::addBandwidthMeasurement_l( mTotalTransferBytes -= entry->mNumBytes; mBandwidthHistory.erase(mBandwidthHistory.begin()); --mNumBandwidthHistoryItems; + int64_t timeNowUs = ALooper::GetNowUs(); + if (timeNowUs - mPrevBandwidthMeasureTimeUs > 2000000LL) { + if (mPrevBandwidthMeasureTimeUs != 0) { + double estimatedBandwidth = + ((double)mTotalTransferBytes * 8E3 / mTotalTransferTimeUs); + LOGI("estimated avg bandwidth is %8.2f kbps in the past %lld us", + estimatedBandwidth, timeNowUs - mPrevBandwidthMeasureTimeUs); + } + mPrevBandwidthMeasureTimeUs = timeNowUs; + } } } |