Commit 34abadd2 authored by Arun Raghavan's avatar Arun Raghavan
Browse files

Update code to current Chromium master

This corresponds to:

Chromium: 6555f9456074c0c0e5f7713564b978588ac04a5d
webrtc: c8b569e0a7ad0b369e15f0197b3a558699ec8efa
parent 9bc60d3e
......@@ -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 \
......
......@@ -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",
......
......@@ -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))
......
/*
* 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_
......@@ -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;
......
......@@ -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) <
......
......@@ -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;
......
......@@ -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 {
......
......@@ -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 {
......
......@@ -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 {
......
......@@ -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 {
......
......@@ -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 {
......
......@@ -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 {
......
......@@ -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
......
......@@ -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 {
......
......@@ -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
......
......@@ -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
......
......@@ -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
......
......@@ -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;
......
......@@ -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
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment