From 145f8117a32bbf58978e57e2478ebff47a4faff1 Mon Sep 17 00:00:00 2001 From: Changbin Park Date: Tue, 23 Sep 2014 13:57:33 +0900 Subject: [PATCH] Bug 1071359 - Make WebRTC on B2G uses logcat as logging sub-system. r=jesup --HG-- extra : rebase_source : b55353ed698e1016ded9d79bd617c7adcbf06fb3 --- .../src/common/browser_logging/WebRtcLog.cpp | 16 ++++++++++++++++ media/webrtc/trunk/webrtc/build/common.gypi | 1 + 2 files changed, 17 insertions(+) diff --git a/media/webrtc/signaling/src/common/browser_logging/WebRtcLog.cpp b/media/webrtc/signaling/src/common/browser_logging/WebRtcLog.cpp index adb00b29a70b..3d8a4a18cb25 100644 --- a/media/webrtc/signaling/src/common/browser_logging/WebRtcLog.cpp +++ b/media/webrtc/signaling/src/common/browser_logging/WebRtcLog.cpp @@ -7,6 +7,9 @@ #include "prlog.h" #include "prenv.h" #include "webrtc/system_wrappers/interface/trace.h" +#ifdef WEBRTC_GONK +#include "webrtc/system_wrappers/interface/logcat_trace_context.h" +#endif #include "nscore.h" #ifdef MOZILLA_INTERNAL_API @@ -53,6 +56,10 @@ public: }; static WebRtcTraceCallback gWebRtcCallback; +#ifdef WEBRTC_GONK +static webrtc::LogcatTraceContext gWebRtcLogcatCallback; +#endif + #ifdef MOZILLA_INTERNAL_API void GetWebRtcLogPrefs(uint32_t *aTraceMask, nsACString* aLogFile, nsACString *aAECLogDir, bool *aMultiLog) @@ -115,8 +122,13 @@ void ConfigWebRtcLog(uint32_t trace_mask, nsCString &aLogFile, nsCString &aAECLo logFile.Append(default_log); } #elif defined(ANDROID) +#ifdef WEBRTC_GONK + // Special case: use callback to log through logcat. + logFile.Assign("logcat"); +#else // Special case: use callback to pipe to NSPR logging. logFile.Assign("nspr"); +#endif // for AEC, force the user to specify a directory aecLogDir.Assign("/dev/null"); #else @@ -137,6 +149,10 @@ void ConfigWebRtcLog(uint32_t trace_mask, nsCString &aLogFile, nsCString &aAECLo if (trace_mask != 0) { if (aLogFile.EqualsLiteral("nspr")) { webrtc::Trace::SetTraceCallback(&gWebRtcCallback); +#ifdef WEBRTC_GONK + } else if (aLogFile.EqualsLiteral("logcat")) { + webrtc::Trace::SetTraceCallback(&gWebRtcLogcatCallback); +#endif } else { webrtc::Trace::SetTraceFile(aLogFile.get(), multi_log); } diff --git a/media/webrtc/trunk/webrtc/build/common.gypi b/media/webrtc/trunk/webrtc/build/common.gypi index 3ddb7e48f35f..4445ad1166f3 100644 --- a/media/webrtc/trunk/webrtc/build/common.gypi +++ b/media/webrtc/trunk/webrtc/build/common.gypi @@ -188,6 +188,7 @@ ['moz_widget_toolkit_gonk==1', { 'defines' : [ 'WEBRTC_GONK', + 'WEBRTC_DIRECT_TRACE', ], }], ['restrict_webrtc_logging==1', {