summaryrefslogtreecommitdiffstats
path: root/media/libstagefright/foundation
diff options
context:
space:
mode:
authorLajos Molnar <lajos@google.com>2015-07-28 15:11:14 -0700
committerLajos Molnar <lajos@google.com>2015-07-29 15:44:30 -0700
commit7c3c275b4d0100eec36f7b66637a7aace7971466 (patch)
tree7fcd01c703060898c9355d99615afff7b13c7958 /media/libstagefright/foundation
parenta7d36c184562cc15b2d665ff25c485fefdcfbabd (diff)
downloadframeworks_av-7c3c275b4d0100eec36f7b66637a7aace7971466.zip
frameworks_av-7c3c275b4d0100eec36f7b66637a7aace7971466.tar.gz
frameworks_av-7c3c275b4d0100eec36f7b66637a7aace7971466.tar.bz2
stagefright: disable automatic experiments
allow manually-enabled experiments only in eng and userdebug builds Bug: 20894667 Change-Id: Ie6c93e9482a84ed3aaf6aa0abd909f14cfea4e9b
Diffstat (limited to 'media/libstagefright/foundation')
-rw-r--r--media/libstagefright/foundation/ADebug.cpp22
1 files changed, 21 insertions, 1 deletions
diff --git a/media/libstagefright/foundation/ADebug.cpp b/media/libstagefright/foundation/ADebug.cpp
index 24fa561..2c5f544 100644
--- a/media/libstagefright/foundation/ADebug.cpp
+++ b/media/libstagefright/foundation/ADebug.cpp
@@ -29,6 +29,8 @@
#include <AStringUtils.h>
#include <AUtils.h>
+#define UNUSED(x) ((void)(x))
+
namespace android {
//static
@@ -130,7 +132,24 @@ bool ADebug::getExperimentFlag(
long level = GetLevelFromProperty(name, "debug.stagefright.experiments", undefined);
if (level != undefined) {
ALOGI("experiment '%s': %s from property", name, level ? "ENABLED" : "disabled");
- return level != 0;
+ return allow && (level != 0);
+ }
+
+#ifndef ENABLE_STAGEFRIGHT_AUTO_EXPERIMENTS
+ UNUSED(modulo);
+ UNUSED(limit);
+ UNUSED(plus);
+ UNUSED(timeDivisor);
+ return false;
+#else
+ // Disable automatic experiments in "non-experimental" builds (that is, _all_ builds
+ // as there is no "experimental" build).
+ // TODO: change build type to enable automatic experiments in the future for some builds
+ char value[PROPERTY_VALUE_MAX];
+ if (property_get("ro.build.type", value, NULL)) {
+ if (strcmp(value, "experimental")) {
+ return false;
+ }
}
static volatile int32_t haveSerial = 0;
@@ -164,6 +183,7 @@ bool ADebug::getExperimentFlag(
bool enable = allow && (counter % modulo < limit);
ALOGI("experiment '%s': %s", name, enable ? "ENABLED" : "disabled");
return enable;
+#endif
}
} // namespace android