summaryrefslogtreecommitdiffstats
path: root/variablespeed
diff options
context:
space:
mode:
authorFlavio Lerda <flerda@google.com>2011-09-02 16:40:13 +0100
committerFlavio Lerda <flerda@google.com>2011-09-05 10:40:33 +0100
commite863816a885b0a0e1a0930969fe3e818f68f2478 (patch)
tree6f4a864dd0ee417aaa0adbdefe1ef21648837310 /variablespeed
parentdc442b4d99512bf7c41ee5ceae6c93a3c3568b57 (diff)
downloadandroid_frameworks_ex-e863816a885b0a0e1a0930969fe3e818f68f2478.tar.gz
android_frameworks_ex-e863816a885b0a0e1a0930969fe3e818f68f2478.tar.bz2
android_frameworks_ex-e863816a885b0a0e1a0930969fe3e818f68f2478.zip
Enables detailed logging during variable speed playback.
This commit adds support for dynamically enabling logging in the variable speed library if log.tag.VariableSpeed is set. After this change, you can enable logging by running: adb shell setprop log.tag.VariableSpeed 1 Logging will be disabled after reboot or after running: adb shell setprop log.tag.VariableSpeed "" The logging in the library is quite verbose, so we do not want to enable it by default. Bug: 5253004 Change-Id: I3addde5552093eb0c4926b67245d578a7da0fb7a
Diffstat (limited to 'variablespeed')
-rw-r--r--variablespeed/jni/variablespeed.cc20
1 files changed, 18 insertions, 2 deletions
diff --git a/variablespeed/jni/variablespeed.cc b/variablespeed/jni/variablespeed.cc
index 6162242..88eb783 100644
--- a/variablespeed/jni/variablespeed.cc
+++ b/variablespeed/jni/variablespeed.cc
@@ -26,6 +26,8 @@
#include <vector>
+#include <sys/system_properties.h>
+
// ****************************************************************************
// Constants, utility methods, structures and other miscellany used throughout
// this file.
@@ -91,6 +93,18 @@ void CheckSLResult_Real(const char* message, SLresult result, int line) {
CHECK(SL_RESULT_SUCCESS == result);
}
+// Whether logging should be enabled. Only used if LOG_OPENSL_API_CALL is
+// defined to use it.
+bool gLogEnabled = false;
+// The property to set in order to enable logging.
+const char *const kLogTagVariableSpeed = "log.tag.VariableSpeed";
+
+bool ShouldLog() {
+ char buffer[PROP_VALUE_MAX];
+ __system_property_get(kLogTagVariableSpeed, buffer);
+ return strlen(buffer) > 0;
+}
+
} // namespace
// ****************************************************************************
@@ -155,8 +169,8 @@ static void DecodingEventCb(SLPlayItf caller, void*, SLuint32 event) {
// ****************************************************************************
// Macros for making working with OpenSL easier.
-// #define LOG_OPENSL_API_CALL(string) LOGV(string)
-#define LOG_OPENSL_API_CALL(string) false
+// Log based on the value of a property.
+#define LOG_OPENSL_API_CALL(string) (gLogEnabled && LOGV(string))
// The regular macro: log an api call, make the api call, check the result.
#define OpenSL(obj, method, ...) \
@@ -285,6 +299,8 @@ AudioEngine::AudioEngine(size_t targetFrames, float windowDuration,
audioStreamType_(audioStreamType),
totalDurationMs_(0), decoderCurrentPosition_(0), startRequested_(false),
stopRequested_(false), finishedDecoding_(false) {
+ // Determine whether we should log calls.
+ gLogEnabled = ShouldLog();
}
AudioEngine::~AudioEngine() {