Bug 1024288: Add a button to about:webrtc to turn on/off AEC logging r=jib,smaug,unfocused

This commit is contained in:
Randell Jesup 2014-06-12 12:21:38 -04:00
parent e3e7209c97
commit 9d1bc6e5a6
6 changed files with 64 additions and 0 deletions

View File

@ -29,6 +29,9 @@ interface WebrtcGlobalInformation {
// - Subsequently setting a zero debug level writes that log to disk.
static attribute long debugLevel;
// WebRTC AEC debugging enable
static attribute boolean aecDebug;
};

View File

@ -28,6 +28,15 @@ static PRLogModuleInfo* GetWebRtcTraceLog()
return sLog;
}
static PRLogModuleInfo* GetWebRtcAECLog()
{
static PRLogModuleInfo *sLog;
if (!sLog) {
sLog = PR_NewLogModule("AEC");
}
return sLog;
}
class WebRtcTraceCallback: public webrtc::TraceCallback
{
public:
@ -48,6 +57,7 @@ void GetWebRtcLogPrefs(uint32_t *aTraceMask, nsACString* aLogFile, bool *aMultiL
*aMultiLog = mozilla::Preferences::GetBool("media.webrtc.debug.multi_log");
*aTraceMask = mozilla::Preferences::GetUint("media.webrtc.debug.trace_mask");
mozilla::Preferences::GetCString("media.webrtc.debug.log_file", aLogFile);
webrtc::Trace::set_aec_debug_size(mozilla::Preferences::GetUint("media.webrtc.debug.aec_dump_max_size"));
}
#endif
@ -70,6 +80,11 @@ void CheckOverrides(uint32_t *aTraceMask, nsACString *aLogFile, bool *aMultiLog)
*aTraceMask = log_info->level;
}
log_info = GetWebRtcAECLog();
if (log_info && (log_info->level != 0)) {
webrtc::Trace::set_aec_debug(true);
}
const char *file_name = PR_GetEnv("WEBRTC_TRACE_FILE");
if (file_name) {
aLogFile->Assign(file_name);

View File

@ -23,6 +23,7 @@
#include "runnable_utils.h"
#include "PeerConnectionCtx.h"
#include "PeerConnectionImpl.h"
#include "webrtc/system_wrappers/interface/trace.h"
using sipcc::PeerConnectionImpl;
using sipcc::PeerConnectionCtx;
@ -233,6 +234,7 @@ WebrtcGlobalInformation::GetLogging(
}
static int32_t sLastSetLevel = 0;
static bool sLastAECDebug = false;
void
WebrtcGlobalInformation::SetDebugLevel(const GlobalObject& aGlobal, int32_t aLevel)
@ -247,6 +249,20 @@ WebrtcGlobalInformation::DebugLevel(const GlobalObject& aGlobal)
return sLastSetLevel;
}
void
WebrtcGlobalInformation::SetAecDebug(const GlobalObject& aGlobal, bool aEnable)
{
webrtc::Trace::set_aec_debug(aEnable);
sLastAECDebug = aEnable;
}
bool
WebrtcGlobalInformation::AecDebug(const GlobalObject& aGlobal)
{
return sLastAECDebug;
}
struct StreamResult {
StreamResult() : candidateTypeBitpattern(0), streamSucceeded(false) {}
uint8_t candidateTypeBitpattern;

View File

@ -36,6 +36,9 @@ public:
static void SetDebugLevel(const GlobalObject& aGlobal, int32_t aLevel);
static int32_t DebugLevel(const GlobalObject& aGlobal);
static void SetAecDebug(const GlobalObject& aGlobal, bool aEnable);
static bool AecDebug(const GlobalObject& aGlobal);
static void StoreLongTermICEStatistics(sipcc::PeerConnectionImpl& aPc);
private:

View File

@ -265,6 +265,7 @@ pref("media.webrtc.debug.log_file", "");
#else
pref("media.webrtc.debug.log_file", "/tmp/WebRTC.log");
#endif
pref("media.webrtc.debug.aec_dump_max_size", 4194304); // 4MB
#ifdef MOZ_WIDGET_GONK
pref("media.navigator.video.default_width",320);

View File

@ -377,6 +377,11 @@ function onLoad() {
} else {
setDebugButton(false);
}
if (WebrtcGlobalInformation.aecDebug) {
setAECDebugButton(true);
} else {
setAECDebugButton(false);
}
}
function startDebugMode() {
@ -395,6 +400,24 @@ function setDebugButton(on) {
button.onclick = on ? stopDebugMode : startDebugMode;
}
function startAECDebugMode() {
WebrtcGlobalInformation.aecDebug = true;
setAECDebugButton(true);
}
function stopAECDebugMode() {
WebrtcGlobalInformation.aecDebug = false;
setAECDebugButton(false);
}
function setAECDebugButton(on) {
var button = document.getElementById("aec-debug-toggle-button");
button.innerHTML = on ? "Stop AEC logging" : "Start AEC logging";
button.onclick = on ? stopAECDebugMode : startAECDebugMode;
}
</script>
<body id="body" onload="onLoad()">
@ -406,6 +429,9 @@ function setDebugButton(on) {
<button id="debug-toggle-button" onclick="startDebugMode()">
Start debug mode
</button>
<button id="aec-debug-toggle-button" onclick="startAECDebugMode()">
Start AEC logging
</button>
<div id="logs">
</div>
</body>