diff options
author | Arun Raghavan <git@arunraghavan.net> | 2015-11-04 10:07:52 +0530 |
---|---|---|
committer | Arun Raghavan <git@arunraghavan.net> | 2015-11-04 13:11:30 +0530 |
commit | 34abadd258f2bcb2950a0f4d59c499105f84c965 (patch) | |
tree | 2ef435a01b782d998d765270f2eebd5da0972605 | |
parent | 9bc60d3e105a225af0529223e7029ed1910f3e1b (diff) |
Update code to current Chromium master
This corresponds to:
Chromium: 6555f9456074c0c0e5f7713564b978588ac04a5d
webrtc: c8b569e0a7ad0b369e15f0197b3a558699ec8efa
108 files changed, 894 insertions, 385 deletions
diff --git a/Makefile.am b/Makefile.am index 68dd995..39ed54f 100644 --- a/Makefile.am +++ b/Makefile.am @@ -5,8 +5,10 @@ pkgconfig_DATA = webrtc-audio-processing.pc webrtcincludedir = $(includedir)/webrtc_audio_processing nobase_webrtcinclude_HEADERS = webrtc/base/arraysize.h \ + webrtc/base/checks.h \ webrtc/base/constructormagic.h \ webrtc/base/basictypes.h \ + webrtc/base/maybe.h \ webrtc/base/platform_file.h \ webrtc/common.h \ webrtc/common_types.h \ @@ -14,7 +16,7 @@ nobase_webrtcinclude_HEADERS = webrtc/base/arraysize.h \ webrtc/modules/audio_processing/beamformer/array_util.h \ webrtc/modules/audio_processing/include/audio_processing.h \ webrtc/modules/interface/module_common_types.h \ - webrtc/system_wrappers/interface/trace.h + webrtc/system_wrappers/include/trace.h EXTRA_DIST = NEWS \ README.md \ diff --git a/webrtc/base/BUILD.gn b/webrtc/base/BUILD.gn index 1980782..11a2664 100644 --- a/webrtc/base/BUILD.gn +++ b/webrtc/base/BUILD.gn @@ -94,6 +94,7 @@ static_library("rtc_base_approved") { public_configs = [ "..:common_inherited_config" ] sources = [ + "array_view.h", "atomicops.h", "bitbuffer.cc", "bitbuffer.h", @@ -114,6 +115,7 @@ static_library("rtc_base_approved") { "event_tracer.h", "exp_filter.cc", "exp_filter.h", + "maybe.h", "md5.cc", "md5.h", "md5digest.cc", @@ -237,6 +239,8 @@ static_library("rtc_base") { "nethelpers.h", "network.cc", "network.h", + "networkmonitor.cc", + "networkmonitor.h", "nullsocketserver.h", "pathutils.cc", "pathutils.h", diff --git a/webrtc/base/checks.h b/webrtc/base/checks.h index 98e896a..681361a 100644 --- a/webrtc/base/checks.h +++ b/webrtc/base/checks.h @@ -164,6 +164,7 @@ DEFINE_RTC_CHECK_OP_IMPL(GT, > ) // code in debug builds. It does reference the condition parameter in all cases, // though, so callers won't risk getting warnings about unused variables. #if (!defined(NDEBUG) || defined(DCHECK_ALWAYS_ON)) +#define RTC_DCHECK_IS_ON 1 #define RTC_DCHECK(condition) RTC_CHECK(condition) #define RTC_DCHECK_EQ(v1, v2) RTC_CHECK_EQ(v1, v2) #define RTC_DCHECK_NE(v1, v2) RTC_CHECK_NE(v1, v2) @@ -172,6 +173,7 @@ DEFINE_RTC_CHECK_OP_IMPL(GT, > ) #define RTC_DCHECK_GE(v1, v2) RTC_CHECK_GE(v1, v2) #define RTC_DCHECK_GT(v1, v2) RTC_CHECK_GT(v1, v2) #else +#define RTC_DCHECK_IS_ON 0 #define RTC_DCHECK(condition) RTC_EAT_STREAM_PARAMETERS(condition) #define RTC_DCHECK_EQ(v1, v2) RTC_EAT_STREAM_PARAMETERS((v1) == (v2)) #define RTC_DCHECK_NE(v1, v2) RTC_EAT_STREAM_PARAMETERS((v1) != (v2)) diff --git a/webrtc/base/maybe.h b/webrtc/base/maybe.h new file mode 100644 index 0000000..1df94de --- /dev/null +++ b/webrtc/base/maybe.h @@ -0,0 +1,110 @@ +/* + * Copyright 2015 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_BASE_MAYBE_H_ +#define WEBRTC_BASE_MAYBE_H_ + +#include <algorithm> +#include <utility> + +#include "webrtc/base/checks.h" + +namespace rtc { + +// Simple std::experimental::optional-wannabe. It either contains a T or not. +// In order to keep the implementation simple and portable, this implementation +// actually contains a (default-constructed) T even when it supposedly doesn't +// contain a value; use e.g. rtc::scoped_ptr<T> instead if that's too +// expensive. +// +// A moved-from Maybe<T> may only be destroyed, and assigned to if T allows +// being assigned to after having been moved from. Specifically, you may not +// assume that it just doesn't contain a value anymore. +// +// TODO(kwiberg): Get rid of this class when the standard library has +// std::optional (and we're allowed to use it). +template <typename T> +class Maybe final { + public: + // Construct an empty Maybe. + Maybe() : has_value_(false) {} + + // Construct a Maybe that contains a value. + explicit Maybe(const T& val) : value_(val), has_value_(true) {} + explicit Maybe(T&& val) : value_(static_cast<T&&>(val)), has_value_(true) {} + + // Copy and move constructors. + // TODO(kwiberg): =default the move constructor when MSVC supports it. + Maybe(const Maybe&) = default; + Maybe(Maybe&& m) + : value_(static_cast<T&&>(m.value_)), has_value_(m.has_value_) {} + + // Assignment. + // TODO(kwiberg): =default the move assignment op when MSVC supports it. + Maybe& operator=(const Maybe&) = default; + Maybe& operator=(Maybe&& m) { + value_ = static_cast<T&&>(m.value_); + has_value_ = m.has_value_; + return *this; + } + + friend void swap(Maybe& m1, Maybe& m2) { + using std::swap; + swap(m1.value_, m2.value_); + swap(m1.has_value_, m2.has_value_); + } + + // Conversion to bool to test if we have a value. + explicit operator bool() const { return has_value_; } + + // Dereferencing. Only allowed if we have a value. + const T* operator->() const { + RTC_DCHECK(has_value_); + return &value_; + } + T* operator->() { + RTC_DCHECK(has_value_); + return &value_; + } + const T& operator*() const { + RTC_DCHECK(has_value_); + return value_; + } + T& operator*() { + RTC_DCHECK(has_value_); + return value_; + } + + // Dereference with a default value in case we don't have a value. + const T& value_or(const T& default_val) const { + return has_value_ ? value_ : default_val; + } + + // Equality tests. Two Maybes are equal if they contain equivalent values, or + // if they're both empty. + friend bool operator==(const Maybe& m1, const Maybe& m2) { + return m1.has_value_ && m2.has_value_ ? m1.value_ == m2.value_ + : m1.has_value_ == m2.has_value_; + } + friend bool operator!=(const Maybe& m1, const Maybe& m2) { + return m1.has_value_ && m2.has_value_ ? m1.value_ != m2.value_ + : m1.has_value_ != m2.has_value_; + } + + private: + // Invariant: Unless *this has been moved from, value_ is default-initialized + // (or copied or moved from a default-initialized T) if !has_value_. + T value_; + bool has_value_; +}; + +} // namespace rtc + +#endif // WEBRTC_BASE_MAYBE_H_ diff --git a/webrtc/base/stringutils.cc b/webrtc/base/stringutils.cc index 868e475..9580253 100644 --- a/webrtc/base/stringutils.cc +++ b/webrtc/base/stringutils.cc @@ -77,11 +77,11 @@ size_t asccpyn(wchar_t* buffer, size_t buflen, } else if (srclen >= buflen) { srclen = buflen - 1; } -#if _DEBUG +#if !defined(NDEBUG) // Double check that characters are not UTF-8 for (size_t pos = 0; pos < srclen; ++pos) RTC_DCHECK_LT(static_cast<unsigned char>(source[pos]), 128); -#endif // _DEBUG +#endif std::copy(source, source + srclen, buffer); buffer[srclen] = 0; return srclen; diff --git a/webrtc/base/template_util.h b/webrtc/base/template_util.h index 86e541d..31464cf 100644 --- a/webrtc/base/template_util.h +++ b/webrtc/base/template_util.h @@ -48,6 +48,19 @@ template <class T> struct is_non_const_reference<const T&> : false_type {}; template <class T> struct is_void : false_type {}; template <> struct is_void<void> : true_type {}; +template <class T> +struct remove_reference { + typedef T type; +}; +template <class T> +struct remove_reference<T&> { + typedef T type; +}; +template <class T> +struct remove_reference<T&&> { + typedef T type; +}; + namespace internal { // Types YesType and NoType are guaranteed such that sizeof(YesType) < diff --git a/webrtc/common_audio/audio_converter.cc b/webrtc/common_audio/audio_converter.cc index 07e5c6b..f1709ae 100644 --- a/webrtc/common_audio/audio_converter.cc +++ b/webrtc/common_audio/audio_converter.cc @@ -16,7 +16,7 @@ #include "webrtc/base/safe_conversions.h" #include "webrtc/common_audio/channel_buffer.h" #include "webrtc/common_audio/resampler/push_sinc_resampler.h" -#include "webrtc/system_wrappers/interface/scoped_vector.h" +#include "webrtc/system_wrappers/include/scoped_vector.h" using rtc::checked_cast; diff --git a/webrtc/common_audio/fir_filter.cc b/webrtc/common_audio/fir_filter.cc index 1c5548d..dc1b776 100644 --- a/webrtc/common_audio/fir_filter.cc +++ b/webrtc/common_audio/fir_filter.cc @@ -16,7 +16,7 @@ #include "webrtc/base/scoped_ptr.h" #include "webrtc/common_audio/fir_filter_neon.h" #include "webrtc/common_audio/fir_filter_sse.h" -#include "webrtc/system_wrappers/interface/cpu_features_wrapper.h" +#include "webrtc/system_wrappers/include/cpu_features_wrapper.h" namespace webrtc { diff --git a/webrtc/common_audio/fir_filter_neon.cc b/webrtc/common_audio/fir_filter_neon.cc index 97a75db..a815626 100644 --- a/webrtc/common_audio/fir_filter_neon.cc +++ b/webrtc/common_audio/fir_filter_neon.cc @@ -14,7 +14,7 @@ #include <assert.h> #include <string.h> -#include "webrtc/system_wrappers/interface/aligned_malloc.h" +#include "webrtc/system_wrappers/include/aligned_malloc.h" namespace webrtc { diff --git a/webrtc/common_audio/fir_filter_neon.h b/webrtc/common_audio/fir_filter_neon.h index d7399ad..3aa6168 100644 --- a/webrtc/common_audio/fir_filter_neon.h +++ b/webrtc/common_audio/fir_filter_neon.h @@ -13,7 +13,7 @@ #include "webrtc/base/scoped_ptr.h" #include "webrtc/common_audio/fir_filter.h" -#include "webrtc/system_wrappers/interface/aligned_malloc.h" +#include "webrtc/system_wrappers/include/aligned_malloc.h" namespace webrtc { diff --git a/webrtc/common_audio/fir_filter_sse.cc b/webrtc/common_audio/fir_filter_sse.cc index 6e7ae70..adbb2b7 100644 --- a/webrtc/common_audio/fir_filter_sse.cc +++ b/webrtc/common_audio/fir_filter_sse.cc @@ -14,7 +14,7 @@ #include <string.h> #include <xmmintrin.h> -#include "webrtc/system_wrappers/interface/aligned_malloc.h" +#include "webrtc/system_wrappers/include/aligned_malloc.h" namespace webrtc { diff --git a/webrtc/common_audio/fir_filter_sse.h b/webrtc/common_audio/fir_filter_sse.h index d396831..a3325cd 100644 --- a/webrtc/common_audio/fir_filter_sse.h +++ b/webrtc/common_audio/fir_filter_sse.h @@ -13,7 +13,7 @@ #include "webrtc/base/scoped_ptr.h" #include "webrtc/common_audio/fir_filter.h" -#include "webrtc/system_wrappers/interface/aligned_malloc.h" +#include "webrtc/system_wrappers/include/aligned_malloc.h" namespace webrtc { diff --git a/webrtc/common_audio/lapped_transform.h b/webrtc/common_audio/lapped_transform.h index 75af186..21e10e3 100644 --- a/webrtc/common_audio/lapped_transform.h +++ b/webrtc/common_audio/lapped_transform.h @@ -16,7 +16,7 @@ #include "webrtc/base/scoped_ptr.h" #include "webrtc/common_audio/blocker.h" #include "webrtc/common_audio/real_fourier.h" -#include "webrtc/system_wrappers/interface/aligned_array.h" +#include "webrtc/system_wrappers/include/aligned_array.h" namespace webrtc { diff --git a/webrtc/common_audio/real_fourier.h b/webrtc/common_audio/real_fourier.h index ef4fec8..ce3bbff 100644 --- a/webrtc/common_audio/real_fourier.h +++ b/webrtc/common_audio/real_fourier.h @@ -14,7 +14,7 @@ #include <complex> #include "webrtc/base/scoped_ptr.h" -#include "webrtc/system_wrappers/interface/aligned_malloc.h" +#include "webrtc/system_wrappers/include/aligned_malloc.h" // Uniform interface class for the real DFT and its inverse, for power-of-2 // input lengths. Also contains helper functions for buffer allocation, taking diff --git a/webrtc/common_audio/resampler/sinc_resampler.cc b/webrtc/common_audio/resampler/sinc_resampler.cc index c4f1488..69ac220 100644 --- a/webrtc/common_audio/resampler/sinc_resampler.cc +++ b/webrtc/common_audio/resampler/sinc_resampler.cc @@ -93,7 +93,7 @@ #include <limits> -#include "webrtc/system_wrappers/interface/cpu_features_wrapper.h" +#include "webrtc/system_wrappers/include/cpu_features_wrapper.h" #include "webrtc/typedefs.h" namespace webrtc { diff --git a/webrtc/common_audio/resampler/sinc_resampler.h b/webrtc/common_audio/resampler/sinc_resampler.h index 95ce44e..4ce8d37 100644 --- a/webrtc/common_audio/resampler/sinc_resampler.h +++ b/webrtc/common_audio/resampler/sinc_resampler.h @@ -16,7 +16,7 @@ #include "webrtc/base/constructormagic.h" #include "webrtc/base/scoped_ptr.h" -#include "webrtc/system_wrappers/interface/aligned_malloc.h" +#include "webrtc/system_wrappers/include/aligned_malloc.h" #ifndef WEBRTC_AUDIO_PROCESSING_ONLY_BUILD #include "webrtc/test/testsupport/gtest_prod_util.h" #endif diff --git a/webrtc/common_audio/signal_processing/complex_bit_reverse_arm.S b/webrtc/common_audio/signal_processing/complex_bit_reverse_arm.S index e7f8a81..93de99f 100644 --- a/webrtc/common_audio/signal_processing/complex_bit_reverse_arm.S +++ b/webrtc/common_audio/signal_processing/complex_bit_reverse_arm.S @@ -12,7 +12,7 @@ @ for ARMv5 platforms. @ Reference C code is in file complex_bit_reverse.c. Bit-exact. -#include "webrtc/system_wrappers/interface/asm_defines.h" +#include "webrtc/system_wrappers/include/asm_defines.h" GLOBAL_FUNCTION WebRtcSpl_ComplexBitReverse .align 2 diff --git a/webrtc/common_audio/signal_processing/filter_ar_fast_q12_armv7.S b/webrtc/common_audio/signal_processing/filter_ar_fast_q12_armv7.S index 76c8eee..f163627 100644 --- a/webrtc/common_audio/signal_processing/filter_ar_fast_q12_armv7.S +++ b/webrtc/common_audio/signal_processing/filter_ar_fast_q12_armv7.S @@ -35,7 +35,7 @@ @ r11: Scratch @ r12: &coefficients[j] -#include "webrtc/system_wrappers/interface/asm_defines.h" +#include "webrtc/system_wrappers/include/asm_defines.h" GLOBAL_FUNCTION WebRtcSpl_FilterARFastQ12 .align 2 diff --git a/webrtc/common_audio/signal_processing/spl_init.c b/webrtc/common_audio/signal_processing/spl_init.c index 73c2039..fdab038 100644 --- a/webrtc/common_audio/signal_processing/spl_init.c +++ b/webrtc/common_audio/signal_processing/spl_init.c @@ -15,7 +15,7 @@ */ #include "webrtc/common_audio/signal_processing/include/signal_processing_library.h" -#include "webrtc/system_wrappers/interface/cpu_features_wrapper.h" +#include "webrtc/system_wrappers/include/cpu_features_wrapper.h" /* Declare function pointers. */ MaxAbsValueW16 WebRtcSpl_MaxAbsValueW16; diff --git a/webrtc/common_audio/signal_processing/spl_sqrt_floor_arm.S b/webrtc/common_audio/signal_processing/spl_sqrt_floor_arm.S index f44ddd4..72cd2d9 100644 --- a/webrtc/common_audio/signal_processing/spl_sqrt_floor_arm.S +++ b/webrtc/common_audio/signal_processing/spl_sqrt_floor_arm.S @@ -32,7 +32,7 @@ @ Output: r0 = INT (SQRT (r0)), precision is 16 bits @ Registers touched: r1, r2 -#include "webrtc/system_wrappers/interface/asm_defines.h" +#include "webrtc/system_wrappers/include/asm_defines.h" GLOBAL_FUNCTION WebRtcSpl_SqrtFloor .align 2 diff --git a/webrtc/common_audio/wav_file.cc b/webrtc/common_audio/wav_file.cc index 8dae7d6..b14b620 100644 --- a/webrtc/common_audio/wav_file.cc +++ b/webrtc/common_audio/wav_file.cc @@ -37,9 +37,17 @@ class ReadableWavFile : public ReadableWav { FILE* file_; }; +std::string WavFile::FormatAsString() const { + std::ostringstream s; + s << "Sample rate: " << sample_rate() << " Hz, Channels: " << num_channels() + << ", Duration: " + << (1.f * num_samples()) / (num_channels() * sample_rate()) << " s"; + return s.str(); +} + WavReader::WavReader(const std::string& filename) : file_handle_(fopen(filename.c_str(), "rb")) { - RTC_CHECK(file_handle_ && "Could not open wav file for reading."); + RTC_CHECK(file_handle_) << "Could not open wav file for reading."; ReadableWavFile readable(file_handle_); WavFormat format; @@ -96,7 +104,7 @@ WavWriter::WavWriter(const std::string& filename, int sample_rate, num_channels_(num_channels), num_samples_(0), file_handle_(fopen(filename.c_str(), "wb")) { - RTC_CHECK(file_handle_ && "Could not open wav file for writing."); + RTC_CHECK(file_handle_) << "Could not open wav file for writing."; RTC_CHECK(CheckWavParameters(num_channels_, sample_rate_, kWavFormat, kBytesPerSample, num_samples_)); diff --git a/webrtc/common_audio/wav_file.h b/webrtc/common_audio/wav_file.h index 2eadd3f..42b0618 100644 --- a/webrtc/common_audio/wav_file.h +++ b/webrtc/common_audio/wav_file.h @@ -29,6 +29,9 @@ class WavFile { virtual int sample_rate() const = 0; virtual int num_channels() const = 0; virtual uint32_t num_samples() const = 0; + + // Returns a human-readable string containing the audio format. + std::string FormatAsString() const; }; // Simple C++ class for writing 16-bit PCM WAV files. All error handling is diff --git a/webrtc/common_types.h b/webrtc/common_types.h index c11c4d7..048485f 100644 --- a/webrtc/common_types.h +++ b/webrtc/common_types.h @@ -156,13 +156,12 @@ enum ProcessingTypes kRecordingPreprocessing }; -enum FrameType -{ - kFrameEmpty = 0, - kAudioFrameSpeech = 1, - kAudioFrameCN = 2, - kVideoFrameKey = 3, // independent frame - kVideoFrameDelta = 4, // depends on the previus frame +enum FrameType { + kEmptyFrame = 0, + kAudioFrameSpeech = 1, + kAudioFrameCN = 2, + kVideoFrameKey = 3, + kVideoFrameDelta = 4, }; // Statistics for an RTCP channel @@ -548,6 +547,7 @@ enum RawVideoType enum { kConfigParameterSize = 128}; enum { kPayloadNameSize = 32}; enum { kMaxSimulcastStreams = 4}; +enum { kMaxSpatialLayers = 5 }; enum { kMaxTemporalStreams = 4}; enum VideoCodecComplexity @@ -677,6 +677,13 @@ struct SimulcastStream { } }; +struct SpatialLayer { + int scaling_factor_num; + int scaling_factor_den; + int target_bitrate_bps; + // TODO(ivica): Add max_quantizer and min_quantizer? +}; + enum VideoCodecMode { kRealtimeVideo, kScreensharing @@ -703,6 +710,7 @@ struct VideoCodec { unsigned int qpMax; unsigned char numberOfSimulcastStreams; SimulcastStream simulcastStream[kMaxSimulcastStreams]; + SpatialLayer spatialLayers[kMaxSpatialLayers]; VideoCodecMode mode; diff --git a/webrtc/modules/audio_coding/BUILD.gn b/webrtc/modules/audio_coding/BUILD.gn index 7bbcd3a..839a143 100644 --- a/webrtc/modules/audio_coding/BUILD.gn +++ b/webrtc/modules/audio_coding/BUILD.gn @@ -9,17 +9,48 @@ import("//build/config/arm.gni") import("../../build/webrtc.gni") +source_set("rent_a_codec") { + sources = [ + "main/acm2/acm_codec_database.cc", + "main/acm2/acm_codec_database.h", + "main/acm2/rent_a_codec.cc", + "main/acm2/rent_a_codec.h", + ] + configs += [ "../..:common_config" ] + public_configs = [ "../..:common_inherited_config" ] + deps = [ + "../..:webrtc_common", + ] + + defines = [] + if (rtc_include_opus) { + defines += [ "WEBRTC_CODEC_OPUS" ] + } + if (!build_with_mozilla) { + if (current_cpu == "arm") { + defines += [ "WEBRTC_CODEC_ISACFX" ] + } else { + defines += [ "WEBRTC_CODEC_ISAC" ] + } + defines += [ "WEBRTC_CODEC_G722" ] + } + if (!build_with_mozilla && !build_with_chromium) { + defines += [ + "WEBRTC_CODEC_ILBC", + "WEBRTC_CODEC_RED", + ] + } +} + config("audio_coding_config") { include_dirs = [ - "main/interface", + "main/include", "../interface", ] } source_set("audio_coding") { sources = [ - "main/acm2/acm_codec_database.cc", - "main/acm2/acm_codec_database.h", "main/acm2/acm_common_defs.h", "main/acm2/acm_receiver.cc", "main/acm2/acm_receiver.h", @@ -36,10 +67,8 @@ source_set("audio_coding") { "main/acm2/codec_owner.h", "main/acm2/initial_delay_manager.cc", "main/acm2/initial_delay_manager.h", - "main/acm2/nack.cc", - "main/acm2/nack.h", - "main/interface/audio_coding_module.h", - "main/interface/audio_coding_module_typedefs.h", + "main/include/audio_coding_module.h", + "main/include/audio_coding_module_typedefs.h", ] defines = [] @@ -69,6 +98,7 @@ source_set("audio_coding") { ":g711", ":neteq", ":pcm16b", + ":rent_a_codec", "../..:rtc_event_log", "../..:webrtc_common", "../../common_audio", @@ -245,7 +275,7 @@ source_set("g722") { config("ilbc_config") { include_dirs = [ "../../..", - "codecs/ilbc/interface", + "codecs/ilbc/include", ] } @@ -323,6 +353,7 @@ source_set("ilbc") { "codecs/ilbc/ilbc.c", "codecs/ilbc/include/audio_decoder_ilbc.h", "codecs/ilbc/include/audio_encoder_ilbc.h", + "codecs/ilbc/include/ilbc.h", "codecs/ilbc/index_conv_dec.c", "codecs/ilbc/index_conv_dec.h", "codecs/ilbc/index_conv_enc.c", @@ -331,7 +362,6 @@ source_set("ilbc") { "codecs/ilbc/init_decode.h", "codecs/ilbc/init_encode.c", "codecs/ilbc/init_encode.h", - "codecs/ilbc/interface/ilbc.h", "codecs/ilbc/interpolate.c", "codecs/ilbc/interpolate.h", "codecs/ilbc/interpolate_samples.c", @@ -422,15 +452,15 @@ source_set("isac_common") { config("isac_config") { include_dirs = [ "../../..", - "codecs/isac/main/interface", + "codecs/isac/main/include", ] } source_set("isac") { sources = [ - "codecs/isac/main/interface/audio_decoder_isac.h", - "codecs/isac/main/interface/audio_encoder_isac.h", - "codecs/isac/main/interface/isac.h", + "codecs/isac/main/include/audio_decoder_isac.h", + "codecs/isac/main/include/audio_encoder_isac.h", + "codecs/isac/main/include/isac.h", "codecs/isac/main/source/arith_routines.c", "codecs/isac/main/source/arith_routines.h", "codecs/isac/main/source/arith_routines_hist.c", @@ -506,15 +536,15 @@ source_set("isac") { config("isac_fix_config") { include_dirs = [ "../../..", - "codecs/isac/fix/interface", + "codecs/isac/fix/include", ] } source_set("isac_fix") { sources = [ - "codecs/isac/fix/interface/audio_decoder_isacfix.h", - "codecs/isac/fix/interface/audio_encoder_isacfix.h", - "codecs/isac/fix/interface/isacfix.h", + "codecs/isac/fix/include/audio_decoder_isacfix.h", + "codecs/isac/fix/include/audio_encoder_isacfix.h", + "codecs/isac/fix/include/isacfix.h", "codecs/isac/fix/source/arith_routines.c", "codecs/isac/fix/source/arith_routines_hist.c", "codecs/isac/fix/source/arith_routines_logist.c", @@ -694,9 +724,9 @@ source_set("webrtc_opus") { sources = [ "codecs/opus/audio_decoder_opus.cc", "codecs/opus/audio_encoder_opus.cc", - "codecs/opus/interface/audio_decoder_opus.h", - "codecs/opus/interface/audio_encoder_opus.h", - "codecs/opus/interface/opus_interface.h", + "codecs/opus/include/audio_decoder_opus.h", + "codecs/opus/include/audio_encoder_opus.h", + "codecs/opus/include/opus_interface.h", "codecs/opus/opus_inst.h", "codecs/opus/opus_interface.c", ] @@ -764,9 +794,11 @@ source_set("neteq") { "neteq/dtmf_tone_generator.h", "neteq/expand.cc", "neteq/expand.h", - "neteq/interface/neteq.h", + "neteq/include/neteq.h", "neteq/merge.cc", "neteq/merge.h", + "neteq/nack.cc", + "neteq/nack.h", "neteq/neteq.cc", "neteq/neteq_impl.cc", "neteq/neteq_impl.h", diff --git a/webrtc/modules/audio_coding/Makefile.am b/webrtc/modules/audio_coding/Makefile.am index 5304dac..c3c6b71 100644 --- a/webrtc/modules/audio_coding/Makefile.am +++ b/webrtc/modules/audio_coding/Makefile.am @@ -1,6 +1,6 @@ noinst_LTLIBRARIES = libaudio_coding.la -libaudio_coding_la_SOURCES = codecs/isac/main/interface/isac.h \ +libaudio_coding_la_SOURCES = codecs/isac/main/include/isac.h \ codecs/isac/main/source/arith_routines.c \ codecs/isac/main/source/arith_routines.h \ codecs/isac/main/source/arith_routines_hist.c \ diff --git a/webrtc/modules/audio_coding/codecs/isac/main/interface/isac.h b/webrtc/modules/audio_coding/codecs/isac/main/include/isac.h index 1f5aeb3..327e7f4 100644 --- a/webrtc/modules/audio_coding/codecs/isac/main/interface/isac.h +++ b/webrtc/modules/audio_coding/codecs/isac/main/include/isac.h @@ -8,8 +8,8 @@ * be found in the AUTHORS file in the root of the source tree. */ -#ifndef WEBRTC_MODULES_AUDIO_CODING_CODECS_ISAC_MAIN_INTERFACE_ISAC_H_ -#define WEBRTC_MODULES_AUDIO_CODING_CODECS_ISAC_MAIN_INTERFACE_ISAC_H_ +#ifndef WEBRTC_MODULES_AUDIO_CODING_CODECS_ISAC_MAIN_INCLUDE_ISAC_H_ +#define WEBRTC_MODULES_AUDIO_CODING_CODECS_ISAC_MAIN_INCLUDE_ISAC_H_ #include <stddef.h> @@ -721,4 +721,4 @@ extern "C" { -#endif /* WEBRTC_MODULES_AUDIO_CODING_CODECS_ISAC_MAIN_INTERFACE_ISAC_H_ */ +#endif /* WEBRTC_MODULES_AUDIO_CODING_CODECS_ISAC_MAIN_INCLUDE_ISAC_H_ */ diff --git a/webrtc/modules/audio_coding/codecs/isac/main/source/encode_lpc_swb.c b/webrtc/modules/audio_coding/codecs/isac/main/source/encode_lpc_swb.c index d59f748..12a263d 100644 --- a/webrtc/modules/audio_coding/codecs/isac/main/source/encode_lpc_swb.c +++ b/webrtc/modules/audio_coding/codecs/isac/main/source/encode_lpc_swb.c @@ -440,7 +440,7 @@ WebRtcIsac_CorrelateInterVec( int16_t rowCntr; int16_t colCntr; int16_t interVecDim; - double myVec[UB16_LPC_VEC_PER_FRAME]; + double myVec[UB16_LPC_VEC_PER_FRAME] = {0.0}; const double* interVecDecorrMat; switch(bandwidth) diff --git a/webrtc/modules/audio_coding/codecs/isac/main/source/entropy_coding.c b/webrtc/modules/audio_coding/codecs/isac/main/source/entropy_coding.c index 139679f..bc65396 100644 --- a/webrtc/modules/audio_coding/codecs/isac/main/source/entropy_coding.c +++ b/webrtc/modules/audio_coding/codecs/isac/main/source/entropy_coding.c @@ -17,10 +17,10 @@ */ -#include "webrtc/common_audio/signal_processing/include/signal_processing_library.h" #include "entropy_coding.h" #include "settings.h" #include "arith_routines.h" +#include "webrtc/common_audio/signal_processing/include/signal_processing_library.h" #include "spectrum_ar_model_tables.h" #include "lpc_tables.h" #include "pitch_gain_tables.h" diff --git a/webrtc/modules/audio_coding/codecs/isac/main/source/settings.h b/webrtc/modules/audio_coding/codecs/isac/main/source/settings.h index 5562c35..31a8065 100644 --- a/webrtc/modules/audio_coding/codecs/isac/main/source/settings.h +++ b/webrtc/modules/audio_coding/codecs/isac/main/source/settings.h @@ -168,8 +168,6 @@ enum IsacSamplingRate {kIsacWideband = 16, kIsacSuperWideband = 32}; #define RCU_TRANSCODING_SCALE_UB 0.50f #define RCU_TRANSCODING_SCALE_UB_INVERSE 2.0f -#define SIZE_RESAMPLER_STATE 6 - /* Define Error codes */ /* 6000 General */ #define ISAC_MEMORY_ALLOCATION_FAILED 6010 diff --git a/webrtc/modules/audio_coding/codecs/isac/main/source/structs.h b/webrtc/modules/audio_coding/codecs/isac/main/source/structs.h index 8442878..a2cdca2 100644 --- a/webrtc/modules/audio_coding/codecs/isac/main/source/structs.h +++ b/webrtc/modules/audio_coding/codecs/isac/main/source/structs.h @@ -19,7 +19,7 @@ #define WEBRTC_MODULES_AUDIO_CODING_CODECS_ISAC_MAIN_SOURCE_STRUCTS_H_ #include "webrtc/modules/audio_coding/codecs/isac/bandwidth_info.h" -#include "webrtc/modules/audio_coding/codecs/isac/main/interface/isac.h" +#include "webrtc/modules/audio_coding/codecs/isac/main/include/isac.h" #include "webrtc/modules/audio_coding/codecs/isac/main/source/settings.h" #include "webrtc/typedefs.h" @@ -484,12 +484,9 @@ typedef struct { int16_t maxRateBytesPer30Ms; // Maximum allowed payload-size, measured in Bytes. int16_t maxPayloadSizeBytes; - /* The expected sampling rate of the input signal. Valid values are 16000, - * 32000 and 48000. This is not the operation sampling rate of the codec. - * Input signals at 48 kHz are resampled to 32 kHz, then encoded. */ + /* The expected sampling rate of the input signal. Valid values are 16000 + * and 32000. This is not the operation sampling rate of the codec. */ uint16_t in_sample_rate_hz; - /* State for the input-resampler. It is only used for 48 kHz input signals. */ - int16_t state_in_resampler[SIZE_RESAMPLER_STATE]; // Trig tables for WebRtcIsac_Time2Spec and WebRtcIsac_Spec2time. TransformTables transform_tables; diff --git a/webrtc/modules/audio_processing/BUILD.gn b/webrtc/modules/audio_processing/BUILD.gn index 9a45cec..2d0c602 100644 --- a/webrtc/modules/audio_processing/BUILD.gn +++ b/webrtc/modules/audio_processing/BUILD.gn @@ -54,6 +54,8 @@ source_set("audio_processing") { "audio_buffer.h", "audio_processing_impl.cc", "audio_processing_impl.h", + "beamformer/array_util.cc", + "beamformer/array_util.h", "beamformer/beamformer.h", "beamformer/complex_matrix.h", "beamformer/covariance_matrix_generator.cc", diff --git a/webrtc/modules/audio_processing/Makefile.am b/webrtc/modules/audio_processing/Makefile.am index 4c76a29..b685fb9 100644 --- a/webrtc/modules/audio_processing/Makefile.am +++ b/webrtc/modules/audio_processing/Makefile.am @@ -39,6 +39,7 @@ libwebrtc_audio_processing_la_SOURCES = include/audio_processing.h \ beamformer/matrix.h \ beamformer/matrix_test_helpers.h \ beamformer/nonlinear_beamformer.h \ + beamformer/array_util.cc \ beamformer/covariance_matrix_generator.cc \ beamformer/nonlinear_beamformer.cc \ intelligibility/intelligibility_enhancer.h \ diff --git a/webrtc/modules/audio_processing/aec/aec_core.c b/webrtc/modules/audio_processing/aec/aec_core.c index b2162ac..f8eed32 100644 --- a/webrtc/modules/audio_processing/aec/aec_core.c +++ b/webrtc/modules/audio_processing/aec/aec_core.c @@ -31,7 +31,7 @@ #include "webrtc/modules/audio_processing/aec/aec_rdft.h" #include "webrtc/modules/audio_processing/logging/aec_logging.h" #include "webrtc/modules/audio_processing/utility/delay_estimator_wrapper.h" -#include "webrtc/system_wrappers/interface/cpu_features_wrapper.h" +#include "webrtc/system_wrappers/include/cpu_features_wrapper.h" #include "webrtc/typedefs.h" diff --git a/webrtc/modules/audio_processing/aec/aec_rdft.c b/webrtc/modules/audio_processing/aec/aec_rdft.c index 2c3cff2..03efc10 100644 --- a/webrtc/modules/audio_processing/aec/aec_rdft.c +++ b/webrtc/modules/audio_processing/aec/aec_rdft.c @@ -23,7 +23,7 @@ #include <math.h> -#include "webrtc/system_wrappers/interface/cpu_features_wrapper.h" +#include "webrtc/system_wrappers/include/cpu_features_wrapper.h" #include "webrtc/typedefs.h" // These tables used to be computed at run-time. For example, refer to: diff --git a/webrtc/modules/audio_processing/aecm/aecm_core.c b/webrtc/modules/audio_processing/aecm/aecm_core.c index b801f07..f0d85d5 100644 --- a/webrtc/modules/audio_processing/aecm/aecm_core.c +++ b/webrtc/modules/audio_processing/aecm/aecm_core.c @@ -18,8 +18,8 @@ #include "webrtc/common_audio/signal_processing/include/real_fft.h" #include "webrtc/modules/audio_processing/aecm/include/echo_control_mobile.h" #include "webrtc/modules/audio_processing/utility/delay_estimator_wrapper.h" -#include "webrtc/system_wrappers/interface/compile_assert_c.h" -#include "webrtc/system_wrappers/interface/cpu_features_wrapper.h" +#include "webrtc/system_wrappers/include/compile_assert_c.h" +#include "webrtc/system_wrappers/include/cpu_features_wrapper.h" #include "webrtc/typedefs.h" #ifdef AEC_DEBUG diff --git a/webrtc/modules/audio_processing/aecm/aecm_core_c.c b/webrtc/modules/audio_processing/aecm/aecm_core_c.c index eb2bd91..df95e8b 100644 --- a/webrtc/modules/audio_processing/aecm/aecm_core_c.c +++ b/webrtc/modules/audio_processing/aecm/aecm_core_c.c @@ -18,8 +18,8 @@ #include "webrtc/common_audio/signal_processing/include/real_fft.h" #include "webrtc/modules/audio_processing/aecm/include/echo_control_mobile.h" #include "webrtc/modules/audio_processing/utility/delay_estimator_wrapper.h" -#include "webrtc/system_wrappers/interface/compile_assert_c.h" -#include "webrtc/system_wrappers/interface/cpu_features_wrapper.h" +#include "webrtc/system_wrappers/include/compile_assert_c.h" +#include "webrtc/system_wrappers/include/cpu_features_wrapper.h" #include "webrtc/typedefs.h" // Square root of Hanning window in Q14. diff --git a/webrtc/modules/audio_processing/agc/agc_manager_direct.cc b/webrtc/modules/audio_processing/agc/agc_manager_direct.cc index 48ce2f8..867022d 100644 --- a/webrtc/modules/audio_processing/agc/agc_manager_direct.cc +++ b/webrtc/modules/audio_processing/agc/agc_manager_direct.cc @@ -20,7 +20,7 @@ #include "webrtc/modules/audio_processing/agc/gain_map_internal.h" #include "webrtc/modules/audio_processing/gain_control_impl.h" #include "webrtc/modules/interface/module_common_types.h" -#include "webrtc/system_wrappers/interface/logging.h" +#include "webrtc/system_wrappers/include/logging.h" namespace webrtc { diff --git a/webrtc/modules/audio_processing/audio_buffer.h b/webrtc/modules/audio_processing/audio_buffer.h index f82ab61..864633f 100644 --- a/webrtc/modules/audio_processing/audio_buffer.h +++ b/webrtc/modules/audio_processing/audio_buffer.h @@ -16,7 +16,7 @@ #include "webrtc/modules/audio_processing/include/audio_processing.h" #include "webrtc/modules/audio_processing/splitting_filter.h" #include "webrtc/modules/interface/module_common_types.h" -#include "webrtc/system_wrappers/interface/scoped_vector.h" +#include "webrtc/system_wrappers/include/scoped_vector.h" #include "webrtc/typedefs.h" namespace webrtc { diff --git a/webrtc/modules/audio_processing/audio_processing_impl.cc b/webrtc/modules/audio_processing/audio_processing_impl.cc index f3ee0a3..c657415 100644 --- a/webrtc/modules/audio_processing/audio_processing_impl.cc +++ b/webrtc/modules/audio_processing/audio_processing_impl.cc @@ -37,10 +37,10 @@ extern "C" { #include "webrtc/modules/audio_processing/transient/transient_suppressor.h" #include "webrtc/modules/audio_processing/voice_detection_impl.h" #include "webrtc/modules/interface/module_common_types.h" -#include "webrtc/system_wrappers/interface/critical_section_wrapper.h" -#include "webrtc/system_wrappers/interface/file_wrapper.h" -#include "webrtc/system_wrappers/interface/logging.h" -#include "webrtc/system_wrappers/interface/metrics.h" +#include "webrtc/system_wrappers/include/critical_section_wrapper.h" +#include "webrtc/system_wrappers/include/file_wrapper.h" +#include "webrtc/system_wrappers/include/logging.h" +#include "webrtc/system_wrappers/include/metrics.h" #ifdef WEBRTC_AUDIOPROC_DEBUG_DUMP // Files generated at build-time by the protobuf compiler. @@ -225,6 +225,7 @@ AudioProcessingImpl::AudioProcessingImpl(const Config& config, beamformer_enabled_(config.Get<Beamforming>().enabled), beamformer_(beamformer), array_geometry_(config.Get<Beamforming>().array_geometry), + target_direction_(config.Get<Beamforming>().target_direction), intelligibility_enabled_(config.Get<Intelligibility>().enabled) { echo_cancellation_ = new EchoCancellationImpl(this, crit_); component_list_.push_back(echo_cancellation_); @@ -1099,7 +1100,8 @@ void AudioProcessingImpl::InitializeTransient() { void AudioProcessingImpl::InitializeBeamformer() { if (beamformer_enabled_) { if (!beamformer_) { - beamformer_.reset(new NonlinearBeamformer(array_geometry_)); + beamformer_.reset( + new NonlinearBeamformer(array_geometry_, target_direction_)); } beamformer_->Initialize(kChunkSizeMs, split_rate_); } diff --git a/webrtc/modules/audio_processing/audio_processing_impl.h b/webrtc/modules/audio_processing/audio_processing_impl.h index bf29bf3..542886e 100644 --- a/webrtc/modules/audio_processing/audio_processing_impl.h +++ b/webrtc/modules/audio_processing/audio_processing_impl.h @@ -208,6 +208,7 @@ class AudioProcessingImpl : public AudioProcessing { const bool beamformer_enabled_; rtc::scoped_ptr<Beamformer<float>> beamformer_; const std::vector<Point> array_geometry_; + const SphericalPointf target_direction_; bool intelligibility_enabled_; rtc::scoped_ptr<IntelligibilityEnhancer> intelligibility_enhancer_; diff --git a/webrtc/modules/audio_processing/beamformer/array_util.cc b/webrtc/modules/audio_processing/beamformer/array_util.cc new file mode 100644 index 0000000..d97beea --- /dev/null +++ b/webrtc/modules/audio_processing/beamformer/array_util.cc @@ -0,0 +1,118 @@ +/* + * Copyright (c) 2015 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/beamformer/array_util.h" + +#include <algorithm> +#include <limits> + +#include "webrtc/base/checks.h" + +namespace webrtc { +namespace { + +const float kMaxDotProduct = 1e-6f; + +} // namespace + +float GetMinimumSpacing(const std::vector<Point>& array_geometry) { + RTC_CHECK_GT(array_geometry.size(), 1u); + float mic_spacing = std::numeric_limits<float>::max(); + for (size_t i = 0; i < (array_geometry.size() - 1); ++i) { + for (size_t j = i + 1; j < array_geometry.size(); ++j) { + mic_spacing = + std::min(mic_spacing, Distance(array_geometry[i], array_geometry[j])); + } + } + return mic_spacing; +} + +Point PairDirection(const Point& a, const Point& b) { + return {b.x() - a.x(), b.y() - a.y(), b.z() - a.z()}; +} + +float DotProduct(const Point& a, const Point& b) { + return a.x() * b.x() + a.y() * b.y() + a.z() * b.z(); +} + +Point CrossProduct(const Point& a, const Point& b) { + return {a.y() * b.z() - a.z() * b.y(), a.z() * b.x() - a.x() * b.z(), + a.x() * b.y() - a.y() * b.x()}; +} + +bool AreParallel(const Point& a, const Point& b) { + Point cross_product = CrossProduct(a, b); + return DotProduct(cross_product, cross_product) < kMaxDotProduct; +} + +bool ArePerpendicular(const Point& a, const Point& b) { + return std::abs(DotProduct(a, b)) < kMaxDotProduct; +} + +rtc::Maybe<Point> GetDirectionIfLinear( + const std::vector<Point>& array_geometry) { + RTC_DCHECK_GT(array_geometry.size(), 1u); + const Point first_pair_direction = + PairDirection(array_geometry[0], array_geometry[1]); + for (size_t i = 2u; i < array_geometry.size(); ++i) { + const Point pair_direction = + PairDirection(array_geometry[i - 1], array_geometry[i]); + if (!AreParallel(first_pair_direction, pair_direction)) { + return rtc::Maybe<Point>(); + } + } + return rtc::Maybe<Point>(first_pair_direction); +} + +rtc::Maybe<Point> GetNormalIfPlanar(const std::vector<Point>& array_geometry) { + RTC_DCHECK_GT(array_geometry.size(), 1u); + const Point first_pair_direction = + PairDirection(array_geometry[0], array_geometry[1]); + Point pair_direction(0.f, 0.f, 0.f); + size_t i = 2u; + bool is_linear = true; + for (; i < array_geometry.size() && is_linear; ++i) { + pair_direction = PairDirection(array_geometry[i - 1], array_geometry[i]); + if (!AreParallel(first_pair_direction, pair_direction)) { + is_linear = false; + } + } + if (is_linear) { + return rtc::Maybe<Point>(); + } + const Point normal_direction = + CrossProduct(first_pair_direction, pair_direction); + for (; i < array_geometry.size(); ++i) { + pair_direction = PairDirection(array_geometry[i - 1], array_geometry[i]); + if (!ArePerpendicular(normal_direction, pair_direction)) { + return rtc::Maybe<Point>(); + } + } + return rtc::Maybe<Point>(normal_direction); +} + +rtc::Maybe<Point> GetArrayNormalIfExists( + const std::vector<Point>& array_geometry) { + const rtc::Maybe<Point> direction = GetDirectionIfLinear(array_geometry); + if (direction) { + return rtc::Maybe<Point>(Point(direction->y(), -direction->x(), 0.f)); + } + const rtc::Maybe<Point> normal = GetNormalIfPlanar(array_geometry); + if (normal && normal->z() < kMaxDotProduct) { + return normal; + } + return rtc::Maybe<Point>(); +} + +Point AzimuthToPoint(float azimuth) { + return Point(std::cos(azimuth), std::sin(azimuth), 0.f); +} + +} // namespace webrtc diff --git a/webrtc/modules/audio_processing/beamformer/array_util.h b/webrtc/modules/audio_processing/beamformer/array_util.h index f7598c0..7fff973 100644 --- a/webrtc/modules/audio_processing/beamformer/array_util.h +++ b/webrtc/modules/audio_processing/beamformer/array_util.h @@ -12,12 +12,25 @@ #define WEBRTC_MODULES_AUDIO_PROCESSING_BEAMFORMER_ARRAY_UTIL_H_ #include <cmath> +#include <vector> + +#include "webrtc/base/maybe.h" namespace webrtc { -// Coordinates in meters. +// Coordinates in meters. The convention used is: +// x: the horizontal dimension, with positive to the right from the camera's +// perspective. +// y: the depth dimension, with positive forward from the camera's +// perspective. +// z: the vertical dimension, with positive upwards. template<typename T> struct CartesianPoint { + CartesianPoint() { + c[0] = 0; + c[1] = 0; + c[2] = 0; + } CartesianPoint(T x, T y, T z) { c[0] = x; c[1] = y; @@ -31,6 +44,35 @@ struct CartesianPoint { using Point = CartesianPoint<float>; +// Calculates the direction from a to b. +Point PairDirection(const Point& a, const Point& b); + +float DotProduct(const Point& a, const Point& b); +Point CrossProduct(const Point& a, const Point& b); + +bool AreParallel(const Point& a, const Point& b); +bool ArePerpendicular(const Point& a, const Point& b); + +// Returns the minimum distance between any two Points in the given +// |array_geometry|. +float GetMinimumSpacing(const std::vector<Point>& array_geometry); + +// If the given array geometry is linear it returns the direction without +// normalizing. +rtc::Maybe<Point> GetDirectionIfLinear( + const std::vector<Point>& array_geometry); + +// If the given array geometry is planar it returns the normal without +// normalizing. +rtc::Maybe<Point> GetNormalIfPlanar(const std::vector<Point>& array_geometry); + +// Returns the normal of an array if it has one and it is in the xy-plane. +rtc::Maybe<Point> GetArrayNormalIfExists( + const std::vector<Point>& array_geometry); + +// The resulting Point will be in the xy-plane. +Point AzimuthToPoint(float azimuth); + template<typename T> float Distance(CartesianPoint<T> a, CartesianPoint<T> b) { return std::sqrt((a.x() - b.x()) * (a.x() - b.x()) + @@ -38,6 +80,11 @@ float Distance(CartesianPoint<T> a, CartesianPoint<T> b) { (a.z() - b.z()) * (a.z() - b.z())); } +// The convention used: +// azimuth: zero is to the right from the camera's perspective, with positive +// angles in radians counter-clockwise. +// elevation: zero is horizontal, with positive angles in radians upwards. +// radius: distance from the camera in meters. template <typename T> struct SphericalPoint { SphericalPoint(T azimuth, T elevation, T radius) { @@ -53,6 +100,17 @@ struct SphericalPoint { using SphericalPointf = SphericalPoint<float>; +// Helper functions to transform degrees to radians and the inverse. +template <typename T> +T DegreesToRadians(T angle_degrees) { + return M_PI * angle_degrees / 180; +} + +template <typename T> +T RadiansToDegrees(T angle_radians) { + return 180 * angle_radians / M_PI; +} + } // namespace webrtc #endif // WEBRTC_MODULES_AUDIO_PROCESSING_BEAMFORMER_ARRAY_UTIL_H_ diff --git a/webrtc/modules/audio_processing/beamformer/beamformer.h b/webrtc/modules/audio_processing/beamformer/beamformer.h index 54734dd..6a9ff45 100644 --- a/webrtc/modules/audio_processing/beamformer/beamformer.h +++ b/webrtc/modules/audio_processing/beamformer/beamformer.h @@ -32,6 +32,9 @@ class Beamformer { // Needs to be called before the the Beamformer can be used. virtual void Initialize(int chunk_size_ms, int sample_rate_hz) = 0; + // Aim the beamformer at a point in space. + virtual void AimAt(const SphericalPointf& spherical_point) = 0; + // Indicates whether a given point is inside of the beam. virtual bool IsInBeam(const SphericalPointf& spherical_point) { return true; } diff --git a/webrtc/modules/audio_processing/beamformer/covariance_matrix_generator.cc b/webrtc/modules/audio_processing/beamformer/covariance_matrix_generator.cc index efc5b0f..d072832 100644 --- a/webrtc/modules/audio_processing/beamformer/covariance_matrix_generator.cc +++ b/webrtc/modules/audio_processing/beamformer/covariance_matrix_generator.cc @@ -14,6 +14,7 @@ #include <cmath> +namespace webrtc { namespace { float BesselJ0(float x) { @@ -24,9 +25,19 @@ float BesselJ0(float x) { #endif } -} // namespace +// Calculates the Euclidean norm for a row vector. +float Norm(const ComplexMatrix<float>& x) { + RTC_CHECK_EQ(1, x.num_rows()); + const size_t length = x.num_columns(); + const complex<float>* elems = x.elements()[0]; + float result = 0.f; + for (size_t i = 0u; i < length; ++i) { + result += std::norm(elems[i]); + } + return std::sqrt(result); +} -namespace webrtc { +} // namespace void CovarianceMatrixGenerator::UniformCovarianceMatrix( float wave_number, @@ -69,6 +80,7 @@ void CovarianceMatrixGenerator::AngledCovarianceMatrix( geometry, angle, &interf_cov_vector); + interf_cov_vector.Scale(1.f / Norm(interf_cov_vector)); interf_cov_vector_transposed.Transpose(interf_cov_vector); interf_cov_vector.PointwiseConjugate(); mat->Multiply(interf_cov_vector_transposed, interf_cov_vector); diff --git a/webrtc/modules/audio_processing/beamformer/nonlinear_beamformer.cc b/webrtc/modules/audio_processing/beamformer/nonlinear_beamformer.cc index da7ad0d..029fa08 100644 --- a/webrtc/modules/audio_processing/beamformer/nonlinear_beamformer.cc +++ b/webrtc/modules/audio_processing/beamformer/nonlinear_beamformer.cc @@ -27,33 +27,21 @@ namespace { // Alpha for the Kaiser Bessel Derived window. const float kKbdAlpha = 1.5f; -// The minimum value a post-processing mask can take. -const float kMaskMinimum = 0.01f; - const float kSpeedOfSoundMeterSeconds = 343; -// For both target and interference angles, PI / 2 is perpendicular to the -// microphone array, facing forwards. The positive direction goes -// counterclockwise. -// The angle at which we amplify sound. -const float kTargetAngleRadians = static_cast<float>(M_PI) / 2.f; +// The minimum separation in radians between the target direction and an +// interferer scenario. +const float kMinAwayRadians = 0.2f; -// The angle at which we suppress sound. Suppression is symmetric around PI / 2 -// radians, so sound is suppressed at both +|kInterfAngleRadians| and -// PI - |kInterfAngleRadians|. Since the beamformer is robust, this should -// suppress sound coming from close angles as well. -const float kInterfAngleRadians = static_cast<float>(M_PI) / 4.f; +// The separation between the target direction and the closest interferer +// scenario is proportional to this constant. +const float kAwaySlope = 0.008f; // When calculating the interference covariance matrix, this is the weight for // the weighted average between the uniform covariance matrix and the angled // covariance matrix. // Rpsi = Rpsi_angled * kBalance + Rpsi_uniform * (1 - kBalance) -const float kBalance = 0.4f; - -const float kHalfBeamWidthRadians = static_cast<float>(M_PI) * 20.f / 180.f; - -// TODO(claguna): need comment here. -const float kBeamwidthConstant = 0.00002f; +const float kBalance = 0.95f; // Alpha coefficients for mask smoothing. const float kMaskTimeSmoothAlpha = 0.2f; @@ -64,17 +52,28 @@ const float kMaskFrequencySmoothAlpha = 0.6f; const int kLowMeanStartHz = 200; const int kLowMeanEndHz = 400; -const int kHighMeanStartHz = 3000; -const int kHighMeanEndHz = 5000; +// Range limiter for subtractive terms in the nominator and denominator of the +// postfilter expression. It handles the scenario mismatch between the true and +// model sources (target and interference). +const float kCutOffConstant = 0.9999f; // Quantile of mask values which is used to estimate target presence. const float kMaskQuantile = 0.7f; // Mask threshold over which the data is considered signal and not interference. -const float kMaskTargetThreshold = 0.3f; +// It has to be updated every time the postfilter calculation is changed +// significantly. +// TODO(aluebs): Write a tool to tune the target threshold automatically based +// on files annotated with target and interference ground truth. +const float kMaskTargetThreshold = 0.01f; // Time in seconds after which the data is considered interference if the mask // does not pass |kMaskTargetThreshold|. const float kHoldTargetSeconds = 0.25f; +// To compensate for the attenuation this algorithm introduces to the target +// signal. It was estimated empirically from a low-noise low-reverberation +// recording from broadside. +const float kCompensationGain = 2.f; + // Does conjugate(|norm_mat|) * |mat| * transpose(|norm_mat|). No extra space is // used; to accomplish this, we compute both multiplications in the same loop. // The returned norm is clamped to be non-negative. @@ -179,13 +178,23 @@ std::vector<Point> GetCenteredArray(std::vector<Point> array_geometry) { } // namespace +const float NonlinearBeamformer::kHalfBeamWidthRadians = DegreesToRadians(20.f); + // static const size_t NonlinearBeamformer::kNumFreqBins; NonlinearBeamformer::NonlinearBeamformer( - const std::vector<Point>& array_geometry) - : num_input_channels_(array_geometry.size()), - array_geometry_(GetCenteredArray(array_geometry)) { + const std::vector<Point>& array_geometry, + SphericalPointf target_direction) + : num_input_channels_(array_geometry.size()), + array_geometry_(GetCenteredArray(array_geometry)), + array_normal_(GetArrayNormalIfExists(array_geometry)), + min_mic_spacing_(GetMinimumSpacing(array_geometry)), + target_angle_radians_(target_direction.azimuth()), + away_radians_(std::min( + static_cast<float>(M_PI), + std::max(kMinAwayRadians, + kAwaySlope * static_cast<float>(M_PI) / min_mic_spacing_))) { WindowGenerator::KaiserBesselDerived(kKbdAlpha, kFftSize, window_); } @@ -193,32 +202,12 @@ void NonlinearBeamformer::Initialize(int chunk_size_ms, int sample_rate_hz) { chunk_length_ = static_cast<size_t>(sample_rate_hz / (1000.f / chunk_size_ms)); sample_rate_hz_ = sample_rate_hz; - low_mean_start_bin_ = Round(kLowMeanStartHz * kFftSize / sample_rate_hz_); - low_mean_end_bin_ = Round(kLowMeanEndHz * kFftSize / sample_rate_hz_); - high_mean_start_bin_ = Round(kHighMeanStartHz * kFftSize / sample_rate_hz_); - high_mean_end_bin_ = Round(kHighMeanEndHz * kFftSize / sample_rate_hz_); - // These bin indexes determine the regions over which a mean is taken. This - // is applied as a constant value over the adjacent end "frequency correction" - // regions. - // - // low_mean_start_bin_ high_mean_start_bin_ - // v v constant - // |----------------|--------|----------------|-------|----------------| - // constant ^ ^ - // low_mean_end_bin_ high_mean_end_bin_ - // - RTC_DCHECK_GT(low_mean_start_bin_, 0U); - RTC_DCHECK_LT(low_mean_start_bin_, low_mean_end_bin_); - RTC_DCHECK_LT(low_mean_end_bin_, high_mean_end_bin_); - RTC_DCHECK_LT(high_mean_start_bin_, high_mean_end_bin_); - RTC_DCHECK_LT(high_mean_end_bin_, kNumFreqBins - 1); high_pass_postfilter_mask_ = 1.f; is_target_present_ = false; hold_target_blocks_ = kHoldTargetSeconds * 2 * sample_rate_hz / kFftSize; interference_blocks_count_ = hold_target_blocks_; - lapped_transform_.reset(new LappedTransform(num_input_channels_, 1, chunk_length_, @@ -231,34 +220,88 @@ void NonlinearBeamformer::Initialize(int chunk_size_ms, int sample_rate_hz) { final_mask_[i] = 1.f; float freq_hz = (static_cast<float>(i) / kFftSize) * sample_rate_hz_; wave_numbers_[i] = 2 * M_PI * freq_hz / kSpeedOfSoundMeterSeconds; - mask_thresholds_[i] = num_input_channels_ * num_input_channels_ * - kBeamwidthConstant * wave_numbers_[i] * - wave_numbers_[i]; } - // Initialize all nonadaptive values before looping through the frames. - InitDelaySumMasks(); - InitTargetCovMats(); - InitInterfCovMats(); + InitLowFrequencyCorrectionRanges(); + InitDiffuseCovMats(); + AimAt(SphericalPointf(target_angle_radians_, 0.f, 1.f)); +} - for (size_t i = 0; i < kNumFreqBins; ++i) { - rxiws_[i] = Norm(target_cov_mats_[i], delay_sum_masks_[i]); - rpsiws_[i] = Norm(interf_cov_mats_[i], delay_sum_masks_[i]); - reflected_rpsiws_[i] = - Norm(reflected_interf_cov_mats_[i], delay_sum_masks_[i]); +// These bin indexes determine the regions over which a mean is taken. This is +// applied as a constant value over the adjacent end "frequency correction" +// regions. +// +// low_mean_start_bin_ high_mean_start_bin_ +// v v constant +// |----------------|--------|----------------|-------|----------------| +// constant ^ ^ +// low_mean_end_bin_ high_mean_end_bin_ +// +void NonlinearBeamformer::InitLowFrequencyCorrectionRanges() { + low_mean_start_bin_ = Round(kLowMeanStartHz * kFftSize / sample_rate_hz_); + low_mean_end_bin_ = Round(kLowMeanEndHz * kFftSize / sample_rate_hz_); + + RTC_DCHECK_GT(low_mean_start_bin_, 0U); + RTC_DCHECK_LT(low_mean_start_bin_, low_mean_end_bin_); +} + +void NonlinearBeamformer::InitHighFrequencyCorrectionRanges() { + const float kAliasingFreqHz = + kSpeedOfSoundMeterSeconds / + (min_mic_spacing_ * (1.f + std::abs(std::cos(target_angle_radians_)))); + const float kHighMeanStartHz = std::min(0.5f * kAliasingFreqHz, + sample_rate_hz_ / 2.f); + const float kHighMeanEndHz = std::min(0.75f * kAliasingFreqHz, + sample_rate_hz_ / 2.f); + high_mean_start_bin_ = Round(kHighMeanStartHz * kFftSize / sample_rate_hz_); + high_mean_end_bin_ = Round(kHighMeanEndHz * kFftSize / sample_rate_hz_); + + RTC_DCHECK_LT(low_mean_end_bin_, high_mean_end_bin_); + RTC_DCHECK_LT(high_mean_start_bin_, high_mean_end_bin_); + RTC_DCHECK_LT(high_mean_end_bin_, kNumFreqBins - 1); +} + +void NonlinearBeamformer::InitInterfAngles() { + interf_angles_radians_.clear(); + const Point target_direction = AzimuthToPoint(target_angle_radians_); + const Point clockwise_interf_direction = + AzimuthToPoint(target_angle_radians_ - away_radians_); + if (!array_normal_ || + DotProduct(*array_normal_, target_direction) * + DotProduct(*array_normal_, clockwise_interf_direction) >= + 0.f) { + // The target and clockwise interferer are in the same half-plane defined + // by the array. + interf_angles_radians_.push_back(target_angle_radians_ - away_radians_); + } else { + // Otherwise, the interferer will begin reflecting back at the target. + // Instead rotate it away 180 degrees. + interf_angles_radians_.push_back(target_angle_radians_ - away_radians_ + + M_PI); + } + const Point counterclock_interf_direction = + AzimuthToPoint(target_angle_radians_ + away_radians_); + if (!array_normal_ || + DotProduct(*array_normal_, target_direction) * + DotProduct(*array_normal_, counterclock_interf_direction) >= + 0.f) { + // The target and counter-clockwise interferer are in the same half-plane + // defined by the array. + interf_angles_radians_.push_back(target_angle_radians_ + away_radians_); + } else { + // Otherwise, the interferer will begin reflecting back at the target. + // Instead rotate it away 180 degrees. + interf_angles_radians_.push_back(target_angle_radians_ + away_radians_ - + M_PI); } } void NonlinearBeamformer::InitDelaySumMasks() { for (size_t f_ix = 0; f_ix < kNumFreqBins; ++f_ix) { delay_sum_masks_[f_ix].Resize(1, num_input_channels_); - CovarianceMatrixGenerator::PhaseAlignmentMasks(f_ix, - kFftSize, - sample_rate_hz_, - kSpeedOfSoundMeterSeconds, - array_geometry_, - kTargetAngleRadians, - &delay_sum_masks_[f_ix]); + CovarianceMatrixGenerator::PhaseAlignmentMasks( + f_ix, kFftSize, sample_rate_hz_, kSpeedOfSoundMeterSeconds, + array_geometry_, target_angle_radians_, &delay_sum_masks_[f_ix]); complex_f norm_factor = sqrt( ConjugateDotProduct(delay_sum_masks_[f_ix], delay_sum_masks_[f_ix])); @@ -273,40 +316,53 @@ void NonlinearBeamformer::InitTargetCovMats() { for (size_t i = 0; i < kNumFreqBins; ++i) { target_cov_mats_[i].Resize(num_input_channels_, num_input_channels_); TransposedConjugatedProduct(delay_sum_masks_[i], &target_cov_mats_[i]); - complex_f normalization_factor = target_cov_mats_[i].Trace(); - target_cov_mats_[i].Scale(1.f / normalization_factor); + } +} + +void NonlinearBeamformer::InitDiffuseCovMats() { + for (size_t i = 0; i < kNumFreqBins; ++i) { + uniform_cov_mat_[i].Resize(num_input_channels_, num_input_channels_); + CovarianceMatrixGenerator::UniformCovarianceMatrix( + wave_numbers_[i], array_geometry_, &uniform_cov_mat_[i]); + complex_f normalization_factor = uniform_cov_mat_[i].elements()[0][0]; + uniform_cov_mat_[i].Scale(1.f / normalization_factor); + uniform_cov_mat_[i].Scale(1 - kBalance); } } void NonlinearBeamformer::InitInterfCovMats() { for (size_t i = 0; i < kNumFreqBins; ++i) { - interf_cov_mats_[i].Resize(num_input_channels_, num_input_channels_); - ComplexMatrixF uniform_cov_mat(num_input_channels_, num_input_channels_); - ComplexMatrixF angled_cov_mat(num_input_channels_, num_input_channels_); - - CovarianceMatrixGenerator::UniformCovarianceMatrix(wave_numbers_[i], - array_geometry_, - &uniform_cov_mat); - - CovarianceMatrixGenerator::AngledCovarianceMatrix(kSpeedOfSoundMeterSeconds, - kInterfAngleRadians, - i, - kFftSize, - kNumFreqBins, - sample_rate_hz_, - array_geometry_, - &angled_cov_mat); - // Normalize matrices before averaging them. - complex_f normalization_factor = uniform_cov_mat.Trace(); - uniform_cov_mat.Scale(1.f / normalization_factor); - normalization_factor = angled_cov_mat.Trace(); - angled_cov_mat.Scale(1.f / normalization_factor); - - // Average matrices. - uniform_cov_mat.Scale(1 - kBalance); - angled_cov_mat.Scale(kBalance); - interf_cov_mats_[i].Add(uniform_cov_mat, angled_cov_mat); - reflected_interf_cov_mats_[i].PointwiseConjugate(interf_cov_mats_[i]); + interf_cov_mats_[i].clear(); + for (size_t j = 0; j < interf_angles_radians_.size(); ++j) { + interf_cov_mats_[i].push_back(new ComplexMatrixF(num_input_channels_, + num_input_channels_)); + ComplexMatrixF angled_cov_mat(num_input_channels_, num_input_channels_); + CovarianceMatrixGenerator::AngledCovarianceMatrix( + kSpeedOfSoundMeterSeconds, + interf_angles_radians_[j], + i, + kFftSize, + kNumFreqBins, + sample_rate_hz_, + array_geometry_, + &angled_cov_mat); + // Normalize matrices before averaging them. + complex_f normalization_factor = angled_cov_mat.elements()[0][0]; + angled_cov_mat.Scale(1.f / normalization_factor); + // Weighted average of matrices. + angled_cov_mat.Scale(kBalance); + interf_cov_mats_[i][j]->Add(uniform_cov_mat_[i], angled_cov_mat); + } + } +} + +void NonlinearBeamformer::NormalizeCovMats() { + for (size_t i = 0; i < kNumFreqBins; ++i) { + rxiws_[i] = Norm(target_cov_mats_[i], delay_sum_masks_[i]); + rpsiws_[i].clear(); + for (size_t j = 0; j < interf_angles_radians_.size(); ++j) { + rpsiws_[i].push_back(Norm(*interf_cov_mats_[i][j], delay_sum_masks_[i])); + } } } @@ -322,28 +378,32 @@ void NonlinearBeamformer::ProcessChunk(const ChannelBuffer<float>& input, const float ramp_increment = (high_pass_postfilter_mask_ - old_high_pass_mask) / input.num_frames_per_band(); - // Apply delay and sum and post-filter in the time domain. WARNING: only works - // because delay-and-sum is not frequency dependent. + // Apply the smoothed high-pass mask to the first channel of each band. + // This can be done because the effct of the linear beamformer is negligible + // compared to the post-filter. for (size_t i = 1; i < input.num_bands(); ++i) { float smoothed_mask = old_high_pass_mask; for (size_t j = 0; j < input.num_frames_per_band(); ++j) { smoothed_mask += ramp_increment; - - // Applying the delay and sum (at zero degrees, this is equivalent to - // averaging). - float sum = 0.f; - for (int k = 0; k < input.num_channels(); ++k) { - sum += input.channels(i)[k][j]; - } - output->channels(i)[0][j] = sum / input.num_channels() * smoothed_mask; + output->channels(i)[0][j] = input.channels(i)[0][j] * smoothed_mask; } } } +void NonlinearBeamformer::AimAt(const SphericalPointf& target_direction) { + target_angle_radians_ = target_direction.azimuth(); + InitHighFrequencyCorrectionRanges(); + InitInterfAngles(); + InitDelaySumMasks(); + InitTargetCovMats(); + InitInterfCovMats(); + NormalizeCovMats(); +} + bool NonlinearBeamformer::IsInBeam(const SphericalPointf& spherical_point) { // If more than half-beamwidth degrees away from the beam's center, // you are out of the beam. - return fabs(spherical_point.azimuth() - kTargetAngleRadians) < + return fabs(spherical_point.azimuth() - target_angle_radians_) < kHalfBeamWidthRadians; } @@ -376,17 +436,19 @@ void NonlinearBeamformer::ProcessAudioBlock(const complex_f* const* input, rmw *= rmw; float rmw_r = rmw.real(); - new_mask_[i] = CalculatePostfilterMask(interf_cov_mats_[i], - rpsiws_[i], + new_mask_[i] = CalculatePostfilterMask(*interf_cov_mats_[i][0], + rpsiws_[i][0], ratio_rxiw_rxim, - rmw_r, - mask_thresholds_[i]); - - new_mask_[i] *= CalculatePostfilterMask(reflected_interf_cov_mats_[i], - reflected_rpsiws_[i], - ratio_rxiw_rxim, - rmw_r, - mask_thresholds_[i]); + rmw_r); + for (size_t j = 1; j < interf_angles_radians_.size(); ++j) { + float tmp_mask = CalculatePostfilterMask(*interf_cov_mats_[i][j], + rpsiws_[i][j], + ratio_rxiw_rxim, + rmw_r); + if (tmp_mask < new_mask_[i]) { + new_mask_[i] = tmp_mask; + } + } } ApplyMaskTimeSmoothing(); @@ -401,24 +463,16 @@ float NonlinearBeamformer::CalculatePostfilterMask( const ComplexMatrixF& interf_cov_mat, float rpsiw, float ratio_rxiw_rxim, - float rmw_r, - float mask_threshold) { + float rmw_r) { float rpsim = Norm(interf_cov_mat, eig_m_); - // Find lambda. float ratio = 0.f; if (rpsim > 0.f) { ratio = rpsiw / rpsim; } - float numerator = rmw_r - ratio; - float denominator = ratio_rxiw_rxim - ratio; - float mask = 1.f; - if (denominator > mask_threshold) { - float lambda = numerator / denominator; - mask = std::max(lambda * ratio_rxiw_rxim / rmw_r, kMaskMinimum); - } - return mask; + return (1.f - std::min(kCutOffConstant, ratio / rmw_r)) / + (1.f - std::min(kCutOffConstant, ratio / ratio_rxiw_rxim)); } void NonlinearBeamformer::ApplyMasks(const complex_f* const* input, @@ -433,7 +487,7 @@ void NonlinearBeamformer::ApplyMasks(const complex_f* const* input, output_channel[f_ix] += input[c_ix][f_ix] * delay_sum_mask_els[c_ix]; } - output_channel[f_ix] *= final_mask_[f_ix]; + output_channel[f_ix] *= kCompensationGain * final_mask_[f_ix]; } } diff --git a/webrtc/modules/audio_processing/beamformer/nonlinear_beamformer.h b/webrtc/modules/audio_processing/beamformer/nonlinear_beamformer.h index 46c68bf..4289cce 100644 --- a/webrtc/modules/audio_processing/beamformer/nonlinear_beamformer.h +++ b/webrtc/modules/audio_processing/beamformer/nonlinear_beamformer.h @@ -11,12 +11,17 @@ #ifndef WEBRTC_MODULES_AUDIO_PROCESSING_BEAMFORMER_NONLINEAR_BEAMFORMER_H_ #define WEBRTC_MODULES_AUDIO_PROCESSING_BEAMFORMER_NONLINEAR_BEAMFORMER_H_ +// MSVC++ requires this to be set before any other includes to get M_PI. +#define _USE_MATH_DEFINES + +#include <math.h> #include <vector> #include "webrtc/common_audio/lapped_transform.h" #include "webrtc/common_audio/channel_buffer.h" #include "webrtc/modules/audio_processing/beamformer/beamformer.h" #include "webrtc/modules/audio_processing/beamformer/complex_matrix.h" +#include "webrtc/system_wrappers/include/scoped_vector.h" namespace webrtc { @@ -26,15 +31,16 @@ namespace webrtc { // // The implemented nonlinear postfilter algorithm taken from "A Robust Nonlinear // Beamforming Postprocessor" by Bastiaan Kleijn. -// -// TODO(aluebs): Target angle assumed to be 0. Parameterize target angle. class NonlinearBeamformer : public Beamformer<float>, public LappedTransform::Callback { public: - // At the moment it only accepts uniform linear microphone arrays. Using the - // first microphone as a reference position [0, 0, 0] is a natural choice. - explicit NonlinearBeamformer(const std::vector<Point>& array_geometry); + static const float kHalfBeamWidthRadians; + + explicit NonlinearBeamformer( + const std::vector<Point>& array_geometry, + SphericalPointf target_direction = + SphericalPointf(static_cast<float>(M_PI) / 2.f, 0.f, 1.f)); // Sample rate corresponds to the lower band. // Needs to be called before the NonlinearBeamformer can be used. @@ -47,6 +53,8 @@ class NonlinearBeamformer void ProcessChunk(const ChannelBuffer<float>& input, ChannelBuffer<float>* output) override; + void AimAt(const SphericalPointf& target_direction) override; + bool IsInBeam(const SphericalPointf& spherical_point) override; // After processing each block |is_target_present_| is set to true if the @@ -65,23 +73,30 @@ class NonlinearBeamformer complex<float>* const* output) override; private: +#ifndef WEBRTC_AUDIO_PROCESSING_ONLY_BUILD + FRIEND_TEST_ALL_PREFIXES(NonlinearBeamformerTest, + InterfAnglesTakeAmbiguityIntoAccount); +#endif + typedef Matrix<float> MatrixF; typedef ComplexMatrix<float> ComplexMatrixF; typedef complex<float> complex_f; + void InitLowFrequencyCorrectionRanges(); + void InitHighFrequencyCorrectionRanges(); + void InitInterfAngles(); void InitDelaySumMasks(); - void InitTargetCovMats(); // TODO(aluebs): Make this depend on target angle. + void InitTargetCovMats(); + void InitDiffuseCovMats(); void InitInterfCovMats(); + void NormalizeCovMats(); - // An implementation of equation 18, which calculates postfilter masks that, - // when applied, minimize the mean-square error of our estimation of the - // desired signal. A sub-task is to calculate lambda, which is solved via - // equation 13. + // Calculates postfilter masks that minimize the mean squared error of our + // estimation of the desired signal. float CalculatePostfilterMask(const ComplexMatrixF& interf_cov_mat, float rpsiw, float ratio_rxiw_rxim, - float rmxi_r, - float mask_threshold); + float rmxi_r); // Prevents the postfilter masks from degenerating too quickly (a cause of // musical noise). @@ -120,6 +135,11 @@ class NonlinearBeamformer int sample_rate_hz_; const std::vector<Point> array_geometry_; + // The normal direction of the array if it has one and it is in the xy-plane. + const rtc::Maybe<Point> array_normal_; + + // Minimum spacing between microphone pairs. + const float min_mic_spacing_; // Calculated based on user-input and constants in the .cc file. size_t low_mean_start_bin_; @@ -134,28 +154,33 @@ class NonlinearBeamformer // Time and frequency smoothed mask. float final_mask_[kNumFreqBins]; + float target_angle_radians_; + // Angles of the interferer scenarios. + std::vector<float> interf_angles_radians_; + // The angle between the target and the interferer scenarios. + const float away_radians_; + // Array of length |kNumFreqBins|, Matrix of size |1| x |num_channels_|. ComplexMatrixF delay_sum_masks_[kNumFreqBins]; ComplexMatrixF normalized_delay_sum_masks_[kNumFreqBins]; - // Array of length |kNumFreqBins|, Matrix of size |num_input_channels_| x + // Arrays of length |kNumFreqBins|, Matrix of size |num_input_channels_| x // |num_input_channels_|. ComplexMatrixF target_cov_mats_[kNumFreqBins]; - + ComplexMatrixF uniform_cov_mat_[kNumFreqBins]; // Array of length |kNumFreqBins|, Matrix of size |num_input_channels_| x - // |num_input_channels_|. - ComplexMatrixF interf_cov_mats_[kNumFreqBins]; - ComplexMatrixF reflected_interf_cov_mats_[kNumFreqBins]; + // |num_input_channels_|. ScopedVector has a size equal to the number of + // interferer scenarios. + ScopedVector<ComplexMatrixF> interf_cov_mats_[kNumFreqBins]; // Of length |kNumFreqBins|. - float mask_thresholds_[kNumFreqBins]; float wave_numbers_[kNumFreqBins]; // Preallocated for ProcessAudioBlock() // Of length |kNumFreqBins|. float rxiws_[kNumFreqBins]; - float rpsiws_[kNumFreqBins]; - float reflected_rpsiws_[kNumFreqBins]; + // The vector has a size equal to the number of interferer scenarios. + std::vector<float> rpsiws_[kNumFreqBins]; // The microphone normalization factor. ComplexMatrixF eig_m_; diff --git a/webrtc/modules/audio_processing/echo_cancellation_impl.cc b/webrtc/modules/audio_processing/echo_cancellation_impl.cc index 567d9a4..56ee9e0 100644 --- a/webrtc/modules/audio_processing/echo_cancellation_impl.cc +++ b/webrtc/modules/audio_processing/echo_cancellation_impl.cc @@ -18,7 +18,7 @@ extern "C" { } #include "webrtc/modules/audio_processing/aec/include/echo_cancellation.h" #include "webrtc/modules/audio_processing/audio_buffer.h" -#include "webrtc/system_wrappers/interface/critical_section_wrapper.h" +#include "webrtc/system_wrappers/include/critical_section_wrapper.h" namespace webrtc { diff --git a/webrtc/modules/audio_processing/echo_control_mobile_impl.cc b/webrtc/modules/audio_processing/echo_control_mobile_impl.cc index 8d5ec9c..954aac7 100644 --- a/webrtc/modules/audio_processing/echo_control_mobile_impl.cc +++ b/webrtc/modules/audio_processing/echo_control_mobile_impl.cc @@ -15,8 +15,8 @@ #include "webrtc/modules/audio_processing/aecm/include/echo_control_mobile.h" #include "webrtc/modules/audio_processing/audio_buffer.h" -#include "webrtc/system_wrappers/interface/critical_section_wrapper.h" -#include "webrtc/system_wrappers/interface/logging.h" +#include "webrtc/system_wrappers/include/critical_section_wrapper.h" +#include "webrtc/system_wrappers/include/logging.h" namespace webrtc { diff --git a/webrtc/modules/audio_processing/gain_control_impl.cc b/webrtc/modules/audio_processing/gain_control_impl.cc index 8a3612d..3b1537e 100644 --- a/webrtc/modules/audio_processing/gain_control_impl.cc +++ b/webrtc/modules/audio_processing/gain_control_impl.cc @@ -14,7 +14,7 @@ #include "webrtc/modules/audio_processing/audio_buffer.h" #include "webrtc/modules/audio_processing/agc/legacy/gain_control.h" -#include "webrtc/system_wrappers/interface/critical_section_wrapper.h" +#include "webrtc/system_wrappers/include/critical_section_wrapper.h" namespace webrtc { diff --git a/webrtc/modules/audio_processing/high_pass_filter_impl.cc b/webrtc/modules/audio_processing/high_pass_filter_impl.cc index 6302f13..29e4820 100644 --- a/webrtc/modules/audio_processing/high_pass_filter_impl.cc +++ b/webrtc/modules/audio_processing/high_pass_filter_impl.cc @@ -14,7 +14,7 @@ #include "webrtc/common_audio/signal_processing/include/signal_processing_library.h" #include "webrtc/modules/audio_processing/audio_buffer.h" -#include "webrtc/system_wrappers/interface/critical_section_wrapper.h" +#include "webrtc/system_wrappers/include/critical_section_wrapper.h" #include "webrtc/typedefs.h" diff --git a/webrtc/modules/audio_processing/include/audio_processing.h b/webrtc/modules/audio_processing/include/audio_processing.h index 318b2f8..c8ddc6a 100644 --- a/webrtc/modules/audio_processing/include/audio_processing.h +++ b/webrtc/modules/audio_processing/include/audio_processing.h @@ -11,6 +11,10 @@ #ifndef WEBRTC_MODULES_AUDIO_PROCESSING_INCLUDE_AUDIO_PROCESSING_H_ #define WEBRTC_MODULES_AUDIO_PROCESSING_INCLUDE_AUDIO_PROCESSING_H_ +// MSVC++ requires this to be set before any other includes to get M_PI. +#define _USE_MATH_DEFINES + +#include <math.h> #include <stddef.h> // size_t #include <stdio.h> // FILE #include <vector> @@ -109,12 +113,23 @@ struct ExperimentalNs { struct Beamforming { Beamforming() : enabled(false), - array_geometry() {} + array_geometry(), + target_direction( + SphericalPointf(static_cast<float>(M_PI) / 2.f, 0.f, 1.f)) {} 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(bool enabled, + const std::vector<Point>& array_geometry, + SphericalPointf target_direction) : enabled(enabled), - array_geometry(array_geometry) {} + array_geometry(array_geometry), + target_direction(target_direction) {} const bool enabled; const std::vector<Point> array_geometry; + const SphericalPointf target_direction; }; // Use to enable intelligibility enhancer in audio processing. Must be provided diff --git a/webrtc/modules/audio_processing/level_estimator_impl.cc b/webrtc/modules/audio_processing/level_estimator_impl.cc index 26a61dc..35fe697 100644 --- a/webrtc/modules/audio_processing/level_estimator_impl.cc +++ b/webrtc/modules/audio_processing/level_estimator_impl.cc @@ -13,7 +13,7 @@ #include "webrtc/modules/audio_processing/audio_buffer.h" #include "webrtc/modules/audio_processing/include/audio_processing.h" #include "webrtc/modules/audio_processing/rms_level.h" -#include "webrtc/system_wrappers/interface/critical_section_wrapper.h" +#include "webrtc/system_wrappers/include/critical_section_wrapper.h" namespace webrtc { diff --git a/webrtc/modules/audio_processing/noise_suppression_impl.cc b/webrtc/modules/audio_processing/noise_suppression_impl.cc index 1501911..65ec3c4 100644 --- a/webrtc/modules/audio_processing/noise_suppression_impl.cc +++ b/webrtc/modules/audio_processing/noise_suppression_impl.cc @@ -18,7 +18,7 @@ #elif defined(WEBRTC_NS_FIXED) #include "webrtc/modules/audio_processing/ns/include/noise_suppression_x.h" #endif -#include "webrtc/system_wrappers/interface/critical_section_wrapper.h" +#include "webrtc/system_wrappers/include/critical_section_wrapper.h" namespace webrtc { diff --git a/webrtc/modules/audio_processing/ns/nsx_core.c b/webrtc/modules/audio_processing/ns/nsx_core.c index ed6125a..7144579 100644 --- a/webrtc/modules/audio_processing/ns/nsx_core.c +++ b/webrtc/modules/audio_processing/ns/nsx_core.c @@ -17,7 +17,7 @@ #include "webrtc/common_audio/signal_processing/include/real_fft.h" #include "webrtc/modules/audio_processing/ns/nsx_core.h" -#include "webrtc/system_wrappers/interface/cpu_features_wrapper.h" +#include "webrtc/system_wrappers/include/cpu_features_wrapper.h" #if (defined WEBRTC_DETECT_NEON || defined WEBRTC_HAS_NEON) /* Tables are defined in ARM assembly files. */ diff --git a/webrtc/modules/audio_processing/splitting_filter.h b/webrtc/modules/audio_processing/splitting_filter.h index 51088d5..4698d3f 100644 --- a/webrtc/modules/audio_processing/splitting_filter.h +++ b/webrtc/modules/audio_processing/splitting_filter.h @@ -15,7 +15,7 @@ #include <vector> #include "webrtc/modules/audio_processing/three_band_filter_bank.h" -#include "webrtc/system_wrappers/interface/scoped_vector.h" +#include "webrtc/system_wrappers/include/scoped_vector.h" namespace webrtc { diff --git a/webrtc/modules/audio_processing/three_band_filter_bank.h b/webrtc/modules/audio_processing/three_band_filter_bank.h index 18e8aee..cb9cfbe 100644 --- a/webrtc/modules/audio_processing/three_band_filter_bank.h +++ b/webrtc/modules/audio_processing/three_band_filter_bank.h @@ -15,7 +15,7 @@ #include <vector> #include "webrtc/common_audio/sparse_fir_filter.h" -#include "webrtc/system_wrappers/interface/scoped_vector.h" +#include "webrtc/system_wrappers/include/scoped_vector.h" namespace webrtc { diff --git a/webrtc/modules/audio_processing/transient/click_annotate.cc b/webrtc/modules/audio_processing/transient/click_annotate.cc index f913cfd..38f7a8e 100644 --- a/webrtc/modules/audio_processing/transient/click_annotate.cc +++ b/webrtc/modules/audio_processing/transient/click_annotate.cc @@ -16,7 +16,7 @@ #include "webrtc/modules/audio_processing/transient/transient_detector.h" #include "webrtc/modules/audio_processing/transient/file_utils.h" #include "webrtc/base/scoped_ptr.h" -#include "webrtc/system_wrappers/interface/file_wrapper.h" +#include "webrtc/system_wrappers/include/file_wrapper.h" using rtc::scoped_ptr; using webrtc::FileWrapper; diff --git a/webrtc/modules/audio_processing/transient/file_utils.cc b/webrtc/modules/audio_processing/transient/file_utils.cc index 2325bd6..e043286 100644 --- a/webrtc/modules/audio_processing/transient/file_utils.cc +++ b/webrtc/modules/audio_processing/transient/file_utils.cc @@ -11,7 +11,7 @@ #include "webrtc/modules/audio_processing/transient/file_utils.h" #include "webrtc/base/scoped_ptr.h" -#include "webrtc/system_wrappers/interface/file_wrapper.h" +#include "webrtc/system_wrappers/include/file_wrapper.h" #include "webrtc/typedefs.h" namespace webrtc { diff --git a/webrtc/modules/audio_processing/transient/file_utils.h b/webrtc/modules/audio_processing/transient/file_utils.h index dbc3b5f..cc76953 100644 --- a/webrtc/modules/audio_processing/transient/file_utils.h +++ b/webrtc/modules/audio_processing/transient/file_utils.h @@ -13,7 +13,7 @@ #include <string.h> -#include "webrtc/system_wrappers/interface/file_wrapper.h" +#include "webrtc/system_wrappers/include/file_wrapper.h" #include "webrtc/typedefs.h" namespace webrtc { diff --git a/webrtc/modules/audio_processing/transient/transient_suppressor.cc b/webrtc/modules/audio_processing/transient/transient_suppressor.cc index 206d14d..c8d9e65 100644 --- a/webrtc/modules/audio_processing/transient/transient_suppressor.cc +++ b/webrtc/modules/audio_processing/transient/transient_suppressor.cc @@ -24,7 +24,7 @@ #include "webrtc/modules/audio_processing/transient/common.h" #include "webrtc/modules/audio_processing/transient/transient_detector.h" #include "webrtc/modules/audio_processing/ns/windows_private.h" -#include "webrtc/system_wrappers/interface/logging.h" +#include "webrtc/system_wrappers/include/logging.h" #include "webrtc/typedefs.h" namespace webrtc { diff --git a/webrtc/modules/audio_processing/utility/delay_estimator_wrapper.c b/webrtc/modules/audio_processing/utility/delay_estimator_wrapper.c index 270588f..b5448bc 100644 --- a/webrtc/modules/audio_processing/utility/delay_estimator_wrapper.c +++ b/webrtc/modules/audio_processing/utility/delay_estimator_wrapper.c @@ -16,7 +16,7 @@ #include "webrtc/modules/audio_processing/utility/delay_estimator.h" #include "webrtc/modules/audio_processing/utility/delay_estimator_internal.h" -#include "webrtc/system_wrappers/interface/compile_assert_c.h" +#include "webrtc/system_wrappers/include/compile_assert_c.h" // Only bit |kBandFirst| through bit |kBandLast| are processed and // |kBandFirst| - |kBandLast| must be < 32. diff --git a/webrtc/modules/audio_processing/voice_detection_impl.cc b/webrtc/modules/audio_processing/voice_detection_impl.cc index 710df42..374189e 100644 --- a/webrtc/modules/audio_processing/voice_detection_impl.cc +++ b/webrtc/modules/audio_processing/voice_detection_impl.cc @@ -14,7 +14,7 @@ #include "webrtc/common_audio/vad/include/webrtc_vad.h" #include "webrtc/modules/audio_processing/audio_buffer.h" -#include "webrtc/system_wrappers/interface/critical_section_wrapper.h" +#include "webrtc/system_wrappers/include/critical_section_wrapper.h" namespace webrtc { diff --git a/webrtc/modules/interface/module_common_types.h b/webrtc/modules/interface/module_common_types.h index 18699d8..cc4993a 100644 --- a/webrtc/modules/interface/module_common_types.h +++ b/webrtc/modules/interface/module_common_types.h @@ -41,7 +41,7 @@ const uint8_t kNoTemporalIdx = 0xFF; const uint8_t kNoSpatialIdx = 0xFF; const uint8_t kNoGofIdx = 0xFF; const size_t kMaxVp9RefPics = 3; -const size_t kMaxVp9FramesInGof = 16; +const size_t kMaxVp9FramesInGof = 0xFF; // 8 bits const size_t kMaxVp9NumberOfSpatialLayers = 8; const int kNoKeyIdx = -1; diff --git a/webrtc/system_wrappers/BUILD.gn b/webrtc/system_wrappers/BUILD.gn index 0657e20..2f68eae 100644 --- a/webrtc/system_wrappers/BUILD.gn +++ b/webrtc/system_wrappers/BUILD.gn @@ -11,39 +11,38 @@ import("../build/webrtc.gni") static_library("system_wrappers") { sources = [ - "interface/aligned_array.h", - "interface/aligned_malloc.h", - "interface/atomic32.h", - "interface/clock.h", - "interface/condition_variable_wrapper.h", - "interface/cpu_features_wrapper.h", - "interface/cpu_info.h", - "interface/critical_section_wrapper.h", - "interface/data_log.h", - "interface/data_log_c.h", - "interface/data_log_impl.h", - "interface/event_tracer.h", - "interface/event_wrapper.h", - "interface/field_trial.h", - "interface/file_wrapper.h", - "interface/fix_interlocked_exchange_pointer_win.h", - "interface/logging.h", - "interface/metrics.h", - "interface/ref_count.h", - "interface/rtp_to_ntp.h", - "interface/rw_lock_wrapper.h", - "interface/scoped_vector.h", - "interface/sleep.h", - "interface/sort.h", - "interface/static_instance.h", - "interface/stl_util.h", - "interface/stringize_macros.h", - "interface/thread_wrapper.h", - "interface/tick_util.h", - "interface/timestamp_extrapolator.h", - "interface/trace.h", - "interface/trace_event.h", - "interface/utf_util_win.h", + "include/aligned_array.h", + "include/aligned_malloc.h", + "include/atomic32.h", + "include/clock.h", + "include/condition_variable_wrapper.h", + "include/cpu_features_wrapper.h", + "include/cpu_info.h", + "include/critical_section_wrapper.h", + "include/data_log.h", + "include/data_log_c.h", + "include/data_log_impl.h", + "include/event_tracer.h", + "include/event_wrapper.h", + "include/field_trial.h", + "include/file_wrapper.h", + "include/fix_interlocked_exchange_pointer_win.h", + "include/logging.h", + "include/metrics.h", + "include/ref_count.h", + "include/rtp_to_ntp.h", + "include/rw_lock_wrapper.h", + "include/scoped_vector.h", + "include/sleep.h", + "include/sort.h", + "include/static_instance.h", + "include/stl_util.h", + "include/stringize_macros.h", + "include/thread_wrapper.h", + "include/tick_util.h", + "include/timestamp_extrapolator.h", + "include/trace.h", + "include/utf_util_win.h", "source/aligned_malloc.cc", "source/atomic32_mac.cc", "source/atomic32_win.cc", @@ -115,7 +114,7 @@ static_library("system_wrappers") { if (is_android) { sources += [ - "interface/logcat_trace_context.h", + "include/logcat_trace_context.h", "source/logcat_trace_context.cc", ] @@ -174,7 +173,7 @@ static_library("system_wrappers") { source_set("field_trial_default") { sources = [ - "interface/field_trial_default.h", + "include/field_trial_default.h", "source/field_trial_default.cc", ] diff --git a/webrtc/system_wrappers/Makefile.am b/webrtc/system_wrappers/Makefile.am index fb47a3d..6c9f4ee 100644 --- a/webrtc/system_wrappers/Makefile.am +++ b/webrtc/system_wrappers/Makefile.am @@ -1,23 +1,23 @@ noinst_LTLIBRARIES = libsystem_wrappers.la -noinst_HEADERS = interface/aligned_array.h \ - interface/asm_defines.h \ - interface/compile_assert_c.h \ - interface/event_wrapper.h \ - interface/scoped_vector.h \ - interface/static_instance.h \ - interface/stl_util.h +noinst_HEADERS = include/aligned_array.h \ + include/asm_defines.h \ + include/compile_assert_c.h \ + include/event_wrapper.h \ + include/scoped_vector.h \ + include/static_instance.h \ + include/stl_util.h -libsystem_wrappers_la_SOURCES = interface/aligned_malloc.h \ - interface/cpu_features_wrapper.h \ - interface/critical_section_wrapper.h \ - interface/file_wrapper.h \ - interface/logging.h \ - interface/metrics.h \ - interface/rw_lock_wrapper.h \ - interface/sleep.h \ - interface/thread_wrapper.h \ - interface/trace.h \ +libsystem_wrappers_la_SOURCES = include/aligned_malloc.h \ + include/cpu_features_wrapper.h \ + include/critical_section_wrapper.h \ + include/file_wrapper.h \ + include/logging.h \ + include/metrics.h \ + include/rw_lock_wrapper.h \ + include/sleep.h \ + include/thread_wrapper.h \ + include/trace.h \ source/aligned_malloc.cc \ source/cpu_features.cc \ source/event.cc \ diff --git a/webrtc/system_wrappers/interface/aligned_array.h b/webrtc/system_wrappers/include/aligned_array.h index 6d6c81b..7cd182c 100644 --- a/webrtc/system_wrappers/interface/aligned_array.h +++ b/webrtc/system_wrappers/include/aligned_array.h @@ -8,11 +8,11 @@ * be found in the AUTHORS file in the root of the source tree. */ -#ifndef WEBRTC_SYSTEM_WRAPPERS_INTERFACE_ALIGNED_ARRAY_ -#define WEBRTC_SYSTEM_WRAPPERS_INTERFACE_ALIGNED_ARRAY_ +#ifndef WEBRTC_SYSTEM_WRAPPERS_INCLUDE_ALIGNED_ARRAY_ +#define WEBRTC_SYSTEM_WRAPPERS_INCLUDE_ALIGNED_ARRAY_ #include "webrtc/base/checks.h" -#include "webrtc/system_wrappers/interface/aligned_malloc.h" +#include "webrtc/system_wrappers/include/aligned_malloc.h" namespace webrtc { @@ -85,4 +85,4 @@ template<typename T> class AlignedArray { } // namespace webrtc -#endif // WEBRTC_SYSTEM_WRAPPERS_INTERFACE_ALIGNED_ARRAY_ +#endif // WEBRTC_SYSTEM_WRAPPERS_INCLUDE_ALIGNED_ARRAY_ diff --git a/webrtc/system_wrappers/interface/aligned_malloc.h b/webrtc/system_wrappers/include/aligned_malloc.h index 5d343cd..277abec 100644 --- a/webrtc/system_wrappers/interface/aligned_malloc.h +++ b/webrtc/system_wrappers/include/aligned_malloc.h @@ -8,8 +8,8 @@ * be found in the AUTHORS file in the root of the source tree. */ -#ifndef WEBRTC_SYSTEM_WRAPPERS_INTERFACE_ALIGNED_MALLOC_H_ -#define WEBRTC_SYSTEM_WRAPPERS_INTERFACE_ALIGNED_MALLOC_H_ +#ifndef WEBRTC_SYSTEM_WRAPPERS_INCLUDE_ALIGNED_MALLOC_H_ +#define WEBRTC_SYSTEM_WRAPPERS_INCLUDE_ALIGNED_MALLOC_H_ // The functions declared here // 1) Allocates block of aligned memory. @@ -56,4 +56,4 @@ struct AlignedFreeDeleter { } // namespace webrtc -#endif // WEBRTC_SYSTEM_WRAPPERS_INTERFACE_ALIGNED_MALLOC_H_ +#endif // WEBRTC_SYSTEM_WRAPPERS_INCLUDE_ALIGNED_MALLOC_H_ diff --git a/webrtc/system_wrappers/interface/asm_defines.h b/webrtc/system_wrappers/include/asm_defines.h index c2a688f..fe4c05e 100644 --- a/webrtc/system_wrappers/interface/asm_defines.h +++ b/webrtc/system_wrappers/include/asm_defines.h @@ -8,8 +8,8 @@ * be found in the AUTHORS file in the root of the source tree. */ -#ifndef WEBRTC_SYSTEM_WRAPPERS_INTERFACE_ASM_DEFINES_H_ -#define WEBRTC_SYSTEM_WRAPPERS_INTERFACE_ASM_DEFINES_H_ +#ifndef WEBRTC_SYSTEM_WRAPPERS_INCLUDE_ASM_DEFINES_H_ +#define WEBRTC_SYSTEM_WRAPPERS_INCLUDE_ASM_DEFINES_H_ #if defined(__linux__) && defined(__ELF__) .section .note.GNU-stack,"",%progbits @@ -63,4 +63,4 @@ strheq \reg1, \reg2, \num .text -#endif // WEBRTC_SYSTEM_WRAPPERS_INTERFACE_ASM_DEFINES_H_ +#endif // WEBRTC_SYSTEM_WRAPPERS_INCLUDE_ASM_DEFINES_H_ diff --git a/webrtc/system_wrappers/interface/compile_assert_c.h b/webrtc/system_wrappers/include/compile_assert_c.h index dbb5292..b402d71 100644 --- a/webrtc/system_wrappers/interface/compile_assert_c.h +++ b/webrtc/system_wrappers/include/compile_assert_c.h @@ -8,8 +8,8 @@ * be found in the AUTHORS file in the root of the source tree. */ -#ifndef WEBRTC_SYSTEM_WRAPPERS_INTERFACE_COMPILE_ASSERT_H_ -#define WEBRTC_SYSTEM_WRAPPERS_INTERFACE_COMPILE_ASSERT_H_ +#ifndef WEBRTC_SYSTEM_WRAPPERS_INCLUDE_COMPILE_ASSERT_H_ +#define WEBRTC_SYSTEM_WRAPPERS_INCLUDE_COMPILE_ASSERT_H_ #ifdef __cplusplus #error "Only use this for C files. For C++, use static_assert." @@ -21,4 +21,4 @@ // COMPILE_ASSERT(sizeof(foo) < 128); #define COMPILE_ASSERT(expression) switch (0) {case 0: case expression:;} -#endif // WEBRTC_SYSTEM_WRAPPERS_INTERFACE_COMPILE_ASSERT_H_ +#endif // WEBRTC_SYSTEM_WRAPPERS_INCLUDE_COMPILE_ASSERT_H_ diff --git a/webrtc/system_wrappers/interface/cpu_features_wrapper.h b/webrtc/system_wrappers/include/cpu_features_wrapper.h index 5697c49..9838d94 100644 --- a/webrtc/system_wrappers/interface/cpu_features_wrapper.h +++ b/webrtc/system_wrappers/include/cpu_features_wrapper.h @@ -8,8 +8,8 @@ * be found in the AUTHORS file in the root of the source tree. */ -#ifndef WEBRTC_SYSTEM_WRAPPERS_INTERFACE_CPU_FEATURES_WRAPPER_H_ -#define WEBRTC_SYSTEM_WRAPPERS_INTERFACE_CPU_FEATURES_WRAPPER_H_ +#ifndef WEBRTC_SYSTEM_WRAPPERS_INCLUDE_CPU_FEATURES_WRAPPER_H_ +#define WEBRTC_SYSTEM_WRAPPERS_INCLUDE_CPU_FEATURES_WRAPPER_H_ #if defined(__cplusplus) || defined(c_plusplus) extern "C" { @@ -48,4 +48,4 @@ extern uint64_t WebRtc_GetCPUFeaturesARM(void); } // extern "C" #endif -#endif // WEBRTC_SYSTEM_WRAPPERS_INTERFACE_CPU_FEATURES_WRAPPER_H_ +#endif // WEBRTC_SYSTEM_WRAPPERS_INCLUDE_CPU_FEATURES_WRAPPER_H_ diff --git a/webrtc/system_wrappers/interface/critical_section_wrapper.h b/webrtc/system_wrappers/include/critical_section_wrapper.h index e93a249..7dd217e 100644 --- a/webrtc/system_wrappers/interface/critical_section_wrapper.h +++ b/webrtc/system_wrappers/include/critical_section_wrapper.h @@ -8,8 +8,8 @@ * be found in the AUTHORS file in the root of the source tree. */ -#ifndef WEBRTC_SYSTEM_WRAPPERS_INTERFACE_CRITICAL_SECTION_WRAPPER_H_ -#define WEBRTC_SYSTEM_WRAPPERS_INTERFACE_CRITICAL_SECTION_WRAPPER_H_ +#ifndef WEBRTC_SYSTEM_WRAPPERS_INCLUDE_CRITICAL_SECTION_WRAPPER_H_ +#define WEBRTC_SYSTEM_WRAPPERS_INCLUDE_CRITICAL_SECTION_WRAPPER_H_ // If the critical section is heavily contended it may be beneficial to use // read/write locks instead. @@ -51,4 +51,4 @@ class SCOPED_LOCKABLE CriticalSectionScoped { } // namespace webrtc -#endif // WEBRTC_SYSTEM_WRAPPERS_INTERFACE_CRITICAL_SECTION_WRAPPER_H_ +#endif // WEBRTC_SYSTEM_WRAPPERS_INCLUDE_CRITICAL_SECTION_WRAPPER_H_ diff --git a/webrtc/system_wrappers/interface/event_wrapper.h b/webrtc/system_wrappers/include/event_wrapper.h index bd12eef..cc3722b 100644 --- a/webrtc/system_wrappers/interface/event_wrapper.h +++ b/webrtc/system_wrappers/include/event_wrapper.h @@ -8,8 +8,8 @@ * be found in the AUTHORS file in the root of the source tree. */ -#ifndef WEBRTC_SYSTEM_WRAPPERS_INTERFACE_EVENT_WRAPPER_H_ -#define WEBRTC_SYSTEM_WRAPPERS_INTERFACE_EVENT_WRAPPER_H_ +#ifndef WEBRTC_SYSTEM_WRAPPERS_INCLUDE_EVENT_WRAPPER_H_ +#define WEBRTC_SYSTEM_WRAPPERS_INCLUDE_EVENT_WRAPPER_H_ namespace webrtc { enum EventTypeWrapper { @@ -67,4 +67,4 @@ class EventTimerWrapper : public EventWrapper { } // namespace webrtc -#endif // WEBRTC_SYSTEM_WRAPPERS_INTERFACE_EVENT_WRAPPER_H_ +#endif // WEBRTC_SYSTEM_WRAPPERS_INCLUDE_EVENT_WRAPPER_H_ diff --git a/webrtc/system_wrappers/interface/file_wrapper.h b/webrtc/system_wrappers/include/file_wrapper.h index 8f4e09f..b32a62f 100644 --- a/webrtc/system_wrappers/interface/file_wrapper.h +++ b/webrtc/system_wrappers/include/file_wrapper.h @@ -8,8 +8,8 @@ * be found in the AUTHORS file in the root of the source tree. */ -#ifndef WEBRTC_SYSTEM_WRAPPERS_INTERFACE_FILE_WRAPPER_H_ -#define WEBRTC_SYSTEM_WRAPPERS_INTERFACE_FILE_WRAPPER_H_ +#ifndef WEBRTC_SYSTEM_WRAPPERS_INCLUDE_FILE_WRAPPER_H_ +#define WEBRTC_SYSTEM_WRAPPERS_INCLUDE_FILE_WRAPPER_H_ #include <stddef.h> #include <stdio.h> @@ -75,4 +75,4 @@ class FileWrapper : public InStream, public OutStream { } // namespace webrtc -#endif // WEBRTC_SYSTEM_WRAPPERS_INTERFACE_FILE_WRAPPER_H_ +#endif // WEBRTC_SYSTEM_WRAPPERS_INCLUDE_FILE_WRAPPER_H_ diff --git a/webrtc/system_wrappers/include/fix_interlocked_exchange_pointer_win.h b/webrtc/system_wrappers/include/fix_interlocked_exchange_pointer_win.h new file mode 100644 index 0000000..8fb32ef --- /dev/null +++ b/webrtc/system_wrappers/include/fix_interlocked_exchange_pointer_win.h @@ -0,0 +1,39 @@ +/* + * 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. + */ + +// Various inline functions and macros to fix compilation of 32 bit target +// on MSVC with /Wp64 flag enabled. + +// The original code can be found here: +// http://src.chromium.org/svn/trunk/src/base/fix_wp64.h + +#ifndef WEBRTC_SYSTEM_WRAPPERS_SOURCE_FIX_INTERLOCKED_EXCHANGE_POINTER_WINDOWS_H_ +#define WEBRTC_SYSTEM_WRAPPERS_SOURCE_FIX_INTERLOCKED_EXCHANGE_POINTER_WINDOWS_H_ + +#include <windows.h> + +// Platform SDK fixes when building with /Wp64 for a 32 bits target. +#if !defined(_WIN64) && defined(_Wp64) + +#ifdef InterlockedExchangePointer +#undef InterlockedExchangePointer +// The problem is that the macro provided for InterlockedExchangePointer() is +// doing a (LONG) C-style cast that triggers invariably the warning C4312 when +// building on 32 bits. +inline void* InterlockedExchangePointer(void* volatile* target, void* value) { + return reinterpret_cast<void*>(static_cast<LONG_PTR>(InterlockedExchange( + reinterpret_cast<volatile LONG*>(target), + static_cast<LONG>(reinterpret_cast<LONG_PTR>(value))))); +} +#endif // #ifdef InterlockedExchangePointer + +#endif // #if !defined(_WIN64) && defined(_Wp64) + +#endif // WEBRTC_SYSTEM_WRAPPERS_SOURCE_FIX_INTERLOCKED_EXCHANGE_POINTER_WINDOWS_H_ diff --git a/webrtc/system_wrappers/interface/logging.h b/webrtc/system_wrappers/include/logging.h index 41c436b..2b53f4f 100644 --- a/webrtc/system_wrappers/interface/logging.h +++ b/webrtc/system_wrappers/include/logging.h @@ -48,8 +48,8 @@ // LOG_FERR1(LS_WARNING, Foo, bar); // } -#ifndef WEBRTC_SYSTEM_WRAPPERS_INTERFACE_LOGGING_H_ -#define WEBRTC_SYSTEM_WRAPPERS_INTERFACE_LOGGING_H_ +#ifndef WEBRTC_SYSTEM_WRAPPERS_INCLUDE_LOGGING_H_ +#define WEBRTC_SYSTEM_WRAPPERS_INCLUDE_LOGGING_H_ #include <sstream> @@ -131,7 +131,7 @@ class LogMessageVoidify { webrtc::LogMessage(__FILE__, __LINE__, sev).stream() // The _F version prefixes the message with the current function name. -#if (defined(__GNUC__) && defined(_DEBUG)) || defined(WANT_PRETTY_LOG_F) +#if (defined(__GNUC__) && !defined(NDEBUG)) || defined(WANT_PRETTY_LOG_F) #define LOG_F(sev) LOG(sev) << __PRETTY_FUNCTION__ << ": " #else #define LOG_F(sev) LOG(sev) << __FUNCTION__ << ": " @@ -158,4 +158,4 @@ class LogMessageVoidify { } // namespace webrtc -#endif // WEBRTC_SYSTEM_WRAPPERS_INTERFACE_LOGGING_H_ +#endif // WEBRTC_SYSTEM_WRAPPERS_INCLUDE_LOGGING_H_ diff --git a/webrtc/system_wrappers/interface/metrics.h b/webrtc/system_wrappers/include/metrics.h index cb641c0..2e6e7b7 100644 --- a/webrtc/system_wrappers/interface/metrics.h +++ b/webrtc/system_wrappers/include/metrics.h @@ -8,8 +8,8 @@ // be found in the AUTHORS file in the root of the source tree. // -#ifndef WEBRTC_SYSTEM_WRAPPERS_INTERFACE_METRICS_H_ -#define WEBRTC_SYSTEM_WRAPPERS_INTERFACE_METRICS_H_ +#ifndef WEBRTC_SYSTEM_WRAPPERS_INCLUDE_METRICS_H_ +#define WEBRTC_SYSTEM_WRAPPERS_INCLUDE_METRICS_H_ #include <string> @@ -72,6 +72,9 @@ #define RTC_HISTOGRAM_COUNTS_100(name, sample) RTC_HISTOGRAM_COUNTS( \ name, sample, 1, 100, 50) +#define RTC_HISTOGRAM_COUNTS_200(name, sample) RTC_HISTOGRAM_COUNTS( \ + name, sample, 1, 200, 50) + #define RTC_HISTOGRAM_COUNTS_1000(name, sample) RTC_HISTOGRAM_COUNTS( \ name, sample, 1, 1000, 50) @@ -132,5 +135,5 @@ void HistogramAdd( } // namespace metrics } // namespace webrtc -#endif // WEBRTC_SYSTEM_WRAPPERS_INTERFACE_METRICS_H_ +#endif // WEBRTC_SYSTEM_WRAPPERS_INCLUDE_METRICS_H_ diff --git a/webrtc/system_wrappers/interface/rw_lock_wrapper.h b/webrtc/system_wrappers/include/rw_lock_wrapper.h index dbe6d6c..751b6a1 100644 --- a/webrtc/system_wrappers/interface/rw_lock_wrapper.h +++ b/webrtc/system_wrappers/include/rw_lock_wrapper.h @@ -8,8 +8,8 @@ * be found in the AUTHORS file in the root of the source tree. */ -#ifndef WEBRTC_SYSTEM_WRAPPERS_INTERFACE_RW_LOCK_WRAPPER_H_ -#define WEBRTC_SYSTEM_WRAPPERS_INTERFACE_RW_LOCK_WRAPPER_H_ +#ifndef WEBRTC_SYSTEM_WRAPPERS_INCLUDE_RW_LOCK_WRAPPER_H_ +#define WEBRTC_SYSTEM_WRAPPERS_INCLUDE_RW_LOCK_WRAPPER_H_ #include "webrtc/base/thread_annotations.h" @@ -65,4 +65,4 @@ class SCOPED_LOCKABLE WriteLockScoped { } // namespace webrtc -#endif // WEBRTC_SYSTEM_WRAPPERS_INTERFACE_RW_LOCK_WRAPPER_H_ +#endif // WEBRTC_SYSTEM_WRAPPERS_INCLUDE_RW_LOCK_WRAPPER_H_ diff --git a/webrtc/system_wrappers/interface/scoped_vector.h b/webrtc/system_wrappers/include/scoped_vector.h index 1a70a2c..7336d98 100644 --- a/webrtc/system_wrappers/interface/scoped_vector.h +++ b/webrtc/system_wrappers/include/scoped_vector.h @@ -10,13 +10,13 @@ // Borrowed from Chromium's src/base/memory/scoped_vector.h. -#ifndef WEBRTC_SYSTEM_WRAPPERS_INTERFACE_SCOPED_VECTOR_H_ -#define WEBRTC_SYSTEM_WRAPPERS_INTERFACE_SCOPED_VECTOR_H_ +#ifndef WEBRTC_SYSTEM_WRAPPERS_INCLUDE_SCOPED_VECTOR_H_ +#define WEBRTC_SYSTEM_WRAPPERS_INCLUDE_SCOPED_VECTOR_H_ #include <vector> #include "webrtc/base/checks.h" -#include "webrtc/system_wrappers/interface/stl_util.h" +#include "webrtc/system_wrappers/include/stl_util.h" namespace webrtc { @@ -154,4 +154,4 @@ class ScopedVector { } // namespace webrtc -#endif // WEBRTC_SYSTEM_WRAPPERS_INTERFACE_SCOPED_VECTOR_H_ +#endif // WEBRTC_SYSTEM_WRAPPERS_INCLUDE_SCOPED_VECTOR_H_ diff --git a/webrtc/system_wrappers/interface/sleep.h b/webrtc/system_wrappers/include/sleep.h index c0205bf..e7ed8b3 100644 --- a/webrtc/system_wrappers/interface/sleep.h +++ b/webrtc/system_wrappers/include/sleep.h @@ -9,8 +9,8 @@ */ // An OS-independent sleep function. -#ifndef WEBRTC_SYSTEM_WRAPPERS_INTERFACE_SLEEP_H_ -#define WEBRTC_SYSTEM_WRAPPERS_INTERFACE_SLEEP_H_ +#ifndef WEBRTC_SYSTEM_WRAPPERS_INCLUDE_SLEEP_H_ +#define WEBRTC_SYSTEM_WRAPPERS_INCLUDE_SLEEP_H_ namespace webrtc { @@ -21,4 +21,4 @@ void SleepMs(int msecs); } // namespace webrtc -#endif // WEBRTC_SYSTEM_WRAPPERS_INTERFACE_SLEEP_H_ +#endif // WEBRTC_SYSTEM_WRAPPERS_INCLUDE_SLEEP_H_ diff --git a/webrtc/system_wrappers/interface/static_instance.h b/webrtc/system_wrappers/include/static_instance.h index dad9c52..41946d9 100644 --- a/webrtc/system_wrappers/interface/static_instance.h +++ b/webrtc/system_wrappers/include/static_instance.h @@ -8,14 +8,14 @@ * be found in the AUTHORS file in the root of the source tree. */ -#ifndef WEBRTC_SYSTEM_WRAPPERS_INTERFACE_STATIC_INSTANCE_H_ -#define WEBRTC_SYSTEM_WRAPPERS_INTERFACE_STATIC_INSTANCE_H_ +#ifndef WEBRTC_SYSTEM_WRAPPERS_INCLUDE_STATIC_INSTANCE_H_ +#define WEBRTC_SYSTEM_WRAPPERS_INCLUDE_STATIC_INSTANCE_H_ #include <assert.h> -#include "webrtc/system_wrappers/interface/critical_section_wrapper.h" +#include "webrtc/system_wrappers/include/critical_section_wrapper.h" #ifdef _WIN32 -#include "webrtc/system_wrappers/interface/fix_interlocked_exchange_pointer_win.h" +#include "webrtc/system_wrappers/include/fix_interlocked_exchange_pointer_win.h" #endif namespace webrtc { @@ -150,4 +150,4 @@ static T* GetStaticInstance(CountOperation count_operation) { } // namspace webrtc -#endif // WEBRTC_SYSTEM_WRAPPERS_INTERFACE_STATIC_INSTANCE_H_ +#endif // WEBRTC_SYSTEM_WRAPPERS_INCLUDE_STATIC_INSTANCE_H_ diff --git a/webrtc/system_wrappers/interface/stl_util.h b/webrtc/system_wrappers/include/stl_util.h index ebe855f..b7a7021 100644 --- a/webrtc/system_wrappers/interface/stl_util.h +++ b/webrtc/system_wrappers/include/stl_util.h @@ -10,8 +10,8 @@ // Borrowed from Chromium's src/base/stl_util.h. -#ifndef WEBRTC_SYSTEM_WRAPPERS_INTERFACE_STL_UTIL_H_ -#define WEBRTC_SYSTEM_WRAPPERS_INTERFACE_STL_UTIL_H_ +#ifndef WEBRTC_SYSTEM_WRAPPERS_INCLUDE_STL_UTIL_H_ +#define WEBRTC_SYSTEM_WRAPPERS_INCLUDE_STL_UTIL_H_ #include <assert.h> #include <algorithm> @@ -262,4 +262,4 @@ bool STLIncludes(const Arg1& a1, const Arg2& a2) { } // namespace webrtc -#endif // WEBRTC_SYSTEM_WRAPPERS_INTERFACE_STL_UTIL_H_ +#endif // WEBRTC_SYSTEM_WRAPPERS_INCLUDE_STL_UTIL_H_ diff --git a/webrtc/system_wrappers/interface/thread_wrapper.h b/webrtc/system_wrappers/include/thread_wrapper.h index 7420561..d475302 100644 --- a/webrtc/system_wrappers/interface/thread_wrapper.h +++ b/webrtc/system_wrappers/include/thread_wrapper.h @@ -13,8 +13,8 @@ // Note: The callback function is expected to return every 2 seconds or more // often. -#ifndef WEBRTC_SYSTEM_WRAPPERS_INTERFACE_THREAD_WRAPPER_H_ -#define WEBRTC_SYSTEM_WRAPPERS_INTERFACE_THREAD_WRAPPER_H_ +#ifndef WEBRTC_SYSTEM_WRAPPERS_INCLUDE_THREAD_WRAPPER_H_ +#define WEBRTC_SYSTEM_WRAPPERS_INCLUDE_THREAD_WRAPPER_H_ #if defined(WEBRTC_WIN) #include <windows.h> @@ -92,4 +92,4 @@ class ThreadWrapper { } // namespace webrtc -#endif // WEBRTC_SYSTEM_WRAPPERS_INTERFACE_THREAD_WRAPPER_H_ +#endif // WEBRTC_SYSTEM_WRAPPERS_INCLUDE_THREAD_WRAPPER_H_ diff --git a/webrtc/system_wrappers/interface/trace.h b/webrtc/system_wrappers/include/trace.h index e63b603..25a3d74 100644 --- a/webrtc/system_wrappers/interface/trace.h +++ b/webrtc/system_wrappers/include/trace.h @@ -13,8 +13,8 @@ * messages. Apply filtering to avoid that. */ -#ifndef WEBRTC_SYSTEM_WRAPPERS_INTERFACE_TRACE_H_ -#define WEBRTC_SYSTEM_WRAPPERS_INTERFACE_TRACE_H_ +#ifndef WEBRTC_SYSTEM_WRAPPERS_INCLUDE_TRACE_H_ +#define WEBRTC_SYSTEM_WRAPPERS_INCLUDE_TRACE_H_ #include "webrtc/common_types.h" #include "webrtc/typedefs.h" @@ -89,4 +89,4 @@ class Trace { } // namespace webrtc -#endif // WEBRTC_SYSTEM_WRAPPERS_INTERFACE_TRACE_H_ +#endif // WEBRTC_SYSTEM_WRAPPERS_INCLUDE_TRACE_H_ diff --git a/webrtc/system_wrappers/source/aligned_malloc.cc b/webrtc/system_wrappers/source/aligned_malloc.cc index 258b6be..a654e97 100644 --- a/webrtc/system_wrappers/source/aligned_malloc.cc +++ b/webrtc/system_wrappers/source/aligned_malloc.cc @@ -8,7 +8,7 @@ * be found in the AUTHORS file in the root of the source tree. */ -#include "webrtc/system_wrappers/interface/aligned_malloc.h" +#include "webrtc/system_wrappers/include/aligned_malloc.h" #include <memory.h> #include <stdlib.h> diff --git a/webrtc/system_wrappers/source/cpu_features.cc b/webrtc/system_wrappers/source/cpu_features.cc index b924d77..49840eb 100644 --- a/webrtc/system_wrappers/source/cpu_features.cc +++ b/webrtc/system_wrappers/source/cpu_features.cc @@ -10,7 +10,7 @@ // Parts of this file derived from Chromium's base/cpu.cc. -#include "webrtc/system_wrappers/interface/cpu_features_wrapper.h" +#include "webrtc/system_wrappers/include/cpu_features_wrapper.h" #if defined(WEBRTC_ARCH_X86_FAMILY) && defined(_MSC_VER) #include <intrin.h> diff --git a/webrtc/system_wrappers/source/critical_section_posix.h b/webrtc/system_wrappers/source/critical_section_posix.h index d71c93d..099f74c 100644 --- a/webrtc/system_wrappers/source/critical_section_posix.h +++ b/webrtc/system_wrappers/source/critical_section_posix.h @@ -11,7 +11,7 @@ #ifndef WEBRTC_SYSTEM_WRAPPERS_SOURCE_CRITICAL_SECTION_POSIX_H_ #define WEBRTC_SYSTEM_WRAPPERS_SOURCE_CRITICAL_SECTION_POSIX_H_ -#include "webrtc/system_wrappers/interface/critical_section_wrapper.h" +#include "webrtc/system_wrappers/include/critical_section_wrapper.h" #include <pthread.h> diff --git a/webrtc/system_wrappers/source/critical_section_win.h b/webrtc/system_wrappers/source/critical_section_win.h index be237ac..8268bc3 100644 --- a/webrtc/system_wrappers/source/critical_section_win.h +++ b/webrtc/system_wrappers/source/critical_section_win.h @@ -12,7 +12,7 @@ #define WEBRTC_SYSTEM_WRAPPERS_SOURCE_CRITICAL_SECTION_WIN_H_ #include <windows.h> -#include "webrtc/system_wrappers/interface/critical_section_wrapper.h" +#include "webrtc/system_wrappers/include/critical_section_wrapper.h" #include "webrtc/typedefs.h" namespace webrtc { diff --git a/webrtc/system_wrappers/source/event.cc b/webrtc/system_wrappers/source/event.cc index 7f4f055..05f918f 100644 --- a/webrtc/system_wrappers/source/event.cc +++ b/webrtc/system_wrappers/source/event.cc @@ -8,7 +8,7 @@ * be found in the AUTHORS file in the root of the source tree. */ -#include "webrtc/system_wrappers/interface/event_wrapper.h" +#include "webrtc/system_wrappers/include/event_wrapper.h" #if defined(_WIN32) #include <windows.h> diff --git a/webrtc/system_wrappers/source/event_timer_posix.h b/webrtc/system_wrappers/source/event_timer_posix.h index 593e8a4..21c4ac7 100644 --- a/webrtc/system_wrappers/source/event_timer_posix.h +++ b/webrtc/system_wrappers/source/event_timer_posix.h @@ -11,12 +11,12 @@ #ifndef WEBRTC_SYSTEM_WRAPPERS_SOURCE_EVENT_POSIX_H_ #define WEBRTC_SYSTEM_WRAPPERS_SOURCE_EVENT_POSIX_H_ -#include "webrtc/system_wrappers/interface/event_wrapper.h" +#include "webrtc/system_wrappers/include/event_wrapper.h" #include <pthread.h> #include <time.h> -#include "webrtc/system_wrappers/interface/thread_wrapper.h" +#include "webrtc/system_wrappers/include/thread_wrapper.h" namespace webrtc { diff --git a/webrtc/system_wrappers/source/event_timer_win.h b/webrtc/system_wrappers/source/event_timer_win.h index d5bcd2c..163cdde 100644 --- a/webrtc/system_wrappers/source/event_timer_win.h +++ b/webrtc/system_wrappers/source/event_timer_win.h @@ -13,7 +13,7 @@ #include <windows.h> -#include "webrtc/system_wrappers/interface/event_wrapper.h" +#include "webrtc/system_wrappers/include/event_wrapper.h" #include "webrtc/typedefs.h" diff --git a/webrtc/system_wrappers/source/file_impl.cc b/webrtc/system_wrappers/source/file_impl.cc index 89a9185..0ee0dea 100644 --- a/webrtc/system_wrappers/source/file_impl.cc +++ b/webrtc/system_wrappers/source/file_impl.cc @@ -20,7 +20,7 @@ #endif #include "webrtc/base/checks.h" -#include "webrtc/system_wrappers/interface/rw_lock_wrapper.h" +#include "webrtc/system_wrappers/include/rw_lock_wrapper.h" namespace webrtc { diff --git a/webrtc/system_wrappers/source/file_impl.h b/webrtc/system_wrappers/source/file_impl.h index e6679aa..06ba582 100644 --- a/webrtc/system_wrappers/source/file_impl.h +++ b/webrtc/system_wrappers/source/file_impl.h @@ -14,7 +14,7 @@ #include <stdio.h> #include "webrtc/base/scoped_ptr.h" -#include "webrtc/system_wrappers/interface/file_wrapper.h" +#include "webrtc/system_wrappers/include/file_wrapper.h" namespace webrtc { diff --git a/webrtc/system_wrappers/source/logging.cc b/webrtc/system_wrappers/source/logging.cc index 45a0985..6b50d6a 100644 --- a/webrtc/system_wrappers/source/logging.cc +++ b/webrtc/system_wrappers/source/logging.cc @@ -8,14 +8,14 @@ * be found in the AUTHORS file in the root of the source tree. */ -#include "webrtc/system_wrappers/interface/logging.h" +#include "webrtc/system_wrappers/include/logging.h" #include <string.h> #include <sstream> #include "webrtc/common_types.h" -#include "webrtc/system_wrappers/interface/trace.h" +#include "webrtc/system_wrappers/include/trace.h" namespace webrtc { namespace { diff --git a/webrtc/system_wrappers/source/metrics_default.cc b/webrtc/system_wrappers/source/metrics_default.cc index af950b4..48c9111 100644 --- a/webrtc/system_wrappers/source/metrics_default.cc +++ b/webrtc/system_wrappers/source/metrics_default.cc @@ -7,7 +7,7 @@ // be found in the AUTHORS file in the root of the source tree. // -#include "webrtc/system_wrappers/interface/metrics.h" +#include "webrtc/system_wrappers/include/metrics.h" // Default implementation of histogram methods for WebRTC clients that do not // want to provide their own implementation. diff --git a/webrtc/system_wrappers/source/rw_lock.cc b/webrtc/system_wrappers/source/rw_lock.cc index 8b76eb8..ff44896 100644 --- a/webrtc/system_wrappers/source/rw_lock.cc +++ b/webrtc/system_wrappers/source/rw_lock.cc @@ -8,7 +8,7 @@ * be found in the AUTHORS file in the root of the source tree. */ -#include "webrtc/system_wrappers/interface/rw_lock_wrapper.h" +#include "webrtc/system_wrappers/include/rw_lock_wrapper.h" #include <assert.h> diff --git a/webrtc/system_wrappers/source/rw_lock_generic.cc b/webrtc/system_wrappers/source/rw_lock_generic.cc index 0ca9518..9786155 100644 --- a/webrtc/system_wrappers/source/rw_lock_generic.cc +++ b/webrtc/system_wrappers/source/rw_lock_generic.cc @@ -10,8 +10,8 @@ #include "webrtc/system_wrappers/source/rw_lock_generic.h" -#include "webrtc/system_wrappers/interface/condition_variable_wrapper.h" -#include "webrtc/system_wrappers/interface/critical_section_wrapper.h" +#include "webrtc/system_wrappers/include/condition_variable_wrapper.h" +#include "webrtc/system_wrappers/include/critical_section_wrapper.h" namespace webrtc { diff --git a/webrtc/system_wrappers/source/rw_lock_generic.h b/webrtc/system_wrappers/source/rw_lock_generic.h index 653564c..f0d4456 100644 --- a/webrtc/system_wrappers/source/rw_lock_generic.h +++ b/webrtc/system_wrappers/source/rw_lock_generic.h @@ -11,7 +11,7 @@ #ifndef WEBRTC_SYSTEM_WRAPPERS_SOURCE_RW_LOCK_GENERIC_H_ #define WEBRTC_SYSTEM_WRAPPERS_SOURCE_RW_LOCK_GENERIC_H_ -#include "webrtc/system_wrappers/interface/rw_lock_wrapper.h" +#include "webrtc/system_wrappers/include/rw_lock_wrapper.h" #include "webrtc/typedefs.h" namespace webrtc { diff --git a/webrtc/system_wrappers/source/rw_lock_posix.h b/webrtc/system_wrappers/source/rw_lock_posix.h index bec3c2d..0ce7305 100644 --- a/webrtc/system_wrappers/source/rw_lock_posix.h +++ b/webrtc/system_wrappers/source/rw_lock_posix.h @@ -11,7 +11,7 @@ #ifndef WEBRTC_SYSTEM_WRAPPERS_SOURCE_RW_LOCK_POSIX_H_ #define WEBRTC_SYSTEM_WRAPPERS_SOURCE_RW_LOCK_POSIX_H_ -#include "webrtc/system_wrappers/interface/rw_lock_wrapper.h" +#include "webrtc/system_wrappers/include/rw_lock_wrapper.h" #include "webrtc/typedefs.h" #include <pthread.h> diff --git a/webrtc/system_wrappers/source/rw_lock_win.cc b/webrtc/system_wrappers/source/rw_lock_win.cc index aea74fa..2372b9b 100644 --- a/webrtc/system_wrappers/source/rw_lock_win.cc +++ b/webrtc/system_wrappers/source/rw_lock_win.cc @@ -10,7 +10,7 @@ #include "webrtc/system_wrappers/source/rw_lock_win.h" -#include "webrtc/system_wrappers/interface/trace.h" +#include "webrtc/system_wrappers/include/trace.h" namespace webrtc { diff --git a/webrtc/system_wrappers/source/rw_lock_win.h b/webrtc/system_wrappers/source/rw_lock_win.h index 6f7cd33..c279eab 100644 --- a/webrtc/system_wrappers/source/rw_lock_win.h +++ b/webrtc/system_wrappers/source/rw_lock_win.h @@ -11,7 +11,7 @@ #ifndef WEBRTC_SYSTEM_WRAPPERS_SOURCE_RW_LOCK_WIN_H_ #define WEBRTC_SYSTEM_WRAPPERS_SOURCE_RW_LOCK_WIN_H_ -#include "webrtc/system_wrappers/interface/rw_lock_wrapper.h" +#include "webrtc/system_wrappers/include/rw_lock_wrapper.h" #include <Windows.h> diff --git a/webrtc/system_wrappers/source/sleep.cc b/webrtc/system_wrappers/source/sleep.cc index a916477..181381f 100644 --- a/webrtc/system_wrappers/source/sleep.cc +++ b/webrtc/system_wrappers/source/sleep.cc @@ -9,7 +9,7 @@ */ // An OS-independent sleep function. -#include "webrtc/system_wrappers/interface/sleep.h" +#include "webrtc/system_wrappers/include/sleep.h" #ifdef _WIN32 // For Sleep() diff --git a/webrtc/system_wrappers/source/thread.cc b/webrtc/system_wrappers/source/thread.cc index b469344..7da1e3d 100644 --- a/webrtc/system_wrappers/source/thread.cc +++ b/webrtc/system_wrappers/source/thread.cc @@ -8,7 +8,7 @@ * be found in the AUTHORS file in the root of the source tree. */ -#include "webrtc/system_wrappers/interface/thread_wrapper.h" +#include "webrtc/system_wrappers/include/thread_wrapper.h" #if defined(_WIN32) #include "webrtc/system_wrappers/source/thread_win.h" diff --git a/webrtc/system_wrappers/source/thread_posix.cc b/webrtc/system_wrappers/source/thread_posix.cc index fdfbf80..32ab13c 100644 --- a/webrtc/system_wrappers/source/thread_posix.cc +++ b/webrtc/system_wrappers/source/thread_posix.cc @@ -22,10 +22,10 @@ #include "webrtc/base/checks.h" #include "webrtc/base/platform_thread.h" -#include "webrtc/system_wrappers/interface/critical_section_wrapper.h" -#include "webrtc/system_wrappers/interface/event_wrapper.h" -#include "webrtc/system_wrappers/interface/sleep.h" -#include "webrtc/system_wrappers/interface/trace.h" +#include "webrtc/system_wrappers/include/critical_section_wrapper.h" +#include "webrtc/system_wrappers/include/event_wrapper.h" +#include "webrtc/system_wrappers/include/sleep.h" +#include "webrtc/system_wrappers/include/trace.h" namespace webrtc { namespace { diff --git a/webrtc/system_wrappers/source/thread_posix.h b/webrtc/system_wrappers/source/thread_posix.h index c726e48..bcdd732 100644 --- a/webrtc/system_wrappers/source/thread_posix.h +++ b/webrtc/system_wrappers/source/thread_posix.h @@ -14,7 +14,7 @@ #include "webrtc/base/event.h" #include "webrtc/base/scoped_ptr.h" #include "webrtc/base/thread_checker.h" -#include "webrtc/system_wrappers/interface/thread_wrapper.h" +#include "webrtc/system_wrappers/include/thread_wrapper.h" #include <pthread.h> diff --git a/webrtc/system_wrappers/source/thread_win.cc b/webrtc/system_wrappers/source/thread_win.cc index 2773f7e..c421967 100644 --- a/webrtc/system_wrappers/source/thread_win.cc +++ b/webrtc/system_wrappers/source/thread_win.cc @@ -16,7 +16,7 @@ #include "webrtc/base/checks.h" #include "webrtc/base/platform_thread.h" -#include "webrtc/system_wrappers/interface/trace.h" +#include "webrtc/system_wrappers/include/trace.h" namespace webrtc { namespace { diff --git a/webrtc/system_wrappers/source/thread_win.h b/webrtc/system_wrappers/source/thread_win.h index 741ae1e..34edd6d 100644 --- a/webrtc/system_wrappers/source/thread_win.h +++ b/webrtc/system_wrappers/source/thread_win.h @@ -11,7 +11,7 @@ #ifndef WEBRTC_SYSTEM_WRAPPERS_SOURCE_THREAD_WIN_H_ #define WEBRTC_SYSTEM_WRAPPERS_SOURCE_THREAD_WIN_H_ -#include "webrtc/system_wrappers/interface/thread_wrapper.h" +#include "webrtc/system_wrappers/include/thread_wrapper.h" #include <windows.h> diff --git a/webrtc/system_wrappers/source/trace_impl.h b/webrtc/system_wrappers/source/trace_impl.h index da5af72..ed49d9d 100644 --- a/webrtc/system_wrappers/source/trace_impl.h +++ b/webrtc/system_wrappers/source/trace_impl.h @@ -13,11 +13,11 @@ #include "webrtc/base/criticalsection.h" #include "webrtc/base/scoped_ptr.h" -#include "webrtc/system_wrappers/interface/event_wrapper.h" -#include "webrtc/system_wrappers/interface/file_wrapper.h" -#include "webrtc/system_wrappers/interface/static_instance.h" -#include "webrtc/system_wrappers/interface/thread_wrapper.h" -#include "webrtc/system_wrappers/interface/trace.h" +#include "webrtc/system_wrappers/include/event_wrapper.h" +#include "webrtc/system_wrappers/include/file_wrapper.h" +#include "webrtc/system_wrappers/include/static_instance.h" +#include "webrtc/system_wrappers/include/thread_wrapper.h" +#include "webrtc/system_wrappers/include/trace.h" namespace webrtc { diff --git a/webrtc/system_wrappers/source/trace_posix.h b/webrtc/system_wrappers/source/trace_posix.h index 89420c6..25dfeec 100644 --- a/webrtc/system_wrappers/source/trace_posix.h +++ b/webrtc/system_wrappers/source/trace_posix.h @@ -11,7 +11,7 @@ #ifndef WEBRTC_SYSTEM_WRAPPERS_SOURCE_TRACE_POSIX_H_ #define WEBRTC_SYSTEM_WRAPPERS_SOURCE_TRACE_POSIX_H_ -#include "webrtc/system_wrappers/interface/critical_section_wrapper.h" +#include "webrtc/system_wrappers/include/critical_section_wrapper.h" #include "webrtc/system_wrappers/source/trace_impl.h" namespace webrtc { |