diff options
author | Andreas Huber <andih@google.com> | 2011-10-07 10:08:48 -0700 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2011-10-07 10:08:48 -0700 |
commit | 41c95f3642323ec4cfdc84a3bb70537af0da8cca (patch) | |
tree | 3877feb2e90131c49e2ab189c46ed58c407714e1 | |
parent | 851a14eb9443996f29617e84dd8b66281876ae8e (diff) | |
parent | b987d875c6e66ea30b4a443b17ba44b977efe0c2 (diff) | |
download | frameworks_base-41c95f3642323ec4cfdc84a3bb70537af0da8cca.zip frameworks_base-41c95f3642323ec4cfdc84a3bb70537af0da8cca.tar.gz frameworks_base-41c95f3642323ec4cfdc84a3bb70537af0da8cca.tar.bz2 |
Merge "Specifying -1 for both low and highwater marks would not actually do the right thing"
-rw-r--r-- | media/libstagefright/NuCachedSource2.cpp | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/media/libstagefright/NuCachedSource2.cpp b/media/libstagefright/NuCachedSource2.cpp index 2cacfa7..9adb841 100644 --- a/media/libstagefright/NuCachedSource2.cpp +++ b/media/libstagefright/NuCachedSource2.cpp @@ -598,11 +598,10 @@ void NuCachedSource2::updateCacheParamsFromSystemProperty() { void NuCachedSource2::updateCacheParamsFromString(const char *s) { ssize_t lowwaterMarkKb, highwaterMarkKb; - unsigned keepAliveSecs; + int keepAliveSecs; - if (sscanf(s, "%ld/%ld/%u", - &lowwaterMarkKb, &highwaterMarkKb, &keepAliveSecs) != 3 - || lowwaterMarkKb >= highwaterMarkKb) { + if (sscanf(s, "%ld/%ld/%d", + &lowwaterMarkKb, &highwaterMarkKb, &keepAliveSecs) != 3) { LOGE("Failed to parse cache parameters from '%s'.", s); return; } @@ -619,7 +618,18 @@ void NuCachedSource2::updateCacheParamsFromString(const char *s) { mHighwaterThresholdBytes = kDefaultHighWaterThreshold; } - mKeepAliveIntervalUs = keepAliveSecs * 1000000ll; + if (mLowwaterThresholdBytes >= mHighwaterThresholdBytes) { + LOGE("Illegal low/highwater marks specified, reverting to defaults."); + + mLowwaterThresholdBytes = kDefaultLowWaterThreshold; + mHighwaterThresholdBytes = kDefaultHighWaterThreshold; + } + + if (keepAliveSecs >= 0) { + mKeepAliveIntervalUs = keepAliveSecs * 1000000ll; + } else { + mKeepAliveIntervalUs = kDefaultKeepAliveIntervalUs; + } LOGV("lowwater = %d bytes, highwater = %d bytes, keepalive = %lld us", mLowwaterThresholdBytes, |