Reformat the WebRTC code base

Running clang-format with chromium's style guide.

The goal is n-fold:
 * providing consistency and readability (that's what code guidelines are for)
 * preventing noise with presubmit checks and git cl format
 * building on the previous point: making it easier to automatically fix format issues
 * you name it

Please consider using git-hyper-blame to ignore this commit.

Bug: webrtc:9340
Change-Id: I694567c4cdf8cee2860958cfe82bfaf25848bb87
Reviewed-on: https://webrtc-review.googlesource.com/81185
Reviewed-by: Patrik Höglund <phoglund@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#23660}
This commit is contained in:
Yves Gerey
2018-06-19 15:03:05 +02:00
parent b602123a5a
commit 665174fdbb
1569 changed files with 30495 additions and 30309 deletions

View File

@ -18,7 +18,7 @@
#include <math.h>
#include <stddef.h> // size_t
#include <stdio.h> // FILE
#include <stdio.h> // FILE
#include <string.h>
#include <vector>
@ -743,8 +743,8 @@ class StreamConfig {
private:
static size_t calculate_frames(int sample_rate_hz) {
return static_cast<size_t>(
AudioProcessing::kChunkSizeMs * sample_rate_hz / 1000);
return static_cast<size_t>(AudioProcessing::kChunkSizeMs * sample_rate_hz /
1000);
}
int sample_rate_hz_;
@ -893,7 +893,8 @@ class EchoCancellation {
// Deprecated. Use GetStatistics on the AudioProcessing interface instead.
virtual int GetDelayMetrics(int* median, int* std) = 0;
// Deprecated. Use GetStatistics on the AudioProcessing interface instead.
virtual int GetDelayMetrics(int* median, int* std,
virtual int GetDelayMetrics(int* median,
int* std,
float* fraction_poor_delays) = 0;
// Returns a pointer to the low level AEC component. In case of multiple
@ -1037,8 +1038,7 @@ class GainControl {
// Sets the |minimum| and |maximum| analog levels of the audio capture device.
// Must be set if and only if an analog mode is used. Limited to [0, 65535].
virtual int set_analog_level_limits(int minimum,
int maximum) = 0;
virtual int set_analog_level_limits(int minimum, int maximum) = 0;
virtual int analog_level_minimum() const = 0;
virtual int analog_level_maximum() const = 0;
@ -1097,12 +1097,7 @@ class NoiseSuppression {
// Determines the aggressiveness of the suppression. Increasing the level
// will reduce the noise level at the expense of a higher speech distortion.
enum Level {
kLow,
kModerate,
kHigh,
kVeryHigh
};
enum Level { kLow, kModerate, kHigh, kVeryHigh };
virtual int set_level(Level level) = 0;
virtual Level level() const = 0;

View File

@ -64,11 +64,13 @@ class Config {
// Returned references are owned by this.
//
// Requires std::is_default_constructible<T>
template<typename T> const T& Get() const;
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);
template <typename T>
void Set(T* value);
Config();
~Config();
@ -78,16 +80,14 @@ class Config {
virtual ~BaseOption() {}
};
template<typename T>
template <typename T>
struct Option : BaseOption {
explicit Option(T* v): value(v) {}
~Option() {
delete value;
}
explicit Option(T* v) : value(v) {}
~Option() { delete value; }
T* value;
};
template<typename T>
template <typename T>
static ConfigOptionID identifier() {
return T::identifier;
}
@ -95,7 +95,7 @@ class Config {
// 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>
template <typename T>
static const T& default_value() {
static const T* const def = new T();
return *def;
@ -109,7 +109,7 @@ class Config {
void operator=(const Config&);
};
template<typename T>
template <typename T>
const T& Config::Get() const {
OptionMap::const_iterator it = options_.find(identifier<T>());
if (it != options_.end()) {
@ -121,7 +121,7 @@ const T& Config::Get() const {
return default_value<T>();
}
template<typename T>
template <typename T>
void Config::Set(T* value) {
BaseOption*& it = options_[identifier<T>()];
delete it;

View File

@ -40,8 +40,8 @@ class MockEchoCancellation : public EchoCancellation {
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_METHOD3(GetDelayMetrics,
int(int* median, int* std, float* fraction_poor_delays));
MOCK_CONST_METHOD0(aec_core, struct AecCore*());
};
@ -148,18 +148,18 @@ class MockAudioProcessing : public testing::NiceMock<AudioProcessing> {
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>()) {
}
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_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));
@ -172,26 +172,30 @@ class MockAudioProcessing : public testing::NiceMock<AudioProcessing> {
MOCK_METHOD1(set_output_will_be_muted, void(bool muted));
MOCK_METHOD1(SetRuntimeSetting, void(RuntimeSetting setting));
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_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_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());
@ -215,9 +219,7 @@ class MockAudioProcessing : public testing::NiceMock<AudioProcessing> {
virtual MockEchoControlMobile* echo_control_mobile() const {
return echo_control_mobile_.get();
}
virtual MockGainControl* gain_control() const {
return gain_control_.get();
}
virtual MockGainControl* gain_control() const { return gain_control_.get(); }
virtual MockHighPassFilter* high_pass_filter() const {
return high_pass_filter_.get();
}