AudioProcessingModule has a feature to make a recording of its
configuration, inputs and outputs over a period of time. It is
activated by AudioProcessing::StartRecording. The data is stored in
binary protobuf format in a specified file. The file IO is, as of
this CL, done from the real-time audio thread.
This CL contains an interface for AecDump, a new APM submodule that
will handle the recordings. Calls to the new interface from the
AudioProcessingModule are added. These calls have no effect, and for a
short while, audio_processing_impl.cc will contain two copies of
recording calls.
The original calls are guarded by the WEBRTC_AUDIOPROC_DEBUG_DUMP
preprocessor define. They still have an effect, while the new ones do
not. In the following CLs, the old recording calls will be removed,
and an implementation of AecDump added.
The reasons for the refactoring is to move file IO operations from the
real-time audio thread, to add a top-level low-priority task queue for
logging tasks like this, to simplify and modularize audio_processing_impl.cc
and remove some of the preprocessor directives. These goals will be
archived by the upcoming CLs. The implementation is in
https://codereview.webrtc.org/2865113002.
BUG=webrtc:7404
Review-Url: https://codereview.webrtc.org/2778783002
Cr-Commit-Position: refs/heads/master@{#18233}
2017-05-23 07:20:05 -07:00
|
|
|
/*
|
|
|
|
|
* Copyright (c) 2017 The WebRTC project authors. All Rights Reserved.
|
|
|
|
|
*
|
|
|
|
|
* Use of this source code is governed by a BSD-style license
|
|
|
|
|
* that can be found in the LICENSE file in the root of the source
|
|
|
|
|
* tree. An additional intellectual property rights grant can be found
|
|
|
|
|
* in the file PATENTS. All contributing project authors may
|
|
|
|
|
* be found in the AUTHORS file in the root of the source tree.
|
|
|
|
|
*/
|
|
|
|
|
|
2017-09-15 06:47:31 +02:00
|
|
|
#ifndef MODULES_AUDIO_PROCESSING_INCLUDE_AEC_DUMP_H_
|
|
|
|
|
#define MODULES_AUDIO_PROCESSING_INCLUDE_AEC_DUMP_H_
|
AudioProcessingModule has a feature to make a recording of its
configuration, inputs and outputs over a period of time. It is
activated by AudioProcessing::StartRecording. The data is stored in
binary protobuf format in a specified file. The file IO is, as of
this CL, done from the real-time audio thread.
This CL contains an interface for AecDump, a new APM submodule that
will handle the recordings. Calls to the new interface from the
AudioProcessingModule are added. These calls have no effect, and for a
short while, audio_processing_impl.cc will contain two copies of
recording calls.
The original calls are guarded by the WEBRTC_AUDIOPROC_DEBUG_DUMP
preprocessor define. They still have an effect, while the new ones do
not. In the following CLs, the old recording calls will be removed,
and an implementation of AecDump added.
The reasons for the refactoring is to move file IO operations from the
real-time audio thread, to add a top-level low-priority task queue for
logging tasks like this, to simplify and modularize audio_processing_impl.cc
and remove some of the preprocessor directives. These goals will be
archived by the upcoming CLs. The implementation is in
https://codereview.webrtc.org/2865113002.
BUG=webrtc:7404
Review-Url: https://codereview.webrtc.org/2778783002
Cr-Commit-Position: refs/heads/master@{#18233}
2017-05-23 07:20:05 -07:00
|
|
|
|
|
|
|
|
#include <memory>
|
|
|
|
|
#include <string>
|
|
|
|
|
#include <vector>
|
|
|
|
|
|
2017-09-15 06:47:31 +02:00
|
|
|
#include "api/array_view.h"
|
2018-04-12 22:44:09 +02:00
|
|
|
#include "api/audio/audio_frame.h"
|
2018-02-16 11:54:07 +01:00
|
|
|
#include "modules/audio_processing/include/audio_frame_view.h"
|
AudioProcessingModule has a feature to make a recording of its
configuration, inputs and outputs over a period of time. It is
activated by AudioProcessing::StartRecording. The data is stored in
binary protobuf format in a specified file. The file IO is, as of
this CL, done from the real-time audio thread.
This CL contains an interface for AecDump, a new APM submodule that
will handle the recordings. Calls to the new interface from the
AudioProcessingModule are added. These calls have no effect, and for a
short while, audio_processing_impl.cc will contain two copies of
recording calls.
The original calls are guarded by the WEBRTC_AUDIOPROC_DEBUG_DUMP
preprocessor define. They still have an effect, while the new ones do
not. In the following CLs, the old recording calls will be removed,
and an implementation of AecDump added.
The reasons for the refactoring is to move file IO operations from the
real-time audio thread, to add a top-level low-priority task queue for
logging tasks like this, to simplify and modularize audio_processing_impl.cc
and remove some of the preprocessor directives. These goals will be
archived by the upcoming CLs. The implementation is in
https://codereview.webrtc.org/2865113002.
BUG=webrtc:7404
Review-Url: https://codereview.webrtc.org/2778783002
Cr-Commit-Position: refs/heads/master@{#18233}
2017-05-23 07:20:05 -07:00
|
|
|
|
|
|
|
|
namespace webrtc {
|
|
|
|
|
|
|
|
|
|
// Struct for passing current config from APM without having to
|
|
|
|
|
// include protobuf headers.
|
|
|
|
|
struct InternalAPMConfig {
|
|
|
|
|
InternalAPMConfig();
|
|
|
|
|
InternalAPMConfig(const InternalAPMConfig&);
|
|
|
|
|
InternalAPMConfig(InternalAPMConfig&&);
|
|
|
|
|
|
|
|
|
|
InternalAPMConfig& operator=(const InternalAPMConfig&);
|
|
|
|
|
InternalAPMConfig& operator=(InternalAPMConfig&&) = delete;
|
|
|
|
|
|
|
|
|
|
bool operator==(const InternalAPMConfig& other);
|
|
|
|
|
|
|
|
|
|
bool aec_enabled = false;
|
|
|
|
|
bool aec_delay_agnostic_enabled = false;
|
|
|
|
|
bool aec_drift_compensation_enabled = false;
|
|
|
|
|
bool aec_extended_filter_enabled = false;
|
|
|
|
|
int aec_suppression_level = 0;
|
|
|
|
|
bool aecm_enabled = false;
|
|
|
|
|
bool aecm_comfort_noise_enabled = false;
|
|
|
|
|
int aecm_routing_mode = 0;
|
|
|
|
|
bool agc_enabled = false;
|
|
|
|
|
int agc_mode = 0;
|
|
|
|
|
bool agc_limiter_enabled = false;
|
|
|
|
|
bool hpf_enabled = false;
|
|
|
|
|
bool ns_enabled = false;
|
|
|
|
|
int ns_level = 0;
|
|
|
|
|
bool transient_suppression_enabled = false;
|
|
|
|
|
bool intelligibility_enhancer_enabled = false;
|
|
|
|
|
bool noise_robust_agc_enabled = false;
|
|
|
|
|
std::string experiments_description = "";
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
struct InternalAPMStreamsConfig {
|
|
|
|
|
int input_sample_rate = 0;
|
|
|
|
|
int output_sample_rate = 0;
|
|
|
|
|
int render_input_sample_rate = 0;
|
|
|
|
|
int render_output_sample_rate = 0;
|
|
|
|
|
|
|
|
|
|
size_t input_num_channels = 0;
|
|
|
|
|
size_t output_num_channels = 0;
|
|
|
|
|
size_t render_input_num_channels = 0;
|
|
|
|
|
size_t render_output_num_channels = 0;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// An interface for recording configuration and input/output streams
|
|
|
|
|
// of the Audio Processing Module. The recordings are called
|
|
|
|
|
// 'aec-dumps' and are stored in a protobuf format defined in
|
|
|
|
|
// debug.proto.
|
|
|
|
|
// The Write* methods are always safe to call concurrently or
|
|
|
|
|
// otherwise for all implementing subclasses. The intended mode of
|
|
|
|
|
// operation is to create a protobuf object from the input, and send
|
|
|
|
|
// it away to be written to file asynchronously.
|
|
|
|
|
class AecDump {
|
|
|
|
|
public:
|
|
|
|
|
struct AudioProcessingState {
|
|
|
|
|
int delay;
|
|
|
|
|
int drift;
|
|
|
|
|
int level;
|
|
|
|
|
bool keypress;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
virtual ~AecDump() = default;
|
|
|
|
|
|
|
|
|
|
// Logs Event::Type INIT message.
|
|
|
|
|
virtual void WriteInitMessage(
|
|
|
|
|
const InternalAPMStreamsConfig& streams_config) = 0;
|
|
|
|
|
|
|
|
|
|
// Logs Event::Type STREAM message. To log an input/output pair,
|
|
|
|
|
// call the AddCapture* and AddAudioProcessingState methods followed
|
|
|
|
|
// by a WriteCaptureStreamMessage call.
|
2018-02-16 11:54:07 +01:00
|
|
|
virtual void AddCaptureStreamInput(
|
|
|
|
|
const AudioFrameView<const float>& src) = 0;
|
|
|
|
|
virtual void AddCaptureStreamOutput(
|
|
|
|
|
const AudioFrameView<const float>& src) = 0;
|
AudioProcessingModule has a feature to make a recording of its
configuration, inputs and outputs over a period of time. It is
activated by AudioProcessing::StartRecording. The data is stored in
binary protobuf format in a specified file. The file IO is, as of
this CL, done from the real-time audio thread.
This CL contains an interface for AecDump, a new APM submodule that
will handle the recordings. Calls to the new interface from the
AudioProcessingModule are added. These calls have no effect, and for a
short while, audio_processing_impl.cc will contain two copies of
recording calls.
The original calls are guarded by the WEBRTC_AUDIOPROC_DEBUG_DUMP
preprocessor define. They still have an effect, while the new ones do
not. In the following CLs, the old recording calls will be removed,
and an implementation of AecDump added.
The reasons for the refactoring is to move file IO operations from the
real-time audio thread, to add a top-level low-priority task queue for
logging tasks like this, to simplify and modularize audio_processing_impl.cc
and remove some of the preprocessor directives. These goals will be
archived by the upcoming CLs. The implementation is in
https://codereview.webrtc.org/2865113002.
BUG=webrtc:7404
Review-Url: https://codereview.webrtc.org/2778783002
Cr-Commit-Position: refs/heads/master@{#18233}
2017-05-23 07:20:05 -07:00
|
|
|
virtual void AddCaptureStreamInput(const AudioFrame& frame) = 0;
|
|
|
|
|
virtual void AddCaptureStreamOutput(const AudioFrame& frame) = 0;
|
|
|
|
|
virtual void AddAudioProcessingState(const AudioProcessingState& state) = 0;
|
|
|
|
|
virtual void WriteCaptureStreamMessage() = 0;
|
|
|
|
|
|
|
|
|
|
// Logs Event::Type REVERSE_STREAM message.
|
|
|
|
|
virtual void WriteRenderStreamMessage(const AudioFrame& frame) = 0;
|
2018-02-16 11:54:07 +01:00
|
|
|
virtual void WriteRenderStreamMessage(
|
|
|
|
|
const AudioFrameView<const float>& src) = 0;
|
AudioProcessingModule has a feature to make a recording of its
configuration, inputs and outputs over a period of time. It is
activated by AudioProcessing::StartRecording. The data is stored in
binary protobuf format in a specified file. The file IO is, as of
this CL, done from the real-time audio thread.
This CL contains an interface for AecDump, a new APM submodule that
will handle the recordings. Calls to the new interface from the
AudioProcessingModule are added. These calls have no effect, and for a
short while, audio_processing_impl.cc will contain two copies of
recording calls.
The original calls are guarded by the WEBRTC_AUDIOPROC_DEBUG_DUMP
preprocessor define. They still have an effect, while the new ones do
not. In the following CLs, the old recording calls will be removed,
and an implementation of AecDump added.
The reasons for the refactoring is to move file IO operations from the
real-time audio thread, to add a top-level low-priority task queue for
logging tasks like this, to simplify and modularize audio_processing_impl.cc
and remove some of the preprocessor directives. These goals will be
archived by the upcoming CLs. The implementation is in
https://codereview.webrtc.org/2865113002.
BUG=webrtc:7404
Review-Url: https://codereview.webrtc.org/2778783002
Cr-Commit-Position: refs/heads/master@{#18233}
2017-05-23 07:20:05 -07:00
|
|
|
|
|
|
|
|
// Logs Event::Type CONFIG message.
|
|
|
|
|
virtual void WriteConfig(const InternalAPMConfig& config) = 0;
|
|
|
|
|
};
|
|
|
|
|
} // namespace webrtc
|
|
|
|
|
|
2017-09-15 06:47:31 +02:00
|
|
|
#endif // MODULES_AUDIO_PROCESSING_INCLUDE_AEC_DUMP_H_
|