summaryrefslogtreecommitdiffstats
path: root/media/libstagefright
diff options
context:
space:
mode:
authorAndreas Huber <andih@google.com>2011-10-07 10:08:48 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2011-10-07 10:08:48 -0700
commite87a2f05f39203dff8914b7612b1b2a709aeb75f (patch)
treec4d2d9b0e13b37cc102458072978f7f2562449f9 /media/libstagefright
parent5861a9a98c641261c4807c976c750e4611b3a57d (diff)
parent0b8cd8b0cf1489f8f7c0b2c4d7ea8fea70ca93a1 (diff)
downloadframeworks_av-e87a2f05f39203dff8914b7612b1b2a709aeb75f.zip
frameworks_av-e87a2f05f39203dff8914b7612b1b2a709aeb75f.tar.gz
frameworks_av-e87a2f05f39203dff8914b7612b1b2a709aeb75f.tar.bz2
Merge "Specifying -1 for both low and highwater marks would not actually do the right thing"
Diffstat (limited to 'media/libstagefright')
-rw-r--r--media/libstagefright/NuCachedSource2.cpp20
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,