Backed out changeset 5d1c109f708b (bug 1256430) for android build bustage CLOSED TREE
authorWes Kocher <wkocher@mozilla.com>
Fri, 25 Mar 2016 11:56:52 -0700
changeset 290479 d210a03627b7b34dac01f4eaaf6e4def2635233c
parent 290478 ff20990e88e15a5002d63b2cfd8aa390138c1cb4
child 290480 aaf2b3f9970e9d5e81d6f8d631afe715e2b9f982
push id19656
push usergwagner@mozilla.com
push dateMon, 04 Apr 2016 13:43:23 +0000
treeherderb2g-inbound@e99061fde28a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1256430
milestone48.0a1
backs out5d1c109f708b9a24bb5f4ce68e7972499378c7e9
Backed out changeset 5d1c109f708b (bug 1256430) for android build bustage CLOSED TREE MozReview-Commit-ID: dVx9S3N7y5
media/webrtc/signaling/src/common/browser_logging/WebRtcLog.cpp
media/webrtc/signaling/src/common/browser_logging/WebRtcLog.h
media/webrtc/signaling/src/peerconnection/WebrtcGlobalInformation.cpp
--- a/media/webrtc/signaling/src/common/browser_logging/WebRtcLog.cpp
+++ b/media/webrtc/signaling/src/common/browser_logging/WebRtcLog.cpp
@@ -108,41 +108,53 @@ void ConfigWebRtcLog(uint32_t trace_mask
 {
   if (gWebRtcTraceLoggingOn) {
     return;
   }
 
 #if defined(ANDROID)
   // Special case: use callback to pipe to NSPR logging.
   aLogFile.Assign(default_log_name);
+  // For AEC, do not use a default value: force the user to specify a directory.
+  if (aAECLogDir.IsEmpty()) {
+    aAECLogDir.Assign(default_tmp_dir);
+  }
+#else
+  if (aLogFile.IsEmpty() || aAECLogDir.IsEmpty()) {
+    nsCOMPtr<nsIFile> tempDir;
+    nsresult rv = NS_GetSpecialDirectory(NS_OS_TEMP_DIR, getter_AddRefs(tempDir));
+
+    if (NS_SUCCEEDED(rv)) {
+      if (aAECLogDir.IsEmpty()) {
+        tempDir->GetNativePath(aAECLogDir);
+      }
+
+      if (aLogFile.IsEmpty()) {
+        tempDir->AppendNative(default_log_name);
+        tempDir->GetNativePath(aLogFile);
+      }
+    }
+  }
 #endif
 
   webrtc::Trace::set_level_filter(trace_mask);
+  webrtc::Trace::set_aec_debug_filename(aAECLogDir.get());
 
   if (trace_mask != 0) {
     if (aLogFile.EqualsLiteral("nspr")) {
       webrtc::Trace::SetTraceCallback(&gWebRtcCallback);
     } else {
       webrtc::Trace::SetTraceFile(aLogFile.get(), multi_log);
     }
   }
-
-  if (aLogFile.IsEmpty()) {
-    nsCOMPtr<nsIFile> tempDir;
-    nsresult rv = NS_GetSpecialDirectory(NS_OS_TEMP_DIR, getter_AddRefs(tempDir));
-    if (NS_SUCCEEDED(rv)) {
-      tempDir->AppendNative(default_log_name);
-      tempDir->GetNativePath(aLogFile);
-    }
-  }
-
 #if !defined(MOZILLA_EXTERNAL_LINKAGE)
   if (XRE_IsParentProcess()) {
-    // Capture the final choice for the trace setting.
+    // Capture the final choices for the trace settings.
     mozilla::Preferences::SetCString("media.webrtc.debug.log_file", aLogFile);
+    mozilla::Preferences::SetCString("media.webrtc.debug.aec_log_dir", aAECLogDir);
   }
 #endif
   return;
 }
 
 void StartWebRtcLog(uint32_t log_level)
 {
   if (gWebRtcTraceLoggingOn && log_level != 0) {
@@ -194,61 +206,8 @@ void EnableWebRtcLog()
   ConfigWebRtcLog(trace_mask, log_file, aec_log_dir, multi_log);
   return;
 }
 
 void StopWebRtcLog()
 {
   webrtc::Trace::SetTraceFile(nullptr);
 }
-
-void ConfigAecLog(nsCString &aAECLogDir) {
-  if (webrtc::Trace::aec_debug()) {
-    return;
-  }
-#if defined(ANDROID)
-  // For AEC, do not use a default value: force the user to specify a directory.
-  if (aAECLogDir.IsEmpty()) {
-    aAECLogDir.Assign(default_tmp_dir);
-  }
-#else
-  if (aAECLogDir.IsEmpty()) {
-    nsCOMPtr<nsIFile> tempDir;
-    nsresult rv = NS_GetSpecialDirectory(NS_OS_TEMP_DIR, getter_AddRefs(tempDir));
-    if (NS_SUCCEEDED(rv)) {
-      if (aAECLogDir.IsEmpty()) {
-        tempDir->GetNativePath(aAECLogDir);
-      }
-    }
-  }
-#endif
-  webrtc::Trace::set_aec_debug_filename(aAECLogDir.get());
-#if !defined(MOZILLA_EXTERNAL_LINKAGE)
-  if (XRE_IsParentProcess()) {
-    // Capture the final choice for the aec_log_dir setting.
-    mozilla::Preferences::SetCString("media.webrtc.debug.aec_log_dir", aAECLogDir);
-  }
-#endif
-}
-
-void StartAecLog()
-{
-  if (webrtc::Trace::aec_debug()) {
-    return;
-  }
-  uint32_t trace_mask = 0;
-  bool multi_log = false;
-  nsAutoCString log_file;
-  nsAutoCString aec_log_dir;
-
-#ifdef MOZILLA_INTERNAL_API
-  GetWebRtcLogPrefs(&trace_mask, &log_file, &aec_log_dir, &multi_log);
-#endif
-  CheckOverrides(&trace_mask, &log_file, &multi_log);
-  ConfigAecLog(aec_log_dir);
-
-  webrtc::Trace::set_aec_debug(true);
-}
-
-void StopAecLog()
-{
-  webrtc::Trace::set_aec_debug(false);
-}
--- a/media/webrtc/signaling/src/common/browser_logging/WebRtcLog.h
+++ b/media/webrtc/signaling/src/common/browser_logging/WebRtcLog.h
@@ -2,15 +2,13 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef WEBRTCLOG_H_
 #define WEBRTCLOG_H_
 
 #include "webrtc/common_types.h"
 
-void StartAecLog();
-void StopAecLog();
 void StartWebRtcLog(uint32_t log_level = webrtc::kTraceDefault);
 void EnableWebRtcLog();
 void StopWebRtcLog();
 
 #endif
--- a/media/webrtc/signaling/src/peerconnection/WebrtcGlobalInformation.cpp
+++ b/media/webrtc/signaling/src/peerconnection/WebrtcGlobalInformation.cpp
@@ -676,22 +676,18 @@ int32_t
 WebrtcGlobalInformation::DebugLevel(const GlobalObject& aGlobal)
 {
   return sLastSetLevel;
 }
 
 void
 WebrtcGlobalInformation::SetAecDebug(const GlobalObject& aGlobal, bool aEnable)
 {
-  if( aEnable ) {
-    StartAecLog();
-  } else {
-    StopAecLog();
-  }
-
+  StartWebRtcLog(sLastSetLevel); // to make it read the aec path
+  webrtc::Trace::set_aec_debug(aEnable);
   sLastAECDebug = aEnable;
 
   for (auto& cp : WebrtcContentParents::GetAll()){
     Unused << cp->SendSetAecLogging(aEnable);
   }
 }
 
 bool
@@ -880,21 +876,18 @@ WebrtcGlobalChild::RecvClearLogRequest()
   RunLogClear();
   return true;
 }
 
 bool
 WebrtcGlobalChild::RecvSetAecLogging(const bool& aEnable)
 {
   if (!mShutdown) {
-    if( aEnable ) {
-      StartAecLog();
-    } else {
-      StopAecLog();
-    }
+    StartWebRtcLog(sLastSetLevel); // to make it read the aec path
+    webrtc::Trace::set_aec_debug(aEnable);
   }
   return true;
 }
 
 bool
 WebrtcGlobalChild::RecvSetDebugMode(const int& aLevel)
 {
   if (!mShutdown) {