Moving src/webrtc into src/.

In order to eliminate the WebRTC Subtree mirror in Chromium, 
WebRTC is moving the content of the src/webrtc directory up
to the src/ directory.

NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
TBR=tommi@webrtc.org

Bug: chromium:611808
Change-Id: Iac59c5b51b950f174119565bac87955a7994bc38
Reviewed-on: https://webrtc-review.googlesource.com/1560
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Reviewed-by: Henrik Kjellander <kjellander@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#19845}
This commit is contained in:
Mirko Bonadei
2017-09-15 06:15:48 +02:00
committed by Commit Bot
parent 6674846b4a
commit bb547203bf
4576 changed files with 1092 additions and 1196 deletions

View File

@ -0,0 +1,40 @@
/*
* 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.
*/
#include "webrtc/modules/audio_processing/include/aec_dump.h"
namespace webrtc {
InternalAPMConfig::InternalAPMConfig() = default;
InternalAPMConfig::InternalAPMConfig(const InternalAPMConfig&) = default;
InternalAPMConfig::InternalAPMConfig(InternalAPMConfig&&) = default;
InternalAPMConfig& InternalAPMConfig::operator=(const InternalAPMConfig&) =
default;
bool InternalAPMConfig::operator==(const InternalAPMConfig& other) {
return aec_enabled == other.aec_enabled &&
aec_delay_agnostic_enabled == other.aec_delay_agnostic_enabled &&
aec_drift_compensation_enabled ==
other.aec_drift_compensation_enabled &&
aec_extended_filter_enabled == other.aec_extended_filter_enabled &&
aec_suppression_level == other.aec_suppression_level &&
aecm_enabled == other.aecm_enabled &&
aecm_comfort_noise_enabled == other.aecm_comfort_noise_enabled &&
aecm_routing_mode == other.aecm_routing_mode &&
agc_enabled == other.agc_enabled && agc_mode == other.agc_mode &&
agc_limiter_enabled == other.agc_limiter_enabled &&
hpf_enabled == other.hpf_enabled && ns_enabled == other.ns_enabled &&
ns_level == other.ns_level &&
transient_suppression_enabled == other.transient_suppression_enabled &&
intelligibility_enhancer_enabled ==
other.intelligibility_enhancer_enabled &&
noise_robust_agc_enabled == other.noise_robust_agc_enabled &&
experiments_description == other.experiments_description;
}
} // namespace webrtc

View File

@ -0,0 +1,141 @@
/*
* 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.
*/
#ifndef WEBRTC_MODULES_AUDIO_PROCESSING_INCLUDE_AEC_DUMP_H_
#define WEBRTC_MODULES_AUDIO_PROCESSING_INCLUDE_AEC_DUMP_H_
#include <memory>
#include <string>
#include <vector>
#include "webrtc/api/array_view.h"
namespace webrtc {
class AudioFrame;
// 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;
};
// Class to pass audio data in float** format. This is to avoid
// dependence on AudioBuffer, and avoid problems associated with
// rtc::ArrayView<rtc::ArrayView>.
class FloatAudioFrame {
public:
// |num_channels| and |channel_size| describe the float**
// |audio_samples|. |audio_samples| is assumed to point to a
// two-dimensional |num_channels * channel_size| array of floats.
FloatAudioFrame(const float* const* audio_samples,
size_t num_channels,
size_t channel_size)
: audio_samples_(audio_samples),
num_channels_(num_channels),
channel_size_(channel_size) {}
FloatAudioFrame() = delete;
size_t num_channels() const { return num_channels_; }
rtc::ArrayView<const float> channel(size_t idx) const {
RTC_DCHECK_LE(0, idx);
RTC_DCHECK_LE(idx, num_channels_);
return rtc::ArrayView<const float>(audio_samples_[idx], channel_size_);
}
private:
const float* const* audio_samples_;
size_t num_channels_;
size_t channel_size_;
};
// 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.
virtual void AddCaptureStreamInput(const FloatAudioFrame& src) = 0;
virtual void AddCaptureStreamOutput(const FloatAudioFrame& src) = 0;
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;
virtual void WriteRenderStreamMessage(const FloatAudioFrame& src) = 0;
// Logs Event::Type CONFIG message.
virtual void WriteConfig(const InternalAPMConfig& config) = 0;
};
} // namespace webrtc
#endif // WEBRTC_MODULES_AUDIO_PROCESSING_INCLUDE_AEC_DUMP_H_

View File

@ -0,0 +1,35 @@
/*
* Copyright (c) 2016 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.
*/
#include "webrtc/modules/audio_processing/include/audio_processing.h"
#include "webrtc/rtc_base/checks.h"
namespace webrtc {
Beamforming::Beamforming()
: enabled(false),
array_geometry(),
target_direction(
SphericalPointf(static_cast<float>(M_PI) / 2.f, 0.f, 1.f)) {}
Beamforming::Beamforming(bool enabled, const std::vector<Point>& array_geometry)
: Beamforming(enabled,
array_geometry,
SphericalPointf(static_cast<float>(M_PI) / 2.f, 0.f, 1.f)) {}
Beamforming::Beamforming(bool enabled,
const std::vector<Point>& array_geometry,
SphericalPointf target_direction)
: enabled(enabled),
array_geometry(array_geometry),
target_direction(target_direction) {}
Beamforming::~Beamforming() {}
} // namespace webrtc

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,23 @@
/*
* Copyright (c) 2016 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.
*/
#include "webrtc/modules/audio_processing/include/config.h"
namespace webrtc {
Config::Config() {}
Config::~Config() {
for (OptionMap::iterator it = options_.begin(); it != options_.end(); ++it) {
delete it->second;
}
}
} // namespace webrtc

View File

@ -0,0 +1,133 @@
/*
* Copyright (c) 2013 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.
*/
#ifndef WEBRTC_MODULES_AUDIO_PROCESSING_INCLUDE_CONFIG_H_
#define WEBRTC_MODULES_AUDIO_PROCESSING_INCLUDE_CONFIG_H_
#include <map>
#include "webrtc/rtc_base/basictypes.h"
#include "webrtc/rtc_base/constructormagic.h"
namespace webrtc {
// Only add new values to the end of the enumeration and never remove (only
// deprecate) to maintain binary compatibility.
enum class ConfigOptionID {
kMyExperimentForTest,
kAlgo1CostFunctionForTest,
kTemporalLayersFactory, // Deprecated
kNetEqCapacityConfig, // Deprecated
kNetEqFastAccelerate, // Deprecated
kVoicePacing, // Deprecated
kExtendedFilter,
kDelayAgnostic,
kExperimentalAgc,
kExperimentalNs,
kBeamforming,
kIntelligibility,
kEchoCanceller3, // Deprecated
kAecRefinedAdaptiveFilter,
kLevelControl
};
// Class Config is designed to ease passing a set of options across webrtc code.
// Options are identified by typename in order to avoid incorrect casts.
//
// Usage:
// * declaring an option:
// struct Algo1_CostFunction {
// virtual float cost(int x) const { return x; }
// virtual ~Algo1_CostFunction() {}
// };
//
// * accessing an option:
// config.Get<Algo1_CostFunction>().cost(value);
//
// * setting an option:
// struct SqrCost : Algo1_CostFunction {
// virtual float cost(int x) const { return x*x; }
// };
// config.Set<Algo1_CostFunction>(new SqrCost());
//
// Note: This class is thread-compatible (like STL containers).
class Config {
public:
// Returns the option if set or a default constructed one.
// Callers that access options too often are encouraged to cache the result.
// Returned references are owned by this.
//
// Requires std::is_default_constructible<T>
template<typename T> const T& Get() const;
// Set the option, deleting any previous instance of the same.
// This instance gets ownership of the newly set value.
template<typename T> void Set(T* value);
Config();
~Config();
private:
struct BaseOption {
virtual ~BaseOption() {}
};
template<typename T>
struct Option : BaseOption {
explicit Option(T* v): value(v) {}
~Option() {
delete value;
}
T* value;
};
template<typename T>
static ConfigOptionID identifier() {
return T::identifier;
}
// Used to instantiate a default constructed object that doesn't needs to be
// owned. This allows Get<T> to be implemented without requiring explicitly
// locks.
template<typename T>
static const T& default_value() {
RTC_DEFINE_STATIC_LOCAL(const T, def, ());
return def;
}
typedef std::map<ConfigOptionID, BaseOption*> OptionMap;
OptionMap options_;
// RTC_DISALLOW_COPY_AND_ASSIGN
Config(const Config&);
void operator=(const Config&);
};
template<typename T>
const T& Config::Get() const {
OptionMap::const_iterator it = options_.find(identifier<T>());
if (it != options_.end()) {
const T* t = static_cast<Option<T>*>(it->second)->value;
if (t) {
return *t;
}
}
return default_value<T>();
}
template<typename T>
void Config::Set(T* value) {
BaseOption*& it = options_[identifier<T>()];
delete it;
it = new Option<T>(value);
}
} // namespace webrtc
#endif // WEBRTC_MODULES_AUDIO_PROCESSING_INCLUDE_CONFIG_H_

View File

@ -0,0 +1,221 @@
/*
* Copyright (c) 2013 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.
*/
#ifndef WEBRTC_MODULES_AUDIO_PROCESSING_INCLUDE_MOCK_AUDIO_PROCESSING_H_
#define WEBRTC_MODULES_AUDIO_PROCESSING_INCLUDE_MOCK_AUDIO_PROCESSING_H_
#include <memory>
#include "webrtc/modules/audio_processing/include/aec_dump.h"
#include "webrtc/modules/audio_processing/include/audio_processing.h"
#include "webrtc/test/gmock.h"
namespace webrtc {
namespace test {
class MockEchoCancellation : public EchoCancellation {
public:
virtual ~MockEchoCancellation() {}
MOCK_METHOD1(Enable, int(bool enable));
MOCK_CONST_METHOD0(is_enabled, bool());
MOCK_METHOD1(enable_drift_compensation, int(bool enable));
MOCK_CONST_METHOD0(is_drift_compensation_enabled, bool());
MOCK_METHOD1(set_stream_drift_samples, void(int drift));
MOCK_CONST_METHOD0(stream_drift_samples, int());
MOCK_METHOD1(set_suppression_level, int(SuppressionLevel level));
MOCK_CONST_METHOD0(suppression_level, SuppressionLevel());
MOCK_CONST_METHOD0(stream_has_echo, bool());
MOCK_METHOD1(enable_metrics, int(bool enable));
MOCK_CONST_METHOD0(are_metrics_enabled, bool());
MOCK_METHOD1(GetMetrics, int(Metrics* metrics));
MOCK_METHOD1(enable_delay_logging, int(bool enable));
MOCK_CONST_METHOD0(is_delay_logging_enabled, bool());
MOCK_METHOD2(GetDelayMetrics, int(int* median, int* std));
MOCK_METHOD3(GetDelayMetrics, int(int* median, int* std,
float* fraction_poor_delays));
MOCK_CONST_METHOD0(aec_core, struct AecCore*());
};
class MockEchoControlMobile : public EchoControlMobile {
public:
virtual ~MockEchoControlMobile() {}
MOCK_METHOD1(Enable, int(bool enable));
MOCK_CONST_METHOD0(is_enabled, bool());
MOCK_METHOD1(set_routing_mode, int(RoutingMode mode));
MOCK_CONST_METHOD0(routing_mode, RoutingMode());
MOCK_METHOD1(enable_comfort_noise, int(bool enable));
MOCK_CONST_METHOD0(is_comfort_noise_enabled, bool());
MOCK_METHOD2(SetEchoPath, int(const void* echo_path, size_t size_bytes));
MOCK_CONST_METHOD2(GetEchoPath, int(void* echo_path, size_t size_bytes));
};
class MockGainControl : public GainControl {
public:
virtual ~MockGainControl() {}
MOCK_METHOD1(Enable, int(bool enable));
MOCK_CONST_METHOD0(is_enabled, bool());
MOCK_METHOD1(set_stream_analog_level, int(int level));
MOCK_METHOD0(stream_analog_level, int());
MOCK_METHOD1(set_mode, int(Mode mode));
MOCK_CONST_METHOD0(mode, Mode());
MOCK_METHOD1(set_target_level_dbfs, int(int level));
MOCK_CONST_METHOD0(target_level_dbfs, int());
MOCK_METHOD1(set_compression_gain_db, int(int gain));
MOCK_CONST_METHOD0(compression_gain_db, int());
MOCK_METHOD1(enable_limiter, int(bool enable));
MOCK_CONST_METHOD0(is_limiter_enabled, bool());
MOCK_METHOD2(set_analog_level_limits, int(int minimum, int maximum));
MOCK_CONST_METHOD0(analog_level_minimum, int());
MOCK_CONST_METHOD0(analog_level_maximum, int());
MOCK_CONST_METHOD0(stream_is_saturated, bool());
};
class MockHighPassFilter : public HighPassFilter {
public:
virtual ~MockHighPassFilter() {}
MOCK_METHOD1(Enable, int(bool enable));
MOCK_CONST_METHOD0(is_enabled, bool());
};
class MockLevelEstimator : public LevelEstimator {
public:
virtual ~MockLevelEstimator() {}
MOCK_METHOD1(Enable, int(bool enable));
MOCK_CONST_METHOD0(is_enabled, bool());
MOCK_METHOD0(RMS, int());
};
class MockNoiseSuppression : public NoiseSuppression {
public:
virtual ~MockNoiseSuppression() {}
MOCK_METHOD1(Enable, int(bool enable));
MOCK_CONST_METHOD0(is_enabled, bool());
MOCK_METHOD1(set_level, int(Level level));
MOCK_CONST_METHOD0(level, Level());
MOCK_CONST_METHOD0(speech_probability, float());
MOCK_METHOD0(NoiseEstimate, std::vector<float>());
};
class MockVoiceDetection : public VoiceDetection {
public:
virtual ~MockVoiceDetection() {}
MOCK_METHOD1(Enable, int(bool enable));
MOCK_CONST_METHOD0(is_enabled, bool());
MOCK_CONST_METHOD0(stream_has_voice, bool());
MOCK_METHOD1(set_stream_has_voice, int(bool has_voice));
MOCK_METHOD1(set_likelihood, int(Likelihood likelihood));
MOCK_CONST_METHOD0(likelihood, Likelihood());
MOCK_METHOD1(set_frame_size_ms, int(int size));
MOCK_CONST_METHOD0(frame_size_ms, int());
};
class MockAudioProcessing : public AudioProcessing {
public:
MockAudioProcessing()
: echo_cancellation_(new testing::NiceMock<MockEchoCancellation>()),
echo_control_mobile_(new testing::NiceMock<MockEchoControlMobile>()),
gain_control_(new testing::NiceMock<MockGainControl>()),
high_pass_filter_(new testing::NiceMock<MockHighPassFilter>()),
level_estimator_(new testing::NiceMock<MockLevelEstimator>()),
noise_suppression_(new testing::NiceMock<MockNoiseSuppression>()),
voice_detection_(new testing::NiceMock<MockVoiceDetection>()) {
}
virtual ~MockAudioProcessing() {}
MOCK_METHOD0(Initialize, int());
MOCK_METHOD6(Initialize, int(int capture_input_sample_rate_hz,
int capture_output_sample_rate_hz,
int render_sample_rate_hz,
ChannelLayout capture_input_layout,
ChannelLayout capture_output_layout,
ChannelLayout render_input_layout));
MOCK_METHOD1(Initialize, int(const ProcessingConfig& processing_config));
MOCK_METHOD1(ApplyConfig, void(const Config& config));
MOCK_METHOD1(SetExtraOptions, void(const webrtc::Config& config));
MOCK_CONST_METHOD0(proc_sample_rate_hz, int());
MOCK_CONST_METHOD0(proc_split_sample_rate_hz, int());
MOCK_CONST_METHOD0(num_input_channels, size_t());
MOCK_CONST_METHOD0(num_proc_channels, size_t());
MOCK_CONST_METHOD0(num_output_channels, size_t());
MOCK_CONST_METHOD0(num_reverse_channels, size_t());
MOCK_METHOD1(set_output_will_be_muted, void(bool muted));
MOCK_METHOD1(ProcessStream, int(AudioFrame* frame));
MOCK_METHOD7(ProcessStream, int(const float* const* src,
size_t samples_per_channel,
int input_sample_rate_hz,
ChannelLayout input_layout,
int output_sample_rate_hz,
ChannelLayout output_layout,
float* const* dest));
MOCK_METHOD4(ProcessStream, int(const float* const* src,
const StreamConfig& input_config,
const StreamConfig& output_config,
float* const* dest));
MOCK_METHOD1(ProcessReverseStream, int(AudioFrame* frame));
MOCK_METHOD4(AnalyzeReverseStream, int(const float* const* data,
size_t samples_per_channel,
int sample_rate_hz,
ChannelLayout layout));
MOCK_METHOD4(ProcessReverseStream, int(const float* const* src,
const StreamConfig& input_config,
const StreamConfig& output_config,
float* const* dest));
MOCK_METHOD1(set_stream_delay_ms, int(int delay));
MOCK_CONST_METHOD0(stream_delay_ms, int());
MOCK_CONST_METHOD0(was_stream_delay_set, bool());
MOCK_METHOD1(set_stream_key_pressed, void(bool key_pressed));
MOCK_METHOD1(set_delay_offset_ms, void(int offset));
MOCK_CONST_METHOD0(delay_offset_ms, int());
virtual void AttachAecDump(std::unique_ptr<AecDump> aec_dump) {}
MOCK_METHOD0(DetachAecDump, void());
MOCK_METHOD0(UpdateHistogramsOnCallEnd, void());
MOCK_CONST_METHOD0(GetStatistics, AudioProcessingStatistics());
virtual MockEchoCancellation* echo_cancellation() const {
return echo_cancellation_.get();
}
virtual MockEchoControlMobile* echo_control_mobile() const {
return echo_control_mobile_.get();
}
virtual MockGainControl* gain_control() const {
return gain_control_.get();
}
virtual MockHighPassFilter* high_pass_filter() const {
return high_pass_filter_.get();
}
virtual MockLevelEstimator* level_estimator() const {
return level_estimator_.get();
}
virtual MockNoiseSuppression* noise_suppression() const {
return noise_suppression_.get();
}
virtual MockVoiceDetection* voice_detection() const {
return voice_detection_.get();
}
MOCK_CONST_METHOD0(GetConfig, AudioProcessing::Config());
private:
std::unique_ptr<MockEchoCancellation> echo_cancellation_;
std::unique_ptr<MockEchoControlMobile> echo_control_mobile_;
std::unique_ptr<MockGainControl> gain_control_;
std::unique_ptr<MockHighPassFilter> high_pass_filter_;
std::unique_ptr<MockLevelEstimator> level_estimator_;
std::unique_ptr<MockNoiseSuppression> noise_suppression_;
std::unique_ptr<MockVoiceDetection> voice_detection_;
};
} // namespace test
} // namespace webrtc
#endif // WEBRTC_MODULES_AUDIO_PROCESSING_INCLUDE_MOCK_AUDIO_PROCESSING_H_