Add more ApmDataDumper dumps to AGC.
We dump the compression level from AgcManagerDirect. We use the same names and structure as in GainControlForExperimentalAgc. This is to get Apm dump file names to match in the upcoming AGC changes: https://webrtc-review.googlesource.com/c/src/+/79360 TBR: alessiob@webrtc.org Bug: webrtc:7494 Change-Id: I1e6260ea48ffc43f709e4b0c97f843ad9c3d1824 Reviewed-on: https://webrtc-review.googlesource.com/86546 Reviewed-by: Alex Loiko <aleloi@webrtc.org> Commit-Queue: Alex Loiko <aleloi@webrtc.org> Cr-Commit-Position: refs/heads/master@{#23800}
This commit is contained in:
@ -25,6 +25,8 @@
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
int AgcManagerDirect::instance_counter_ = 0;
|
||||
|
||||
namespace {
|
||||
|
||||
// Amount the microphone level is lowered with every clipping event.
|
||||
@ -110,7 +112,8 @@ AgcManagerDirect::AgcManagerDirect(GainControl* gctrl,
|
||||
VolumeCallbacks* volume_callbacks,
|
||||
int startup_min_level,
|
||||
int clipped_level_min)
|
||||
: agc_(new Agc()),
|
||||
: data_dumper_(new ApmDataDumper(instance_counter_)),
|
||||
agc_(new Agc()),
|
||||
gctrl_(gctrl),
|
||||
volume_callbacks_(volume_callbacks),
|
||||
frames_since_clipped_(kClippedWaitFrames),
|
||||
@ -126,14 +129,17 @@ AgcManagerDirect::AgcManagerDirect(GainControl* gctrl,
|
||||
startup_min_level_(ClampLevel(startup_min_level)),
|
||||
clipped_level_min_(clipped_level_min),
|
||||
file_preproc_(new DebugFile("agc_preproc.pcm")),
|
||||
file_postproc_(new DebugFile("agc_postproc.pcm")) {}
|
||||
file_postproc_(new DebugFile("agc_postproc.pcm")) {
|
||||
instance_counter_++;
|
||||
}
|
||||
|
||||
AgcManagerDirect::AgcManagerDirect(Agc* agc,
|
||||
GainControl* gctrl,
|
||||
VolumeCallbacks* volume_callbacks,
|
||||
int startup_min_level,
|
||||
int clipped_level_min)
|
||||
: agc_(agc),
|
||||
: data_dumper_(new ApmDataDumper(instance_counter_)),
|
||||
agc_(agc),
|
||||
gctrl_(gctrl),
|
||||
volume_callbacks_(volume_callbacks),
|
||||
frames_since_clipped_(kClippedWaitFrames),
|
||||
@ -149,7 +155,9 @@ AgcManagerDirect::AgcManagerDirect(Agc* agc,
|
||||
startup_min_level_(ClampLevel(startup_min_level)),
|
||||
clipped_level_min_(clipped_level_min),
|
||||
file_preproc_(new DebugFile("agc_preproc.pcm")),
|
||||
file_postproc_(new DebugFile("agc_postproc.pcm")) {}
|
||||
file_postproc_(new DebugFile("agc_postproc.pcm")) {
|
||||
instance_counter_++;
|
||||
}
|
||||
|
||||
AgcManagerDirect::~AgcManagerDirect() {}
|
||||
|
||||
@ -164,6 +172,8 @@ int AgcManagerDirect::Initialize() {
|
||||
// TODO(bjornv): Investigate if we need to reset |startup_| as well. For
|
||||
// example, what happens when we change devices.
|
||||
|
||||
data_dumper_->InitiateNewSetOfRecordings();
|
||||
|
||||
if (gctrl_->set_mode(GainControl::kFixedDigital) != 0) {
|
||||
RTC_LOG(LS_ERROR) << "set_mode(GainControl::kFixedDigital) failed.";
|
||||
return -1;
|
||||
@ -249,6 +259,9 @@ void AgcManagerDirect::Process(const int16_t* audio,
|
||||
UpdateCompressor();
|
||||
|
||||
file_postproc_->Write(audio, length);
|
||||
|
||||
data_dumper_->DumpRaw("experimental_gain_control_compression_gain_db", 1,
|
||||
&compression_);
|
||||
}
|
||||
|
||||
void AgcManagerDirect::SetLevel(int new_level) {
|
||||
|
@ -14,6 +14,7 @@
|
||||
#include <memory>
|
||||
|
||||
#include "modules/audio_processing/agc/agc.h"
|
||||
#include "modules/audio_processing/logging/apm_data_dumper.h"
|
||||
#include "rtc_base/constructormagic.h"
|
||||
|
||||
namespace webrtc {
|
||||
@ -85,6 +86,9 @@ class AgcManagerDirect final {
|
||||
void UpdateGain();
|
||||
void UpdateCompressor();
|
||||
|
||||
std::unique_ptr<ApmDataDumper> data_dumper_;
|
||||
static int instance_counter_;
|
||||
|
||||
std::unique_ptr<Agc> agc_;
|
||||
GainControl* gctrl_;
|
||||
VolumeCallbacks* volume_callbacks_;
|
||||
|
Reference in New Issue
Block a user