Bug 685236 - Workaround for WebRTC. r=jesup
authorMasatoshi Kimura <VYV03354@nifty.ne.jp>
Fri, 15 Dec 2017 21:42:49 +0900
changeset 456157 e734b0be9a1c801e084658323d3df6363dd3027d
parent 456156 6764713f1dea1dc453c9e395a4f5f3a6da30040f
child 456158 7d33cca73ff0b808eacc100d5101b3cd53231309
push id1683
push usersfraser@mozilla.com
push dateThu, 26 Apr 2018 16:43:40 +0000
treeherdermozilla-release@5af6cb21869d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjesup
bugs685236
milestone60.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 685236 - Workaround for WebRTC. r=jesup MozReview-Commit-ID: 8gdmPmF4V4b
media/webrtc/signaling/src/common/browser_logging/WebRtcLog.cpp
--- a/media/webrtc/signaling/src/common/browser_logging/WebRtcLog.cpp
+++ b/media/webrtc/signaling/src/common/browser_logging/WebRtcLog.cpp
@@ -14,16 +14,17 @@
 #include "nscore.h"
 #include "nsString.h"
 #include "nsXULAppAPI.h"
 #include "mozilla/Preferences.h"
 
 #include "nsIFile.h"
 #include "nsDirectoryServiceUtils.h"
 #include "nsDirectoryServiceDefs.h"
+#include "nsNativeCharsetUtils.h"
 
 using mozilla::LogLevel;
 
 static int gWebRtcTraceLoggingOn = 0;
 
 #if defined(ANDROID)
 static const char *default_tmp_dir = "/dev/null";
 static const char *default_log_name = "nspr";
@@ -183,17 +184,24 @@ void ConfigWebRtcLog(mozilla::LogLevel l
     rtc::LogMessage::SetLogToStderr(false);
   }
 
   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);
+#ifdef XP_WIN
+      // WebRTC wants a path encoded in the native charset, not UTF-8.
+      nsAutoString logFile;
+      tempDir->GetPath(logFile);
+      NS_CopyUnicodeToNative(logFile, aLogFile);
+#else
       tempDir->GetNativePath(aLogFile);
+#endif
     }
   }
 #endif
 
   if (XRE_IsParentProcess()) {
     // Capture the final choice for the trace setting.
     mozilla::Preferences::SetCString("media.webrtc.debug.log_file", aLogFile);
   }
@@ -263,17 +271,24 @@ nsCString ConfigAecLog() {
     return EmptyCString();
   }
 #if defined(ANDROID)
   aecLogDir.Assign(default_tmp_dir);
 #else
   nsCOMPtr<nsIFile> tempDir;
   nsresult rv = NS_GetSpecialDirectory(NS_OS_TEMP_DIR, getter_AddRefs(tempDir));
   if (NS_SUCCEEDED(rv)) {
+#ifdef XP_WIN
+    // WebRTC wants a path encoded in the native charset, not UTF-8.
+    nsAutoString temp;
+    tempDir->GetPath(temp);
+    NS_CopyUnicodeToNative(temp, aecLogDir);
+#else
     tempDir->GetNativePath(aecLogDir);
+#endif
   }
 #endif
   webrtc::Trace::set_aec_debug_filename(aecLogDir.get());
 
   return aecLogDir;
 }
 
 nsCString StartAecLog()