Bug 1847818 - restore aec logging from about:webrtc. r=ng,webrtc-reviewers

Differential Revision: https://phabricator.services.mozilla.com/D185709
This commit is contained in:
Michael Froman 2023-08-08 22:51:56 +00:00
parent a157f7fe17
commit c4a5d9155e
5 changed files with 17 additions and 4 deletions

View File

@ -26,6 +26,7 @@
#if WEBRTC_APM_DEBUG_DUMP == 1
#include "common_audio/wav_file.h"
#include "rtc_base/checks.h"
#include "rtc_base/logging.h"
#include "rtc_base/string_utils.h"
#endif
@ -395,7 +396,7 @@ class ApmDataDumper {
// Cheat and use aec_near as a stand-in for "size of the largest file"
// in the dump. We're looking to limit the total time, and that's a
// reasonable stand-in.
if (strcmp(name, "aec_near") == 0) {
if (strcmp(name.data(), "aec_near") == 0) {
updateDebugWritten(v_length * sizeof(float));
}
}
@ -439,7 +440,7 @@ class ApmDataDumper {
void updateDebugWritten(uint32_t amount) {
debug_written_ += amount;
if (debug_written_ >= webrtc::Trace::aec_debug_size()) {
if (debug_written_ >= rtc::LogMessage::aec_debug_size()) {
SetActivated(false);
}
}

View File

@ -425,6 +425,12 @@ rtc_library("logging") {
"//third_party/abseil-cpp/absl/types:optional",
]
# Added to allow including apm_data_dumper.h in rtc_base/logging.cc
# for Mozilla controlling aec logging from about:webrtc.
if (build_with_mozilla) {
configs += [ "../modules/audio_processing:apm_debug_dump" ]
}
if (build_with_chromium) {
# Dependency on chromium's logging (in //base).
deps += [ "//base" ]

View File

@ -44,6 +44,7 @@ static const int kMaxLogLineSize = 1024 - 60;
#include "absl/base/attributes.h"
#include "absl/strings/string_view.h"
#include "api/units/timestamp.h"
#include "modules/audio_processing/logging/apm_data_dumper.h"
#include "rtc_base/checks.h"
#include "rtc_base/platform_thread_types.h"
#include "rtc_base/string_encode.h"
@ -59,6 +60,11 @@ bool LogMessage::aec_debug_ = false;
uint32_t LogMessage::aec_debug_size_ = 4*1024*1024;
std::string LogMessage::aec_filename_base_;
void LogMessage::set_aec_debug(bool enable) {
aec_debug_ = enable;
webrtc::ApmDataDumper::SetActivated(aec_debug_);
}
std::string LogMessage::aec_debug_filename() {
return aec_filename_base_;
}

View File

@ -590,7 +590,7 @@ class LogMessage {
#endif // RTC_LOG_ENABLED()
// Enable dumping of AEC inputs and outputs. Can be changed in mid-call
static void set_aec_debug(bool enable) { aec_debug_ = enable; }
static void set_aec_debug(bool enable);
static void set_aec_debug_size(uint32_t size) { aec_debug_size_ = size; }
static bool aec_debug() { return aec_debug_; }
static uint32_t aec_debug_size() { return aec_debug_size_; }

View File

@ -132,7 +132,7 @@ declare_args() {
# Selects whether debug dumps for the audio processing module
# should be generated.
apm_debug_dump = false
apm_debug_dump = build_with_mozilla
# Selects whether the audio processing module should be excluded.
rtc_exclude_audio_processing_module = false