Move optional.h to webrtc/api/

We use Optional in our public API, so its header should be in
webrtc/api/.

BUG=webrtc:8205

Review-Url: https://codereview.webrtc.org/3011943002
Cr-Commit-Position: refs/heads/master@{#19693}
This commit is contained in:
kwiberg 2017-09-05 08:43:13 -07:00 committed by Commit Bot
parent ad43d4b29e
commit 84f6a3fc6b
174 changed files with 637 additions and 540 deletions

View File

@ -207,6 +207,17 @@ rtc_source_set("array_view") {
] ]
} }
rtc_source_set("optional") {
sources = [
"optional.cc",
"optional.h",
]
deps = [
":array_view",
"../rtc_base:rtc_base_approved",
]
}
rtc_source_set("libjingle_peerconnection_test_api") { rtc_source_set("libjingle_peerconnection_test_api") {
testonly = true testonly = true
sources = [ sources = [
@ -266,6 +277,7 @@ if (rtc_include_tests) {
} }
sources = [ sources = [
"array_view_unittest.cc", "array_view_unittest.cc",
"optional_unittest.cc",
"ortc/mediadescription_unittest.cc", "ortc/mediadescription_unittest.cc",
"ortc/sessiondescription_unittest.cc", "ortc/sessiondescription_unittest.cc",
"rtcerror_unittest.cc", "rtcerror_unittest.cc",
@ -280,6 +292,7 @@ if (rtc_include_tests) {
deps = [ deps = [
":array_view", ":array_view",
":libjingle_peerconnection_api", ":libjingle_peerconnection_api",
":optional",
":ortc_api", ":ortc_api",
"../rtc_base:rtc_base_approved", "../rtc_base:rtc_base_approved",
"../rtc_base:rtc_base_tests_utils", "../rtc_base:rtc_base_tests_utils",

View File

@ -27,6 +27,7 @@ rtc_source_set("audio_codecs_api") {
] ]
deps = [ deps = [
"..:array_view", "..:array_view",
"..:optional",
"../..:webrtc_common", "../..:webrtc_common",
"../../rtc_base:rtc_base_approved", "../../rtc_base:rtc_base_approved",
] ]

View File

@ -19,6 +19,7 @@ rtc_static_library("audio_encoder_L16") {
] ]
deps = [ deps = [
"..:audio_codecs_api", "..:audio_codecs_api",
"../..:optional",
"../../..:webrtc_common", "../../..:webrtc_common",
"../../../modules/audio_coding:pcm16b", "../../../modules/audio_coding:pcm16b",
"../../../rtc_base:rtc_base_approved", "../../../rtc_base:rtc_base_approved",
@ -32,6 +33,7 @@ rtc_static_library("audio_decoder_L16") {
] ]
deps = [ deps = [
"..:audio_codecs_api", "..:audio_codecs_api",
"../..:optional",
"../../..:webrtc_common", "../../..:webrtc_common",
"../../../modules/audio_coding:pcm16b", "../../../modules/audio_coding:pcm16b",
"../../../rtc_base:rtc_base_approved", "../../../rtc_base:rtc_base_approved",

View File

@ -16,7 +16,7 @@
#include "webrtc/api/audio_codecs/audio_decoder.h" #include "webrtc/api/audio_codecs/audio_decoder.h"
#include "webrtc/api/audio_codecs/audio_format.h" #include "webrtc/api/audio_codecs/audio_format.h"
#include "webrtc/rtc_base/optional.h" #include "webrtc/api/optional.h"
namespace webrtc { namespace webrtc {

View File

@ -16,7 +16,7 @@
#include "webrtc/api/audio_codecs/audio_encoder.h" #include "webrtc/api/audio_codecs/audio_encoder.h"
#include "webrtc/api/audio_codecs/audio_format.h" #include "webrtc/api/audio_codecs/audio_format.h"
#include "webrtc/rtc_base/optional.h" #include "webrtc/api/optional.h"
namespace webrtc { namespace webrtc {

View File

@ -15,9 +15,9 @@
#include <vector> #include <vector>
#include "webrtc/api/array_view.h" #include "webrtc/api/array_view.h"
#include "webrtc/api/optional.h"
#include "webrtc/rtc_base/buffer.h" #include "webrtc/rtc_base/buffer.h"
#include "webrtc/rtc_base/constructormagic.h" #include "webrtc/rtc_base/constructormagic.h"
#include "webrtc/rtc_base/optional.h"
#include "webrtc/typedefs.h" #include "webrtc/typedefs.h"
namespace webrtc { namespace webrtc {

View File

@ -17,9 +17,9 @@
#include <vector> #include <vector>
#include "webrtc/api/array_view.h" #include "webrtc/api/array_view.h"
#include "webrtc/api/optional.h"
#include "webrtc/rtc_base/buffer.h" #include "webrtc/rtc_base/buffer.h"
#include "webrtc/rtc_base/deprecation.h" #include "webrtc/rtc_base/deprecation.h"
#include "webrtc/rtc_base/optional.h"
#include "webrtc/typedefs.h" #include "webrtc/typedefs.h"
namespace webrtc { namespace webrtc {

View File

@ -16,7 +16,7 @@
#include <string> #include <string>
#include <utility> #include <utility>
#include "webrtc/rtc_base/optional.h" #include "webrtc/api/optional.h"
namespace webrtc { namespace webrtc {

View File

@ -19,6 +19,7 @@ rtc_static_library("audio_encoder_g711") {
] ]
deps = [ deps = [
"..:audio_codecs_api", "..:audio_codecs_api",
"../..:optional",
"../../..:webrtc_common", "../../..:webrtc_common",
"../../../modules/audio_coding:g711", "../../../modules/audio_coding:g711",
"../../../rtc_base:rtc_base_approved", "../../../rtc_base:rtc_base_approved",
@ -32,6 +33,7 @@ rtc_static_library("audio_decoder_g711") {
] ]
deps = [ deps = [
"..:audio_codecs_api", "..:audio_codecs_api",
"../..:optional",
"../../..:webrtc_common", "../../..:webrtc_common",
"../../../modules/audio_coding:g711", "../../../modules/audio_coding:g711",
"../../../rtc_base:rtc_base_approved", "../../../rtc_base:rtc_base_approved",

View File

@ -16,7 +16,7 @@
#include "webrtc/api/audio_codecs/audio_decoder.h" #include "webrtc/api/audio_codecs/audio_decoder.h"
#include "webrtc/api/audio_codecs/audio_format.h" #include "webrtc/api/audio_codecs/audio_format.h"
#include "webrtc/rtc_base/optional.h" #include "webrtc/api/optional.h"
namespace webrtc { namespace webrtc {

View File

@ -16,7 +16,7 @@
#include "webrtc/api/audio_codecs/audio_encoder.h" #include "webrtc/api/audio_codecs/audio_encoder.h"
#include "webrtc/api/audio_codecs/audio_format.h" #include "webrtc/api/audio_codecs/audio_format.h"
#include "webrtc/rtc_base/optional.h" #include "webrtc/api/optional.h"
namespace webrtc { namespace webrtc {

View File

@ -26,6 +26,7 @@ rtc_static_library("audio_encoder_g722") {
deps = [ deps = [
":audio_encoder_g722_config", ":audio_encoder_g722_config",
"..:audio_codecs_api", "..:audio_codecs_api",
"../..:optional",
"../../..:webrtc_common", "../../..:webrtc_common",
"../../../modules/audio_coding:g722", "../../../modules/audio_coding:g722",
"../../../rtc_base:rtc_base_approved", "../../../rtc_base:rtc_base_approved",
@ -39,6 +40,7 @@ rtc_static_library("audio_decoder_g722") {
] ]
deps = [ deps = [
"..:audio_codecs_api", "..:audio_codecs_api",
"../..:optional",
"../../..:webrtc_common", "../../..:webrtc_common",
"../../../modules/audio_coding:g722", "../../../modules/audio_coding:g722",
"../../../rtc_base:rtc_base_approved", "../../../rtc_base:rtc_base_approved",

View File

@ -16,7 +16,7 @@
#include "webrtc/api/audio_codecs/audio_decoder.h" #include "webrtc/api/audio_codecs/audio_decoder.h"
#include "webrtc/api/audio_codecs/audio_format.h" #include "webrtc/api/audio_codecs/audio_format.h"
#include "webrtc/rtc_base/optional.h" #include "webrtc/api/optional.h"
namespace webrtc { namespace webrtc {

View File

@ -17,7 +17,7 @@
#include "webrtc/api/audio_codecs/audio_encoder.h" #include "webrtc/api/audio_codecs/audio_encoder.h"
#include "webrtc/api/audio_codecs/audio_format.h" #include "webrtc/api/audio_codecs/audio_format.h"
#include "webrtc/api/audio_codecs/g722/audio_encoder_g722_config.h" #include "webrtc/api/audio_codecs/g722/audio_encoder_g722_config.h"
#include "webrtc/rtc_base/optional.h" #include "webrtc/api/optional.h"
namespace webrtc { namespace webrtc {

View File

@ -26,6 +26,7 @@ rtc_static_library("audio_encoder_ilbc") {
deps = [ deps = [
":audio_encoder_ilbc_config", ":audio_encoder_ilbc_config",
"..:audio_codecs_api", "..:audio_codecs_api",
"../..:optional",
"../../..:webrtc_common", "../../..:webrtc_common",
"../../../modules/audio_coding:ilbc", "../../../modules/audio_coding:ilbc",
"../../../rtc_base:rtc_base_approved", "../../../rtc_base:rtc_base_approved",
@ -39,6 +40,7 @@ rtc_static_library("audio_decoder_ilbc") {
] ]
deps = [ deps = [
"..:audio_codecs_api", "..:audio_codecs_api",
"../..:optional",
"../../..:webrtc_common", "../../..:webrtc_common",
"../../../modules/audio_coding:ilbc", "../../../modules/audio_coding:ilbc",
"../../../rtc_base:rtc_base_approved", "../../../rtc_base:rtc_base_approved",

View File

@ -16,7 +16,7 @@
#include "webrtc/api/audio_codecs/audio_decoder.h" #include "webrtc/api/audio_codecs/audio_decoder.h"
#include "webrtc/api/audio_codecs/audio_format.h" #include "webrtc/api/audio_codecs/audio_format.h"
#include "webrtc/rtc_base/optional.h" #include "webrtc/api/optional.h"
namespace webrtc { namespace webrtc {

View File

@ -17,7 +17,7 @@
#include "webrtc/api/audio_codecs/audio_encoder.h" #include "webrtc/api/audio_codecs/audio_encoder.h"
#include "webrtc/api/audio_codecs/audio_format.h" #include "webrtc/api/audio_codecs/audio_format.h"
#include "webrtc/api/audio_codecs/ilbc/audio_encoder_ilbc_config.h" #include "webrtc/api/audio_codecs/ilbc/audio_encoder_ilbc_config.h"
#include "webrtc/rtc_base/optional.h" #include "webrtc/api/optional.h"
namespace webrtc { namespace webrtc {

View File

@ -19,6 +19,7 @@ rtc_static_library("audio_encoder_isac_fix") {
] ]
deps = [ deps = [
"..:audio_codecs_api", "..:audio_codecs_api",
"../..:optional",
"../../..:webrtc_common", "../../..:webrtc_common",
"../../../modules/audio_coding:isac_fix", "../../../modules/audio_coding:isac_fix",
"../../../rtc_base:rtc_base_approved", "../../../rtc_base:rtc_base_approved",
@ -32,6 +33,7 @@ rtc_static_library("audio_decoder_isac_fix") {
] ]
deps = [ deps = [
"..:audio_codecs_api", "..:audio_codecs_api",
"../..:optional",
"../../..:webrtc_common", "../../..:webrtc_common",
"../../../modules/audio_coding:isac_fix", "../../../modules/audio_coding:isac_fix",
"../../../rtc_base:rtc_base_approved", "../../../rtc_base:rtc_base_approved",
@ -45,6 +47,7 @@ rtc_static_library("audio_encoder_isac_float") {
] ]
deps = [ deps = [
"..:audio_codecs_api", "..:audio_codecs_api",
"../..:optional",
"../../..:webrtc_common", "../../..:webrtc_common",
"../../../modules/audio_coding:isac", "../../../modules/audio_coding:isac",
"../../../rtc_base:rtc_base_approved", "../../../rtc_base:rtc_base_approved",
@ -58,6 +61,7 @@ rtc_static_library("audio_decoder_isac_float") {
] ]
deps = [ deps = [
"..:audio_codecs_api", "..:audio_codecs_api",
"../..:optional",
"../../..:webrtc_common", "../../..:webrtc_common",
"../../../modules/audio_coding:isac", "../../../modules/audio_coding:isac",
"../../../rtc_base:rtc_base_approved", "../../../rtc_base:rtc_base_approved",

View File

@ -16,7 +16,7 @@
#include "webrtc/api/audio_codecs/audio_decoder.h" #include "webrtc/api/audio_codecs/audio_decoder.h"
#include "webrtc/api/audio_codecs/audio_format.h" #include "webrtc/api/audio_codecs/audio_format.h"
#include "webrtc/rtc_base/optional.h" #include "webrtc/api/optional.h"
namespace webrtc { namespace webrtc {

View File

@ -16,7 +16,7 @@
#include "webrtc/api/audio_codecs/audio_decoder.h" #include "webrtc/api/audio_codecs/audio_decoder.h"
#include "webrtc/api/audio_codecs/audio_format.h" #include "webrtc/api/audio_codecs/audio_format.h"
#include "webrtc/rtc_base/optional.h" #include "webrtc/api/optional.h"
namespace webrtc { namespace webrtc {

View File

@ -16,7 +16,7 @@
#include "webrtc/api/audio_codecs/audio_encoder.h" #include "webrtc/api/audio_codecs/audio_encoder.h"
#include "webrtc/api/audio_codecs/audio_format.h" #include "webrtc/api/audio_codecs/audio_format.h"
#include "webrtc/rtc_base/optional.h" #include "webrtc/api/optional.h"
namespace webrtc { namespace webrtc {

View File

@ -16,7 +16,7 @@
#include "webrtc/api/audio_codecs/audio_encoder.h" #include "webrtc/api/audio_codecs/audio_encoder.h"
#include "webrtc/api/audio_codecs/audio_format.h" #include "webrtc/api/audio_codecs/audio_format.h"
#include "webrtc/rtc_base/optional.h" #include "webrtc/api/optional.h"
namespace webrtc { namespace webrtc {

View File

@ -18,6 +18,7 @@ rtc_static_library("audio_encoder_opus_config") {
"audio_encoder_opus_config.h", "audio_encoder_opus_config.h",
] ]
deps = [ deps = [
"../..:optional",
"../../../rtc_base:rtc_base_approved", "../../../rtc_base:rtc_base_approved",
] ]
defines = [] defines = []
@ -51,6 +52,7 @@ rtc_static_library("audio_decoder_opus") {
] ]
deps = [ deps = [
"..:audio_codecs_api", "..:audio_codecs_api",
"../..:optional",
"../../..:webrtc_common", "../../..:webrtc_common",
"../../../modules/audio_coding:webrtc_opus", "../../../modules/audio_coding:webrtc_opus",
"../../../rtc_base:rtc_base_approved", "../../../rtc_base:rtc_base_approved",

View File

@ -16,7 +16,7 @@
#include "webrtc/api/audio_codecs/audio_decoder.h" #include "webrtc/api/audio_codecs/audio_decoder.h"
#include "webrtc/api/audio_codecs/audio_format.h" #include "webrtc/api/audio_codecs/audio_format.h"
#include "webrtc/rtc_base/optional.h" #include "webrtc/api/optional.h"
namespace webrtc { namespace webrtc {

View File

@ -15,7 +15,7 @@
#include <vector> #include <vector>
#include "webrtc/rtc_base/optional.h" #include "webrtc/api/optional.h"
namespace webrtc { namespace webrtc {

View File

@ -23,8 +23,8 @@
#include <string> #include <string>
#include <vector> #include <vector>
#include "webrtc/api/optional.h"
#include "webrtc/api/peerconnectioninterface.h" #include "webrtc/api/peerconnectioninterface.h"
#include "webrtc/rtc_base/optional.h"
namespace webrtc { namespace webrtc {

View File

@ -22,8 +22,8 @@
#include <string> #include <string>
#include <vector> #include <vector>
#include "webrtc/api/optional.h"
#include "webrtc/api/video/video_frame.h" #include "webrtc/api/video/video_frame.h"
#include "webrtc/rtc_base/optional.h"
// TODO(zhihuang): Remove unrelated headers once downstream applications stop // TODO(zhihuang): Remove unrelated headers once downstream applications stop
// relying on them; they were previously transitively included by // relying on them; they were previously transitively included by
// mediachannel.h, which is no longer a dependency of this file. // mediachannel.h, which is no longer a dependency of this file.

View File

@ -8,14 +8,16 @@
* be found in the AUTHORS file in the root of the source tree. * be found in the AUTHORS file in the root of the source tree.
*/ */
#include "webrtc/rtc_base/optional.h" #include "webrtc/api/optional.h"
namespace rtc { namespace rtc {
namespace optional_internal { namespace optional_internal {
#if RTC_HAS_ASAN #if RTC_HAS_ASAN
void* FunctionThatDoesNothingImpl(void* x) { return x; } void* FunctionThatDoesNothingImpl(void* x) {
return x;
}
#endif #endif

407
webrtc/api/optional.h Normal file
View File

@ -0,0 +1,407 @@
/*
* 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_API_OPTIONAL_H_
#define WEBRTC_API_OPTIONAL_H_
#include <algorithm>
#include <memory>
#include <utility>
#ifdef UNIT_TEST
#include <iomanip>
#include <ostream>
#endif // UNIT_TEST
#include "webrtc/api/array_view.h"
#include "webrtc/rtc_base/checks.h"
#include "webrtc/rtc_base/sanitizer.h"
namespace rtc {
namespace optional_internal {
#if RTC_HAS_ASAN
// This is a non-inlined function. The optimizer can't see inside it. It
// prevents the compiler from generating optimized code that reads value_ even
// if it is unset. Although safe, this causes memory sanitizers to complain.
void* FunctionThatDoesNothingImpl(void*);
template <typename T>
inline T* FunctionThatDoesNothing(T* x) {
return reinterpret_cast<T*>(
FunctionThatDoesNothingImpl(reinterpret_cast<void*>(x)));
}
#else
template <typename T>
inline T* FunctionThatDoesNothing(T* x) {
return x;
}
#endif
} // namespace optional_internal
// Simple std::optional-wannabe. It either contains a T or not.
//
// A moved-from Optional<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.
//
// Examples of good places to use Optional:
//
// - As a class or struct member, when the member doesn't always have a value:
// struct Prisoner {
// std::string name;
// Optional<int> cell_number; // Empty if not currently incarcerated.
// };
//
// - As a return value for functions that may fail to return a value on all
// allowed inputs. For example, a function that searches an array might
// return an Optional<size_t> (the index where it found the element, or
// nothing if it didn't find it); and a function that parses numbers might
// return Optional<double> (the parsed number, or nothing if parsing failed).
//
// Examples of bad places to use Optional:
//
// - As a return value for functions that may fail because of disallowed
// inputs. For example, a string length function should not return
// Optional<size_t> so that it can return nothing in case the caller passed
// it a null pointer; the function should probably use RTC_[D]CHECK instead,
// and return plain size_t.
//
// - As a return value for functions that may fail to return a value on all
// allowed inputs, but need to tell the caller what went wrong. Returning
// Optional<double> when parsing a single number as in the example above
// might make sense, but any larger parse job is probably going to need to
// tell the caller what the problem was, not just that there was one.
//
// - As a non-mutable function argument. When you want to pass a value of a
// type T that can fail to be there, const T* is almost always both fastest
// and cleanest. (If you're *sure* that the the caller will always already
// have an Optional<T>, const Optional<T>& is slightly faster than const T*,
// but this is a micro-optimization. In general, stick to const T*.)
//
// 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 Optional final {
public:
// Construct an empty Optional.
Optional() : has_value_(false), empty_('\0') { PoisonValue(); }
// Construct an Optional that contains a value.
explicit Optional(const T& value) : has_value_(true) {
new (&value_) T(value);
}
explicit Optional(T&& value) : has_value_(true) {
new (&value_) T(std::move(value));
}
// Copy constructor: copies the value from m if it has one.
Optional(const Optional& m) : has_value_(m.has_value_) {
if (has_value_)
new (&value_) T(m.value_);
else
PoisonValue();
}
// Move constructor: if m has a value, moves the value from m, leaving m
// still in a state where it has a value, but a moved-from one (the
// properties of which depends on T; the only general guarantee is that we
// can destroy m).
Optional(Optional&& m) : has_value_(m.has_value_) {
if (has_value_)
new (&value_) T(std::move(m.value_));
else
PoisonValue();
}
~Optional() {
if (has_value_)
value_.~T();
else
UnpoisonValue();
}
// Copy assignment. Uses T's copy assignment if both sides have a value, T's
// copy constructor if only the right-hand side has a value.
Optional& operator=(const Optional& m) {
if (m.has_value_) {
if (has_value_) {
value_ = m.value_; // T's copy assignment.
} else {
UnpoisonValue();
new (&value_) T(m.value_); // T's copy constructor.
has_value_ = true;
}
} else {
reset();
}
return *this;
}
// Move assignment. Uses T's move assignment if both sides have a value, T's
// move constructor if only the right-hand side has a value. The state of m
// after it's been moved from is as for the move constructor.
Optional& operator=(Optional&& m) {
if (m.has_value_) {
if (has_value_) {
value_ = std::move(m.value_); // T's move assignment.
} else {
UnpoisonValue();
new (&value_) T(std::move(m.value_)); // T's move constructor.
has_value_ = true;
}
} else {
reset();
}
return *this;
}
// Swap the values if both m1 and m2 have values; move the value if only one
// of them has one.
friend void swap(Optional& m1, Optional& m2) {
if (m1.has_value_) {
if (m2.has_value_) {
// Both have values: swap.
using std::swap;
swap(m1.value_, m2.value_);
} else {
// Only m1 has a value: move it to m2.
m2.UnpoisonValue();
new (&m2.value_) T(std::move(m1.value_));
m1.value_.~T(); // Destroy the moved-from value.
m1.has_value_ = false;
m2.has_value_ = true;
m1.PoisonValue();
}
} else if (m2.has_value_) {
// Only m2 has a value: move it to m1.
m1.UnpoisonValue();
new (&m1.value_) T(std::move(m2.value_));
m2.value_.~T(); // Destroy the moved-from value.
m1.has_value_ = true;
m2.has_value_ = false;
m2.PoisonValue();
}
}
// Destroy any contained value. Has no effect if we have no value.
void reset() {
if (!has_value_)
return;
value_.~T();
has_value_ = false;
PoisonValue();
}
template <class... Args>
void emplace(Args&&... args) {
if (has_value_)
value_.~T();
else
UnpoisonValue();
new (&value_) T(std::forward<Args>(args)...);
has_value_ = true;
}
// Conversion to bool to test if we have a value.
explicit operator bool() const { return has_value_; }
bool has_value() 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_;
}
const T& value() const {
RTC_DCHECK(has_value_);
return value_;
}
T& value() {
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 {
// The no-op call prevents the compiler from generating optimized code that
// reads value_ even if !has_value_, but only if FunctionThatDoesNothing is
// not completely inlined; see its declaration.).
return has_value_ ? *optional_internal::FunctionThatDoesNothing(&value_)
: default_val;
}
// Dereference and move value.
T MoveValue() {
RTC_DCHECK(has_value_);
return std::move(value_);
}
// Equality tests. Two Optionals are equal if they contain equivalent values,
// or if they're both empty.
friend bool operator==(const Optional& m1, const Optional& m2) {
return m1.has_value_ && m2.has_value_ ? m1.value_ == m2.value_
: m1.has_value_ == m2.has_value_;
}
friend bool operator==(const Optional& opt, const T& value) {
return opt.has_value_ && opt.value_ == value;
}
friend bool operator==(const T& value, const Optional& opt) {
return opt.has_value_ && value == opt.value_;
}
friend bool operator!=(const Optional& m1, const Optional& m2) {
return m1.has_value_ && m2.has_value_ ? m1.value_ != m2.value_
: m1.has_value_ != m2.has_value_;
}
friend bool operator!=(const Optional& opt, const T& value) {
return !opt.has_value_ || opt.value_ != value;
}
friend bool operator!=(const T& value, const Optional& opt) {
return !opt.has_value_ || value != opt.value_;
}
private:
// Tell sanitizers that value_ shouldn't be touched.
void PoisonValue() {
rtc::AsanPoison(rtc::MakeArrayView(&value_, 1));
rtc::MsanMarkUninitialized(rtc::MakeArrayView(&value_, 1));
}
// Tell sanitizers that value_ is OK to touch again.
void UnpoisonValue() { rtc::AsanUnpoison(rtc::MakeArrayView(&value_, 1)); }
bool has_value_; // True iff value_ contains a live value.
union {
// empty_ exists only to make it possible to initialize the union, even when
// it doesn't contain any data. If the union goes uninitialized, it may
// trigger compiler warnings.
char empty_;
// By placing value_ in a union, we get to manage its construction and
// destruction manually: the Optional constructors won't automatically
// construct it, and the Optional destructor won't automatically destroy
// it. Basically, this just allocates a properly sized and aligned block of
// memory in which we can manually put a T with placement new.
T value_;
};
};
#ifdef UNIT_TEST
namespace optional_internal {
// Checks if there's a valid PrintTo(const T&, std::ostream*) call for T.
template <typename T>
struct HasPrintTo {
private:
struct No {};
template <typename T2>
static auto Test(const T2& obj)
-> decltype(PrintTo(obj, std::declval<std::ostream*>()));
template <typename>
static No Test(...);
public:
static constexpr bool value =
!std::is_same<decltype(Test<T>(std::declval<const T&>())), No>::value;
};
// Checks if there's a valid operator<<(std::ostream&, const T&) call for T.
template <typename T>
struct HasOstreamOperator {
private:
struct No {};
template <typename T2>
static auto Test(const T2& obj)
-> decltype(std::declval<std::ostream&>() << obj);
template <typename>
static No Test(...);
public:
static constexpr bool value =
!std::is_same<decltype(Test<T>(std::declval<const T&>())), No>::value;
};
// Prefer using PrintTo to print the object.
template <typename T>
typename std::enable_if<HasPrintTo<T>::value, void>::type OptionalPrintToHelper(
const T& value,
std::ostream* os) {
PrintTo(value, os);
}
// Fall back to operator<<(std::ostream&, ...) if it exists.
template <typename T>
typename std::enable_if<HasOstreamOperator<T>::value && !HasPrintTo<T>::value,
void>::type
OptionalPrintToHelper(const T& value, std::ostream* os) {
*os << value;
}
inline void OptionalPrintObjectBytes(const unsigned char* bytes,
size_t size,
std::ostream* os) {
*os << "<optional with " << size << "-byte object [";
for (size_t i = 0; i != size; ++i) {
*os << (i == 0 ? "" : ((i & 1) ? "-" : " "));
*os << std::hex << std::setw(2) << std::setfill('0')
<< static_cast<int>(bytes[i]);
}
*os << "]>";
}
// As a final back-up, just print the contents of the objcets byte-wise.
template <typename T>
typename std::enable_if<!HasOstreamOperator<T>::value && !HasPrintTo<T>::value,
void>::type
OptionalPrintToHelper(const T& value, std::ostream* os) {
OptionalPrintObjectBytes(reinterpret_cast<const unsigned char*>(&value),
sizeof(value), os);
}
} // namespace optional_internal
// PrintTo is used by gtest to print out the results of tests. We want to ensure
// the object contained in an Optional can be printed out if it's set, while
// avoiding touching the object's storage if it is undefined.
template <typename T>
void PrintTo(const rtc::Optional<T>& opt, std::ostream* os) {
if (opt) {
optional_internal::OptionalPrintToHelper(*opt, os);
} else {
*os << "<empty optional>";
}
}
#endif // UNIT_TEST
} // namespace rtc
#endif // WEBRTC_API_OPTIONAL_H_

View File

@ -14,8 +14,8 @@
#include <utility> #include <utility>
#include <vector> #include <vector>
#include "webrtc/api/optional.h"
#include "webrtc/rtc_base/gunit.h" #include "webrtc/rtc_base/gunit.h"
#include "webrtc/rtc_base/optional.h"
namespace rtc { namespace rtc {
@ -37,14 +37,12 @@ void PrintTo(const MyPrintableType& mpt, std::ostream* os) {
*os << "The value is " << mpt.value; *os << "The value is " << mpt.value;
} }
std::ostream& operator<<(std::ostream& os, std::ostream& operator<<(std::ostream& os, const MyPrintableType& mpt) {
const MyPrintableType& mpt) {
os << mpt.value; os << mpt.value;
return os; return os;
} }
std::ostream& operator<<(std::ostream& os, std::ostream& operator<<(std::ostream& os, const MyOstreamPrintableType& mpt) {
const MyOstreamPrintableType& mpt) {
os << mpt.value; os << mpt.value;
return os; return os;
} }

View File

@ -15,8 +15,8 @@
#include <utility> #include <utility>
#include <vector> #include <vector>
#include "webrtc/api/optional.h"
#include "webrtc/media/base/cryptoparams.h" #include "webrtc/media/base/cryptoparams.h"
#include "webrtc/rtc_base/optional.h"
namespace webrtc { namespace webrtc {

View File

@ -13,10 +13,10 @@
#include <string> #include <string>
#include "webrtc/api/optional.h"
#include "webrtc/api/ortc/packettransportinterface.h" #include "webrtc/api/ortc/packettransportinterface.h"
#include "webrtc/api/rtcerror.h" #include "webrtc/api/rtcerror.h"
#include "webrtc/common_types.h" #include "webrtc/common_types.h"
#include "webrtc/rtc_base/optional.h"
namespace webrtc { namespace webrtc {

View File

@ -16,7 +16,7 @@
#include <vector> #include <vector>
#include "webrtc/api/mediatypes.h" #include "webrtc/api/mediatypes.h"
#include "webrtc/rtc_base/optional.h" #include "webrtc/api/optional.h"
namespace webrtc { namespace webrtc {

View File

@ -20,6 +20,7 @@ rtc_source_set("video_codecs_api") {
] ]
deps = [ deps = [
"..:optional",
"..:video_frame_api", "..:video_frame_api",
"../..:webrtc_common", "../..:webrtc_common",
"../../common_video", "../../common_video",

View File

@ -15,11 +15,11 @@
#include <string> #include <string>
#include <vector> #include <vector>
#include "webrtc/api/optional.h"
#include "webrtc/api/video/video_frame.h" #include "webrtc/api/video/video_frame.h"
#include "webrtc/common_types.h" #include "webrtc/common_types.h"
#include "webrtc/common_video/include/video_frame.h" #include "webrtc/common_video/include/video_frame.h"
#include "webrtc/rtc_base/checks.h" #include "webrtc/rtc_base/checks.h"
#include "webrtc/rtc_base/optional.h"
#include "webrtc/typedefs.h" #include "webrtc/typedefs.h"
namespace webrtc { namespace webrtc {

View File

@ -37,6 +37,7 @@ rtc_static_library("audio") {
"..:webrtc_common", "..:webrtc_common",
"../api:audio_mixer_api", "../api:audio_mixer_api",
"../api:call_api", "../api:call_api",
"../api:optional",
"../api/audio_codecs:audio_codecs_api", "../api/audio_codecs:audio_codecs_api",
"../api/audio_codecs:builtin_audio_encoder_factory", "../api/audio_codecs:builtin_audio_encoder_factory",
"../call:call_interfaces", "../call:call_interfaces",

View File

@ -13,7 +13,7 @@
#include <stdint.h> #include <stdint.h>
#include "webrtc/rtc_base/optional.h" #include "webrtc/api/optional.h"
namespace webrtc { namespace webrtc {

View File

@ -26,6 +26,7 @@ rtc_source_set("call_interfaces") {
"..:webrtc_common", "..:webrtc_common",
"../api:audio_mixer_api", "../api:audio_mixer_api",
"../api:libjingle_peerconnection_api", "../api:libjingle_peerconnection_api",
"../api:optional",
"../api:transport_api", "../api:transport_api",
"../api/audio_codecs:audio_codecs_api", "../api/audio_codecs:audio_codecs_api",
"../rtc_base:rtc_base", "../rtc_base:rtc_base",
@ -68,6 +69,7 @@ rtc_source_set("rtp_receiver") {
":rtp_interfaces", ":rtp_interfaces",
"..:webrtc_common", "..:webrtc_common",
"../api:array_view", "../api:array_view",
"../api:optional",
"../modules/rtp_rtcp", "../modules/rtp_rtcp",
"../rtc_base:rtc_base_approved", "../rtc_base:rtc_base_approved",
] ]
@ -114,6 +116,7 @@ rtc_static_library("call") {
":rtp_sender", ":rtp_sender",
":video_stream_api", ":video_stream_api",
"..:webrtc_common", "..:webrtc_common",
"../api:optional",
"../api:transport_api", "../api:transport_api",
"../audio", "../audio",
"../logging:rtc_event_log_api", "../logging:rtc_event_log_api",
@ -144,6 +147,7 @@ rtc_source_set("video_stream_api") {
":rtp_interfaces", ":rtp_interfaces",
"../:webrtc_common", "../:webrtc_common",
"../api:libjingle_peerconnection_api", "../api:libjingle_peerconnection_api",
"../api:optional",
"../api:transport_api", "../api:transport_api",
"../common_video:common_video", "../common_video:common_video",
"../rtc_base:rtc_base_approved", "../rtc_base:rtc_base_approved",

View File

@ -18,11 +18,11 @@
#include "webrtc/api/audio_codecs/audio_decoder_factory.h" #include "webrtc/api/audio_codecs/audio_decoder_factory.h"
#include "webrtc/api/call/transport.h" #include "webrtc/api/call/transport.h"
#include "webrtc/api/optional.h"
#include "webrtc/api/rtpparameters.h" #include "webrtc/api/rtpparameters.h"
#include "webrtc/api/rtpreceiverinterface.h" #include "webrtc/api/rtpreceiverinterface.h"
#include "webrtc/call/rtp_config.h" #include "webrtc/call/rtp_config.h"
#include "webrtc/common_types.h" #include "webrtc/common_types.h"
#include "webrtc/rtc_base/optional.h"
#include "webrtc/rtc_base/scoped_ref_ptr.h" #include "webrtc/rtc_base/scoped_ref_ptr.h"
#include "webrtc/typedefs.h" #include "webrtc/typedefs.h"

View File

@ -18,9 +18,9 @@
#include "webrtc/api/audio_codecs/audio_encoder_factory.h" #include "webrtc/api/audio_codecs/audio_encoder_factory.h"
#include "webrtc/api/audio_codecs/audio_format.h" #include "webrtc/api/audio_codecs/audio_format.h"
#include "webrtc/api/call/transport.h" #include "webrtc/api/call/transport.h"
#include "webrtc/api/optional.h"
#include "webrtc/api/rtpparameters.h" #include "webrtc/api/rtpparameters.h"
#include "webrtc/call/rtp_config.h" #include "webrtc/call/rtp_config.h"
#include "webrtc/rtc_base/optional.h"
#include "webrtc/rtc_base/scoped_ref_ptr.h" #include "webrtc/rtc_base/scoped_ref_ptr.h"
#include "webrtc/typedefs.h" #include "webrtc/typedefs.h"

View File

@ -16,6 +16,7 @@
#include <utility> #include <utility>
#include <vector> #include <vector>
#include "webrtc/api/optional.h"
#include "webrtc/audio/audio_receive_stream.h" #include "webrtc/audio/audio_receive_stream.h"
#include "webrtc/audio/audio_send_stream.h" #include "webrtc/audio/audio_send_stream.h"
#include "webrtc/audio/audio_state.h" #include "webrtc/audio/audio_state.h"
@ -40,7 +41,6 @@
#include "webrtc/rtc_base/constructormagic.h" #include "webrtc/rtc_base/constructormagic.h"
#include "webrtc/rtc_base/location.h" #include "webrtc/rtc_base/location.h"
#include "webrtc/rtc_base/logging.h" #include "webrtc/rtc_base/logging.h"
#include "webrtc/rtc_base/optional.h"
#include "webrtc/rtc_base/ptr_util.h" #include "webrtc/rtc_base/ptr_util.h"
#include "webrtc/rtc_base/sequenced_task_checker.h" #include "webrtc/rtc_base/sequenced_task_checker.h"
#include "webrtc/rtc_base/task_queue.h" #include "webrtc/rtc_base/task_queue.h"

View File

@ -16,8 +16,8 @@
#include <utility> #include <utility>
#include "webrtc/api/array_view.h" #include "webrtc/api/array_view.h"
#include "webrtc/api/optional.h"
#include "webrtc/rtc_base/basictypes.h" #include "webrtc/rtc_base/basictypes.h"
#include "webrtc/rtc_base/optional.h"
namespace webrtc { namespace webrtc {

View File

@ -16,7 +16,7 @@
#include <stdint.h> #include <stdint.h>
#include "webrtc/rtc_base/optional.h" #include "webrtc/api/optional.h"
namespace webrtc { namespace webrtc {

View File

@ -14,9 +14,9 @@
#include <string> #include <string>
#include <vector> #include <vector>
#include "webrtc/api/optional.h"
#include "webrtc/common_types.h" #include "webrtc/common_types.h"
#include "webrtc/rtc_base/basictypes.h" #include "webrtc/rtc_base/basictypes.h"
#include "webrtc/rtc_base/optional.h"
#include "webrtc/rtc_base/refcount.h" #include "webrtc/rtc_base/refcount.h"
#include "webrtc/rtc_base/scoped_ref_ptr.h" #include "webrtc/rtc_base/scoped_ref_ptr.h"
#include "webrtc/typedefs.h" #include "webrtc/typedefs.h"

View File

@ -63,6 +63,7 @@ rtc_static_library("common_audio") {
deps = [ deps = [
":sinc_resampler", ":sinc_resampler",
"..:webrtc_common", "..:webrtc_common",
"../api:optional",
"../rtc_base:gtest_prod", "../rtc_base:gtest_prod",
"../rtc_base:rtc_base_approved", "../rtc_base:rtc_base_approved",
"../system_wrappers", "../system_wrappers",

View File

@ -11,8 +11,8 @@
#ifndef WEBRTC_COMMON_AUDIO_SMOOTHING_FILTER_H_ #ifndef WEBRTC_COMMON_AUDIO_SMOOTHING_FILTER_H_
#define WEBRTC_COMMON_AUDIO_SMOOTHING_FILTER_H_ #define WEBRTC_COMMON_AUDIO_SMOOTHING_FILTER_H_
#include "webrtc/api/optional.h"
#include "webrtc/rtc_base/constructormagic.h" #include "webrtc/rtc_base/constructormagic.h"
#include "webrtc/rtc_base/optional.h"
#include "webrtc/system_wrappers/include/clock.h" #include "webrtc/system_wrappers/include/clock.h"
namespace webrtc { namespace webrtc {

View File

@ -18,12 +18,12 @@
#include <vector> #include <vector>
#include "webrtc/api/array_view.h" #include "webrtc/api/array_view.h"
#include "webrtc/api/optional.h"
#include "webrtc/api/video/video_content_type.h" #include "webrtc/api/video/video_content_type.h"
#include "webrtc/api/video/video_rotation.h" #include "webrtc/api/video/video_rotation.h"
#include "webrtc/api/video/video_timing.h" #include "webrtc/api/video/video_timing.h"
#include "webrtc/rtc_base/checks.h" #include "webrtc/rtc_base/checks.h"
#include "webrtc/rtc_base/deprecation.h" #include "webrtc/rtc_base/deprecation.h"
#include "webrtc/rtc_base/optional.h"
#include "webrtc/typedefs.h" #include "webrtc/typedefs.h"
#if defined(_MSC_VER) #if defined(_MSC_VER)

View File

@ -57,6 +57,7 @@ rtc_static_library("common_video") {
deps = [ deps = [
"..:webrtc_common", "..:webrtc_common",
"../api:optional",
"../media:rtc_h264_profile_id", "../media:rtc_h264_profile_id",
"../modules:module_api", "../modules:module_api",
"../rtc_base:rtc_base", "../rtc_base:rtc_base",

View File

@ -13,9 +13,9 @@
#include <stddef.h> #include <stddef.h>
#include <stdint.h> #include <stdint.h>
#include "webrtc/api/optional.h"
#include "webrtc/common_video/h264/pps_parser.h" #include "webrtc/common_video/h264/pps_parser.h"
#include "webrtc/common_video/h264/sps_parser.h" #include "webrtc/common_video/h264/sps_parser.h"
#include "webrtc/rtc_base/optional.h"
namespace rtc { namespace rtc {
class BitBufferWriter; class BitBufferWriter;

View File

@ -11,7 +11,7 @@
#ifndef WEBRTC_COMMON_VIDEO_H264_PPS_PARSER_H_ #ifndef WEBRTC_COMMON_VIDEO_H264_PPS_PARSER_H_
#define WEBRTC_COMMON_VIDEO_H264_PPS_PARSER_H_ #define WEBRTC_COMMON_VIDEO_H264_PPS_PARSER_H_
#include "webrtc/rtc_base/optional.h" #include "webrtc/api/optional.h"
namespace rtc { namespace rtc {
class BitBuffer; class BitBuffer;

View File

@ -11,7 +11,7 @@
#ifndef WEBRTC_COMMON_VIDEO_H264_SPS_PARSER_H_ #ifndef WEBRTC_COMMON_VIDEO_H264_SPS_PARSER_H_
#define WEBRTC_COMMON_VIDEO_H264_SPS_PARSER_H_ #define WEBRTC_COMMON_VIDEO_H264_SPS_PARSER_H_
#include "webrtc/rtc_base/optional.h" #include "webrtc/api/optional.h"
namespace rtc { namespace rtc {
class BitBuffer; class BitBuffer;

View File

@ -12,9 +12,9 @@
#ifndef WEBRTC_COMMON_VIDEO_H264_SPS_VUI_REWRITER_H_ #ifndef WEBRTC_COMMON_VIDEO_H264_SPS_VUI_REWRITER_H_
#define WEBRTC_COMMON_VIDEO_H264_SPS_VUI_REWRITER_H_ #define WEBRTC_COMMON_VIDEO_H264_SPS_VUI_REWRITER_H_
#include "webrtc/api/optional.h"
#include "webrtc/common_video/h264/sps_parser.h" #include "webrtc/common_video/h264/sps_parser.h"
#include "webrtc/rtc_base/buffer.h" #include "webrtc/rtc_base/buffer.h"
#include "webrtc/rtc_base/optional.h"
namespace rtc { namespace rtc {
class BitBuffer; class BitBuffer;

View File

@ -15,8 +15,8 @@
#include <list> #include <list>
#include "webrtc/api/optional.h"
#include "webrtc/api/video/video_frame.h" #include "webrtc/api/video/video_frame.h"
#include "webrtc/rtc_base/optional.h"
namespace webrtc { namespace webrtc {

View File

@ -45,6 +45,7 @@ rtc_source_set("rtc_h264_profile_id") {
deps = [ deps = [
"..:webrtc_common", "..:webrtc_common",
"../api:optional",
"../rtc_base:rtc_base", "../rtc_base:rtc_base",
"../rtc_base:rtc_base_approved", "../rtc_base:rtc_base_approved",
] ]
@ -227,6 +228,7 @@ rtc_static_library("rtc_audio_video") {
"..:webrtc_common", "..:webrtc_common",
"../api:call_api", "../api:call_api",
"../api:libjingle_peerconnection_api", "../api:libjingle_peerconnection_api",
"../api:optional",
"../api:transport_api", "../api:transport_api",
"../api:video_frame_api", "../api:video_frame_api",
"../api/audio_codecs:audio_codecs_api", "../api/audio_codecs:audio_codecs_api",

View File

@ -14,8 +14,8 @@
#include <map> #include <map>
#include <string> #include <string>
#include "webrtc/api/optional.h"
#include "webrtc/common_types.h" #include "webrtc/common_types.h"
#include "webrtc/rtc_base/optional.h"
namespace webrtc { namespace webrtc {
namespace H264 { namespace H264 {

View File

@ -15,6 +15,7 @@
#include <string> #include <string>
#include <vector> #include <vector>
#include "webrtc/api/optional.h"
#include "webrtc/api/rtpparameters.h" #include "webrtc/api/rtpparameters.h"
#include "webrtc/api/rtpreceiverinterface.h" #include "webrtc/api/rtpreceiverinterface.h"
#include "webrtc/api/video/video_timing.h" #include "webrtc/api/video/video_timing.h"
@ -30,7 +31,6 @@
#include "webrtc/rtc_base/dscp.h" #include "webrtc/rtc_base/dscp.h"
#include "webrtc/rtc_base/logging.h" #include "webrtc/rtc_base/logging.h"
#include "webrtc/rtc_base/networkroute.h" #include "webrtc/rtc_base/networkroute.h"
#include "webrtc/rtc_base/optional.h"
#include "webrtc/rtc_base/sigslot.h" #include "webrtc/rtc_base/sigslot.h"
#include "webrtc/rtc_base/socket.h" #include "webrtc/rtc_base/socket.h"
#include "webrtc/rtc_base/window.h" #include "webrtc/rtc_base/window.h"

View File

@ -15,12 +15,12 @@
#include <cstdlib> #include <cstdlib>
#include <limits> #include <limits>
#include "webrtc/api/optional.h"
#include "webrtc/media/base/mediaconstants.h" #include "webrtc/media/base/mediaconstants.h"
#include "webrtc/media/base/videocommon.h" #include "webrtc/media/base/videocommon.h"
#include "webrtc/rtc_base/arraysize.h" #include "webrtc/rtc_base/arraysize.h"
#include "webrtc/rtc_base/checks.h" #include "webrtc/rtc_base/checks.h"
#include "webrtc/rtc_base/logging.h" #include "webrtc/rtc_base/logging.h"
#include "webrtc/rtc_base/optional.h"
namespace { namespace {
struct Fraction { struct Fraction {

View File

@ -11,10 +11,10 @@
#ifndef WEBRTC_MEDIA_BASE_VIDEOADAPTER_H_ #ifndef WEBRTC_MEDIA_BASE_VIDEOADAPTER_H_
#define WEBRTC_MEDIA_BASE_VIDEOADAPTER_H_ #define WEBRTC_MEDIA_BASE_VIDEOADAPTER_H_
#include "webrtc/api/optional.h"
#include "webrtc/media/base/videocommon.h" #include "webrtc/media/base/videocommon.h"
#include "webrtc/rtc_base/constructormagic.h" #include "webrtc/rtc_base/constructormagic.h"
#include "webrtc/rtc_base/criticalsection.h" #include "webrtc/rtc_base/criticalsection.h"
#include "webrtc/rtc_base/optional.h"
namespace cricket { namespace cricket {

View File

@ -11,8 +11,8 @@
#ifndef WEBRTC_MEDIA_BASE_VIDEOSOURCEINTERFACE_H_ #ifndef WEBRTC_MEDIA_BASE_VIDEOSOURCEINTERFACE_H_
#define WEBRTC_MEDIA_BASE_VIDEOSOURCEINTERFACE_H_ #define WEBRTC_MEDIA_BASE_VIDEOSOURCEINTERFACE_H_
#include "webrtc/api/optional.h"
#include "webrtc/media/base/videosinkinterface.h" #include "webrtc/media/base/videosinkinterface.h"
#include "webrtc/rtc_base/optional.h"
namespace rtc { namespace rtc {

View File

@ -15,8 +15,8 @@
#include <set> #include <set>
#include "webrtc/api/audio_codecs/audio_format.h" #include "webrtc/api/audio_codecs/audio_format.h"
#include "webrtc/api/optional.h"
#include "webrtc/media/base/codec.h" #include "webrtc/media/base/codec.h"
#include "webrtc/rtc_base/optional.h"
namespace cricket { namespace cricket {

View File

@ -18,6 +18,7 @@
#include <vector> #include <vector>
#include "webrtc/api/call/transport.h" #include "webrtc/api/call/transport.h"
#include "webrtc/api/optional.h"
#include "webrtc/api/video/video_frame.h" #include "webrtc/api/video/video_frame.h"
#include "webrtc/call/call.h" #include "webrtc/call/call.h"
#include "webrtc/call/flexfec_receive_stream.h" #include "webrtc/call/flexfec_receive_stream.h"
@ -31,7 +32,6 @@
#include "webrtc/rtc_base/asyncinvoker.h" #include "webrtc/rtc_base/asyncinvoker.h"
#include "webrtc/rtc_base/criticalsection.h" #include "webrtc/rtc_base/criticalsection.h"
#include "webrtc/rtc_base/networkroute.h" #include "webrtc/rtc_base/networkroute.h"
#include "webrtc/rtc_base/optional.h"
#include "webrtc/rtc_base/thread_annotations.h" #include "webrtc/rtc_base/thread_annotations.h"
#include "webrtc/rtc_base/thread_checker.h" #include "webrtc/rtc_base/thread_checker.h"

View File

@ -36,6 +36,7 @@ rtc_source_set("module_api") {
] ]
deps = [ deps = [
"..:webrtc_common", "..:webrtc_common",
"../api:optional",
"../api:video_frame_api", "../api:video_frame_api",
"../rtc_base:rtc_base_approved", "../rtc_base:rtc_base_approved",
] ]

View File

@ -47,6 +47,7 @@ rtc_static_library("audio_format_conversion") {
deps = [ deps = [
"../..:webrtc_common", "../..:webrtc_common",
"../../api:array_view", "../../api:array_view",
"../../api:optional",
"../../api/audio_codecs:audio_codecs_api", "../../api/audio_codecs:audio_codecs_api",
"../../rtc_base:rtc_base_approved", "../../rtc_base:rtc_base_approved",
] ]
@ -61,6 +62,7 @@ rtc_static_library("rent_a_codec") {
] ]
deps = [ deps = [
"../../api:array_view", "../../api:array_view",
"../../api:optional",
"../../api/audio_codecs:audio_codecs_api", "../../api/audio_codecs:audio_codecs_api",
"../..:webrtc_common", "../..:webrtc_common",
"../../rtc_base:protobuf_utils", "../../rtc_base:protobuf_utils",
@ -132,6 +134,7 @@ rtc_static_library("audio_coding") {
":neteq", ":neteq",
":rent_a_codec", ":rent_a_codec",
"../../rtc_base:rtc_base_approved", "../../rtc_base:rtc_base_approved",
"../../api:optional",
"../../logging:rtc_event_log_api", "../../logging:rtc_event_log_api",
] ]
defines = audio_coding_defines defines = audio_coding_defines
@ -814,6 +817,7 @@ rtc_static_library("webrtc_opus") {
deps = [ deps = [
":audio_network_adaptor", ":audio_network_adaptor",
"../..:webrtc_common", "../..:webrtc_common",
"../../api:optional",
"../../api/audio_codecs:audio_codecs_api", "../../api/audio_codecs:audio_codecs_api",
"../../api/audio_codecs/opus:audio_encoder_opus_config", "../../api/audio_codecs/opus:audio_encoder_opus_config",
"../../common_audio", "../../common_audio",
@ -908,6 +912,7 @@ rtc_static_library("audio_network_adaptor") {
deps = [ deps = [
"../..:webrtc_common", "../..:webrtc_common",
"../../api:optional",
"../../common_audio", "../../common_audio",
"../../logging:rtc_event_log_api", "../../logging:rtc_event_log_api",
"../../rtc_base:protobuf_utils", "../../rtc_base:protobuf_utils",
@ -934,6 +939,7 @@ rtc_source_set("neteq_decoder_enum") {
"neteq/neteq_decoder_enum.h", "neteq/neteq_decoder_enum.h",
] ]
deps = [ deps = [
"../../api:optional",
"../../api/audio_codecs:audio_codecs_api", "../../api/audio_codecs:audio_codecs_api",
"../../rtc_base:rtc_base_approved", "../../rtc_base:rtc_base_approved",
] ]
@ -1023,6 +1029,7 @@ rtc_static_library("neteq") {
":pcm16b", ":pcm16b",
"..:module_api", "..:module_api",
"../..:webrtc_common", "../..:webrtc_common",
"../../api:optional",
"../../api/audio_codecs:audio_codecs_api", "../../api/audio_codecs:audio_codecs_api",
"../../common_audio", "../../common_audio",
"../../rtc_base:gtest_prod", "../../rtc_base:gtest_prod",
@ -1082,6 +1089,7 @@ rtc_source_set("neteq_tools_minimal") {
":neteq", ":neteq",
"..:module_api", "..:module_api",
"../..:webrtc_common", "../..:webrtc_common",
"../../api:optional",
"../../api/audio_codecs:audio_codecs_api", "../../api/audio_codecs:audio_codecs_api",
"../../api/audio_codecs:builtin_audio_decoder_factory", "../../api/audio_codecs:builtin_audio_decoder_factory",
"../../rtc_base:rtc_base_approved", "../../rtc_base:rtc_base_approved",
@ -1166,6 +1174,7 @@ rtc_source_set("neteq_tools") {
deps = [ deps = [
"../..:webrtc_common", "../..:webrtc_common",
"../../api:array_view", "../../api:array_view",
"../../api:optional",
"../../api/audio_codecs:audio_codecs_api", "../../api/audio_codecs:audio_codecs_api",
"../../common_audio", "../../common_audio",
"../../rtc_base:rtc_base_approved", "../../rtc_base:rtc_base_approved",
@ -1290,6 +1299,7 @@ if (rtc_include_tests) {
":pcm16b_c", ":pcm16b_c",
"..:module_api", "..:module_api",
"../..:webrtc_common", "../..:webrtc_common",
"../../api:optional",
"../../api/audio_codecs:builtin_audio_decoder_factory", "../../api/audio_codecs:builtin_audio_decoder_factory",
"../../rtc_base:rtc_base_approved", "../../rtc_base:rtc_base_approved",
"../../system_wrappers:system_wrappers", "../../system_wrappers:system_wrappers",
@ -1396,6 +1406,7 @@ if (rtc_include_tests) {
":audio_format_conversion", ":audio_format_conversion",
"..:module_api", "..:module_api",
"../../:webrtc_common", "../../:webrtc_common",
"../../api:optional",
"../../rtc_base:rtc_base_approved", "../../rtc_base:rtc_base_approved",
"../../system_wrappers", "../../system_wrappers",
"../../system_wrappers:system_wrappers_default", "../../system_wrappers:system_wrappers_default",
@ -1425,6 +1436,7 @@ if (rtc_include_tests) {
":audio_format_conversion", ":audio_format_conversion",
"..:module_api", "..:module_api",
"../../:webrtc_common", "../../:webrtc_common",
"../../api:optional",
"../../rtc_base:rtc_base_approved", "../../rtc_base:rtc_base_approved",
"../../system_wrappers", "../../system_wrappers",
"../../system_wrappers:system_wrappers_default", "../../system_wrappers:system_wrappers_default",

View File

@ -17,6 +17,7 @@
#include <vector> #include <vector>
#include "webrtc/api/array_view.h" #include "webrtc/api/array_view.h"
#include "webrtc/api/optional.h"
#include "webrtc/common_audio/vad/include/webrtc_vad.h" #include "webrtc/common_audio/vad/include/webrtc_vad.h"
#include "webrtc/modules/audio_coding/acm2/acm_resampler.h" #include "webrtc/modules/audio_coding/acm2/acm_resampler.h"
#include "webrtc/modules/audio_coding/acm2/call_statistics.h" #include "webrtc/modules/audio_coding/acm2/call_statistics.h"
@ -24,7 +25,6 @@
#include "webrtc/modules/audio_coding/neteq/include/neteq.h" #include "webrtc/modules/audio_coding/neteq/include/neteq.h"
#include "webrtc/modules/include/module_common_types.h" #include "webrtc/modules/include/module_common_types.h"
#include "webrtc/rtc_base/criticalsection.h" #include "webrtc/rtc_base/criticalsection.h"
#include "webrtc/rtc_base/optional.h"
#include "webrtc/rtc_base/thread_annotations.h" #include "webrtc/rtc_base/thread_annotations.h"
#include "webrtc/typedefs.h" #include "webrtc/typedefs.h"

View File

@ -13,12 +13,12 @@
#include <map> #include <map>
#include "webrtc/api/optional.h"
#include "webrtc/common_types.h" #include "webrtc/common_types.h"
#include "webrtc/modules/audio_coding/acm2/rent_a_codec.h" #include "webrtc/modules/audio_coding/acm2/rent_a_codec.h"
#include "webrtc/modules/audio_coding/include/audio_coding_module.h" #include "webrtc/modules/audio_coding/include/audio_coding_module.h"
#include "webrtc/modules/audio_coding/include/audio_coding_module_typedefs.h" #include "webrtc/modules/audio_coding/include/audio_coding_module_typedefs.h"
#include "webrtc/rtc_base/constructormagic.h" #include "webrtc/rtc_base/constructormagic.h"
#include "webrtc/rtc_base/optional.h"
#include "webrtc/rtc_base/thread_checker.h" #include "webrtc/rtc_base/thread_checker.h"
namespace webrtc { namespace webrtc {

View File

@ -18,10 +18,10 @@
#include "webrtc/api/array_view.h" #include "webrtc/api/array_view.h"
#include "webrtc/api/audio_codecs/audio_decoder.h" #include "webrtc/api/audio_codecs/audio_decoder.h"
#include "webrtc/api/audio_codecs/audio_encoder.h" #include "webrtc/api/audio_codecs/audio_encoder.h"
#include "webrtc/api/optional.h"
#include "webrtc/modules/audio_coding/include/audio_coding_module_typedefs.h" #include "webrtc/modules/audio_coding/include/audio_coding_module_typedefs.h"
#include "webrtc/modules/audio_coding/neteq/neteq_decoder_enum.h" #include "webrtc/modules/audio_coding/neteq/neteq_decoder_enum.h"
#include "webrtc/rtc_base/constructormagic.h" #include "webrtc/rtc_base/constructormagic.h"
#include "webrtc/rtc_base/optional.h"
#include "webrtc/rtc_base/scoped_ref_ptr.h" #include "webrtc/rtc_base/scoped_ref_ptr.h"
#include "webrtc/typedefs.h" #include "webrtc/typedefs.h"

View File

@ -11,8 +11,8 @@
#ifndef WEBRTC_MODULES_AUDIO_CODING_AUDIO_NETWORK_ADAPTOR_CONTROLLER_H_ #ifndef WEBRTC_MODULES_AUDIO_CODING_AUDIO_NETWORK_ADAPTOR_CONTROLLER_H_
#define WEBRTC_MODULES_AUDIO_CODING_AUDIO_NETWORK_ADAPTOR_CONTROLLER_H_ #define WEBRTC_MODULES_AUDIO_CODING_AUDIO_NETWORK_ADAPTOR_CONTROLLER_H_
#include "webrtc/api/optional.h"
#include "webrtc/modules/audio_coding/audio_network_adaptor/include/audio_network_adaptor.h" #include "webrtc/modules/audio_coding/audio_network_adaptor/include/audio_network_adaptor.h"
#include "webrtc/rtc_base/optional.h"
namespace webrtc { namespace webrtc {

View File

@ -11,7 +11,7 @@
#ifndef WEBRTC_MODULES_AUDIO_CODING_AUDIO_NETWORK_ADAPTOR_INCLUDE_AUDIO_NETWORK_ADAPTOR_H_ #ifndef WEBRTC_MODULES_AUDIO_CODING_AUDIO_NETWORK_ADAPTOR_INCLUDE_AUDIO_NETWORK_ADAPTOR_H_
#define WEBRTC_MODULES_AUDIO_CODING_AUDIO_NETWORK_ADAPTOR_INCLUDE_AUDIO_NETWORK_ADAPTOR_H_ #define WEBRTC_MODULES_AUDIO_CODING_AUDIO_NETWORK_ADAPTOR_INCLUDE_AUDIO_NETWORK_ADAPTOR_H_
#include "webrtc/rtc_base/optional.h" #include "webrtc/api/optional.h"
namespace webrtc { namespace webrtc {

View File

@ -13,8 +13,8 @@
#include <string.h> #include <string.h>
#include "webrtc/api/array_view.h" #include "webrtc/api/array_view.h"
#include "webrtc/api/optional.h"
#include "webrtc/rtc_base/checks.h" #include "webrtc/rtc_base/checks.h"
#include "webrtc/rtc_base/optional.h"
#include "webrtc/rtc_base/safe_conversions.h" #include "webrtc/rtc_base/safe_conversions.h"
#include "webrtc/rtc_base/sanitizer.h" #include "webrtc/rtc_base/sanitizer.h"

View File

@ -14,9 +14,9 @@
#include <vector> #include <vector>
#include "webrtc/api/audio_codecs/audio_decoder.h" #include "webrtc/api/audio_codecs/audio_decoder.h"
#include "webrtc/api/optional.h"
#include "webrtc/modules/audio_coding/codecs/isac/locked_bandwidth_info.h" #include "webrtc/modules/audio_coding/codecs/isac/locked_bandwidth_info.h"
#include "webrtc/rtc_base/constructormagic.h" #include "webrtc/rtc_base/constructormagic.h"
#include "webrtc/rtc_base/optional.h"
#include "webrtc/rtc_base/scoped_ref_ptr.h" #include "webrtc/rtc_base/scoped_ref_ptr.h"
namespace webrtc { namespace webrtc {

View File

@ -19,11 +19,11 @@
#include "webrtc/api/audio_codecs/audio_encoder.h" #include "webrtc/api/audio_codecs/audio_encoder.h"
#include "webrtc/api/audio_codecs/audio_format.h" #include "webrtc/api/audio_codecs/audio_format.h"
#include "webrtc/api/audio_codecs/opus/audio_encoder_opus_config.h" #include "webrtc/api/audio_codecs/opus/audio_encoder_opus_config.h"
#include "webrtc/api/optional.h"
#include "webrtc/common_audio/smoothing_filter.h" #include "webrtc/common_audio/smoothing_filter.h"
#include "webrtc/modules/audio_coding/audio_network_adaptor/include/audio_network_adaptor.h" #include "webrtc/modules/audio_coding/audio_network_adaptor/include/audio_network_adaptor.h"
#include "webrtc/modules/audio_coding/codecs/opus/opus_interface.h" #include "webrtc/modules/audio_coding/codecs/opus/opus_interface.h"
#include "webrtc/rtc_base/constructormagic.h" #include "webrtc/rtc_base/constructormagic.h"
#include "webrtc/rtc_base/optional.h"
#include "webrtc/rtc_base/protobuf_utils.h" #include "webrtc/rtc_base/protobuf_utils.h"
namespace webrtc { namespace webrtc {

View File

@ -17,13 +17,13 @@
#include "webrtc/api/audio_codecs/audio_decoder_factory.h" #include "webrtc/api/audio_codecs/audio_decoder_factory.h"
#include "webrtc/api/audio_codecs/audio_encoder.h" #include "webrtc/api/audio_codecs/audio_encoder.h"
#include "webrtc/api/optional.h"
#include "webrtc/common_types.h" #include "webrtc/common_types.h"
#include "webrtc/modules/audio_coding/include/audio_coding_module_typedefs.h" #include "webrtc/modules/audio_coding/include/audio_coding_module_typedefs.h"
#include "webrtc/modules/audio_coding/neteq/include/neteq.h" #include "webrtc/modules/audio_coding/neteq/include/neteq.h"
#include "webrtc/modules/include/module.h" #include "webrtc/modules/include/module.h"
#include "webrtc/rtc_base/deprecation.h" #include "webrtc/rtc_base/deprecation.h"
#include "webrtc/rtc_base/function_view.h" #include "webrtc/rtc_base/function_view.h"
#include "webrtc/rtc_base/optional.h"
#include "webrtc/system_wrappers/include/clock.h" #include "webrtc/system_wrappers/include/clock.h"
#include "webrtc/typedefs.h" #include "webrtc/typedefs.h"

View File

@ -16,10 +16,10 @@
#include <string> #include <string>
#include <vector> #include <vector>
#include "webrtc/api/optional.h"
#include "webrtc/common_types.h" #include "webrtc/common_types.h"
#include "webrtc/modules/audio_coding/neteq/audio_decoder_impl.h" #include "webrtc/modules/audio_coding/neteq/audio_decoder_impl.h"
#include "webrtc/rtc_base/constructormagic.h" #include "webrtc/rtc_base/constructormagic.h"
#include "webrtc/rtc_base/optional.h"
#include "webrtc/rtc_base/scoped_ref_ptr.h" #include "webrtc/rtc_base/scoped_ref_ptr.h"
#include "webrtc/typedefs.h" #include "webrtc/typedefs.h"

View File

@ -12,7 +12,7 @@
#define WEBRTC_MODULES_AUDIO_CODING_NETEQ_NETEQ_DECODER_ENUM_H_ #define WEBRTC_MODULES_AUDIO_CODING_NETEQ_NETEQ_DECODER_ENUM_H_
#include "webrtc/api/audio_codecs/audio_format.h" #include "webrtc/api/audio_codecs/audio_format.h"
#include "webrtc/rtc_base/optional.h" #include "webrtc/api/optional.h"
namespace webrtc { namespace webrtc {

View File

@ -14,6 +14,7 @@
#include <memory> #include <memory>
#include <string> #include <string>
#include "webrtc/api/optional.h"
#include "webrtc/modules/audio_coding/neteq/audio_multi_vector.h" #include "webrtc/modules/audio_coding/neteq/audio_multi_vector.h"
#include "webrtc/modules/audio_coding/neteq/defines.h" #include "webrtc/modules/audio_coding/neteq/defines.h"
#include "webrtc/modules/audio_coding/neteq/include/neteq.h" #include "webrtc/modules/audio_coding/neteq/include/neteq.h"
@ -25,7 +26,6 @@
#include "webrtc/modules/include/module_common_types.h" #include "webrtc/modules/include/module_common_types.h"
#include "webrtc/rtc_base/constructormagic.h" #include "webrtc/rtc_base/constructormagic.h"
#include "webrtc/rtc_base/criticalsection.h" #include "webrtc/rtc_base/criticalsection.h"
#include "webrtc/rtc_base/optional.h"
#include "webrtc/rtc_base/thread_annotations.h" #include "webrtc/rtc_base/thread_annotations.h"
#include "webrtc/typedefs.h" #include "webrtc/typedefs.h"

View File

@ -11,10 +11,10 @@
#ifndef WEBRTC_MODULES_AUDIO_CODING_NETEQ_PACKET_BUFFER_H_ #ifndef WEBRTC_MODULES_AUDIO_CODING_NETEQ_PACKET_BUFFER_H_
#define WEBRTC_MODULES_AUDIO_CODING_NETEQ_PACKET_BUFFER_H_ #define WEBRTC_MODULES_AUDIO_CODING_NETEQ_PACKET_BUFFER_H_
#include "webrtc/api/optional.h"
#include "webrtc/modules/audio_coding/neteq/packet.h" #include "webrtc/modules/audio_coding/neteq/packet.h"
#include "webrtc/modules/include/module_common_types.h" #include "webrtc/modules/include/module_common_types.h"
#include "webrtc/rtc_base/constructormagic.h" #include "webrtc/rtc_base/constructormagic.h"
#include "webrtc/rtc_base/optional.h"
#include "webrtc/typedefs.h" #include "webrtc/typedefs.h"
namespace webrtc { namespace webrtc {

View File

@ -15,8 +15,8 @@
#include "webrtc/api/array_view.h" #include "webrtc/api/array_view.h"
#include "webrtc/api/audio_codecs/audio_decoder.h" #include "webrtc/api/audio_codecs/audio_decoder.h"
#include "webrtc/api/optional.h"
#include "webrtc/modules/audio_coding/neteq/tools/input_audio_file.h" #include "webrtc/modules/audio_coding/neteq/tools/input_audio_file.h"
#include "webrtc/rtc_base/optional.h"
namespace webrtc { namespace webrtc {
namespace test { namespace test {

View File

@ -16,9 +16,9 @@
#include <string> #include <string>
#include <vector> #include <vector>
#include "webrtc/api/optional.h"
#include "webrtc/modules/audio_coding/neteq/tools/neteq_input.h" #include "webrtc/modules/audio_coding/neteq/tools/neteq_input.h"
#include "webrtc/modules/audio_coding/neteq/tools/neteq_test.h" #include "webrtc/modules/audio_coding/neteq/tools/neteq_test.h"
#include "webrtc/rtc_base/optional.h"
#include "webrtc/typedefs.h" #include "webrtc/typedefs.h"
namespace webrtc { namespace webrtc {

View File

@ -15,11 +15,11 @@
#include <memory> #include <memory>
#include <string> #include <string>
#include "webrtc/api/optional.h"
#include "webrtc/common_types.h" #include "webrtc/common_types.h"
#include "webrtc/modules/audio_coding/neteq/tools/packet.h" #include "webrtc/modules/audio_coding/neteq/tools/packet.h"
#include "webrtc/modules/audio_coding/neteq/tools/packet_source.h" #include "webrtc/modules/audio_coding/neteq/tools/packet_source.h"
#include "webrtc/rtc_base/buffer.h" #include "webrtc/rtc_base/buffer.h"
#include "webrtc/rtc_base/optional.h"
namespace webrtc { namespace webrtc {
namespace test { namespace test {

View File

@ -16,8 +16,8 @@
#include <string> #include <string>
#include "webrtc/api/optional.h"
#include "webrtc/modules/include/module_common_types.h" #include "webrtc/modules/include/module_common_types.h"
#include "webrtc/rtc_base/optional.h"
#include "webrtc/typedefs.h" #include "webrtc/typedefs.h"
namespace webrtc { namespace webrtc {

View File

@ -283,6 +283,7 @@ if (rtc_include_tests) {
":audio_device", ":audio_device",
":mock_audio_device", ":mock_audio_device",
"../../api:array_view", "../../api:array_view",
"../../api:optional",
"../../rtc_base:rtc_base_approved", "../../rtc_base:rtc_base_approved",
"../../system_wrappers:system_wrappers", "../../system_wrappers:system_wrappers",
"../../test:test_support", "../../test:test_support",

View File

@ -13,6 +13,7 @@
#include <numeric> #include <numeric>
#include "webrtc/api/array_view.h" #include "webrtc/api/array_view.h"
#include "webrtc/api/optional.h"
#include "webrtc/modules/audio_device/audio_device_impl.h" #include "webrtc/modules/audio_device/audio_device_impl.h"
#include "webrtc/modules/audio_device/include/audio_device.h" #include "webrtc/modules/audio_device/include/audio_device.h"
#include "webrtc/modules/audio_device/include/mock_audio_transport.h" #include "webrtc/modules/audio_device/include/mock_audio_transport.h"
@ -20,7 +21,6 @@
#include "webrtc/rtc_base/criticalsection.h" #include "webrtc/rtc_base/criticalsection.h"
#include "webrtc/rtc_base/event.h" #include "webrtc/rtc_base/event.h"
#include "webrtc/rtc_base/logging.h" #include "webrtc/rtc_base/logging.h"
#include "webrtc/rtc_base/optional.h"
#include "webrtc/rtc_base/race_checker.h" #include "webrtc/rtc_base/race_checker.h"
#include "webrtc/rtc_base/safe_conversions.h" #include "webrtc/rtc_base/safe_conversions.h"
#include "webrtc/rtc_base/scoped_ref_ptr.h" #include "webrtc/rtc_base/scoped_ref_ptr.h"

View File

@ -238,6 +238,7 @@ rtc_static_library("audio_processing") {
"..:module_api", "..:module_api",
"../..:webrtc_common", "../..:webrtc_common",
"../../api:array_view", "../../api:array_view",
"../../api:optional",
"../../audio/utility:audio_frame_operations", "../../audio/utility:audio_frame_operations",
"../../rtc_base:gtest_prod", "../../rtc_base:gtest_prod",
"../../rtc_base:protobuf_utils", "../../rtc_base:protobuf_utils",
@ -553,6 +554,7 @@ if (rtc_include_tests) {
"..:module_api", "..:module_api",
"../..:webrtc_common", "../..:webrtc_common",
"../../api:array_view", "../../api:array_view",
"../../api:optional",
"../../common_audio:common_audio", "../../common_audio:common_audio",
"../../rtc_base:gtest_prod", "../../rtc_base:gtest_prod",
"../../rtc_base:protobuf_utils", "../../rtc_base:protobuf_utils",
@ -747,6 +749,7 @@ if (rtc_include_tests) {
":audioproc_debug_proto", ":audioproc_debug_proto",
":audioproc_protobuf_utils", ":audioproc_protobuf_utils",
":audioproc_test_utils", ":audioproc_test_utils",
"../../api:optional",
"../../common_audio:common_audio", "../../common_audio:common_audio",
"../../rtc_base:protobuf_utils", "../../rtc_base:protobuf_utils",
"../../rtc_base:rtc_base_approved", "../../rtc_base:rtc_base_approved",
@ -778,6 +781,7 @@ if (rtc_include_tests) {
":audio_processing", ":audio_processing",
"..:module_api", "..:module_api",
"../../api:array_view", "../../api:array_view",
"../../api:optional",
"../../common_audio", "../../common_audio",
"../../rtc_base:rtc_base_approved", "../../rtc_base:rtc_base_approved",
"../../system_wrappers:system_wrappers", "../../system_wrappers:system_wrappers",

View File

@ -16,6 +16,7 @@
#include <vector> #include <vector>
#include "webrtc/api/array_view.h" #include "webrtc/api/array_view.h"
#include "webrtc/api/optional.h"
#include "webrtc/modules/audio_processing/aec3/aec3_common.h" #include "webrtc/modules/audio_processing/aec3/aec3_common.h"
#include "webrtc/modules/audio_processing/aec3/echo_path_variability.h" #include "webrtc/modules/audio_processing/aec3/echo_path_variability.h"
#include "webrtc/modules/audio_processing/aec3/erl_estimator.h" #include "webrtc/modules/audio_processing/aec3/erl_estimator.h"
@ -23,7 +24,6 @@
#include "webrtc/modules/audio_processing/aec3/render_buffer.h" #include "webrtc/modules/audio_processing/aec3/render_buffer.h"
#include "webrtc/modules/audio_processing/include/audio_processing.h" #include "webrtc/modules/audio_processing/include/audio_processing.h"
#include "webrtc/rtc_base/constructormagic.h" #include "webrtc/rtc_base/constructormagic.h"
#include "webrtc/rtc_base/optional.h"
namespace webrtc { namespace webrtc {

View File

@ -9,13 +9,13 @@
*/ */
#include "webrtc/modules/audio_processing/aec3/block_processor.h" #include "webrtc/modules/audio_processing/aec3/block_processor.h"
#include "webrtc/api/optional.h"
#include "webrtc/modules/audio_processing/aec3/aec3_common.h" #include "webrtc/modules/audio_processing/aec3/aec3_common.h"
#include "webrtc/modules/audio_processing/aec3/block_processor_metrics.h" #include "webrtc/modules/audio_processing/aec3/block_processor_metrics.h"
#include "webrtc/modules/audio_processing/aec3/echo_path_variability.h" #include "webrtc/modules/audio_processing/aec3/echo_path_variability.h"
#include "webrtc/modules/audio_processing/logging/apm_data_dumper.h" #include "webrtc/modules/audio_processing/logging/apm_data_dumper.h"
#include "webrtc/rtc_base/atomicops.h" #include "webrtc/rtc_base/atomicops.h"
#include "webrtc/rtc_base/constructormagic.h" #include "webrtc/rtc_base/constructormagic.h"
#include "webrtc/rtc_base/optional.h"
namespace webrtc { namespace webrtc {
namespace { namespace {

View File

@ -13,13 +13,13 @@
#include <vector> #include <vector>
#include "webrtc/api/optional.h"
#include "webrtc/modules/audio_processing/aec3/decimator_by_4.h" #include "webrtc/modules/audio_processing/aec3/decimator_by_4.h"
#include "webrtc/modules/audio_processing/aec3/downsampled_render_buffer.h" #include "webrtc/modules/audio_processing/aec3/downsampled_render_buffer.h"
#include "webrtc/modules/audio_processing/aec3/matched_filter.h" #include "webrtc/modules/audio_processing/aec3/matched_filter.h"
#include "webrtc/modules/audio_processing/aec3/matched_filter_lag_aggregator.h" #include "webrtc/modules/audio_processing/aec3/matched_filter_lag_aggregator.h"
#include "webrtc/modules/audio_processing/include/audio_processing.h" #include "webrtc/modules/audio_processing/include/audio_processing.h"
#include "webrtc/rtc_base/constructormagic.h" #include "webrtc/rtc_base/constructormagic.h"
#include "webrtc/rtc_base/optional.h"
namespace webrtc { namespace webrtc {

View File

@ -13,10 +13,10 @@
#include <vector> #include <vector>
#include "webrtc/api/optional.h"
#include "webrtc/modules/audio_processing/aec3/echo_path_variability.h" #include "webrtc/modules/audio_processing/aec3/echo_path_variability.h"
#include "webrtc/modules/audio_processing/aec3/render_buffer.h" #include "webrtc/modules/audio_processing/aec3/render_buffer.h"
#include "webrtc/modules/audio_processing/include/audio_processing.h" #include "webrtc/modules/audio_processing/include/audio_processing.h"
#include "webrtc/rtc_base/optional.h"
namespace webrtc { namespace webrtc {

View File

@ -15,10 +15,10 @@
#include <memory> #include <memory>
#include <vector> #include <vector>
#include "webrtc/api/optional.h"
#include "webrtc/modules/audio_processing/aec3/aec3_common.h" #include "webrtc/modules/audio_processing/aec3/aec3_common.h"
#include "webrtc/modules/audio_processing/aec3/downsampled_render_buffer.h" #include "webrtc/modules/audio_processing/aec3/downsampled_render_buffer.h"
#include "webrtc/rtc_base/constructormagic.h" #include "webrtc/rtc_base/constructormagic.h"
#include "webrtc/rtc_base/optional.h"
namespace webrtc { namespace webrtc {
namespace aec3 { namespace aec3 {

View File

@ -13,9 +13,9 @@
#include <vector> #include <vector>
#include "webrtc/api/optional.h"
#include "webrtc/modules/audio_processing/aec3/matched_filter.h" #include "webrtc/modules/audio_processing/aec3/matched_filter.h"
#include "webrtc/rtc_base/constructormagic.h" #include "webrtc/rtc_base/constructormagic.h"
#include "webrtc/rtc_base/optional.h"
namespace webrtc { namespace webrtc {

View File

@ -13,10 +13,10 @@
#include <vector> #include <vector>
#include "webrtc/api/optional.h"
#include "webrtc/modules/audio_processing/aec3/echo_path_variability.h" #include "webrtc/modules/audio_processing/aec3/echo_path_variability.h"
#include "webrtc/modules/audio_processing/aec3/echo_remover.h" #include "webrtc/modules/audio_processing/aec3/echo_remover.h"
#include "webrtc/modules/audio_processing/aec3/render_buffer.h" #include "webrtc/modules/audio_processing/aec3/render_buffer.h"
#include "webrtc/rtc_base/optional.h"
#include "webrtc/test/gmock.h" #include "webrtc/test/gmock.h"
namespace webrtc { namespace webrtc {

View File

@ -12,9 +12,9 @@
#define WEBRTC_MODULES_AUDIO_PROCESSING_AEC3_MOCK_MOCK_RENDER_DELAY_CONTROLLER_H_ #define WEBRTC_MODULES_AUDIO_PROCESSING_AEC3_MOCK_MOCK_RENDER_DELAY_CONTROLLER_H_
#include "webrtc/api/array_view.h" #include "webrtc/api/array_view.h"
#include "webrtc/api/optional.h"
#include "webrtc/modules/audio_processing/aec3/downsampled_render_buffer.h" #include "webrtc/modules/audio_processing/aec3/downsampled_render_buffer.h"
#include "webrtc/modules/audio_processing/aec3/render_delay_controller.h" #include "webrtc/modules/audio_processing/aec3/render_delay_controller.h"
#include "webrtc/rtc_base/optional.h"
#include "webrtc/test/gmock.h" #include "webrtc/test/gmock.h"
namespace webrtc { namespace webrtc {

View File

@ -12,11 +12,11 @@
#define WEBRTC_MODULES_AUDIO_PROCESSING_AEC3_RENDER_DELAY_CONTROLLER_H_ #define WEBRTC_MODULES_AUDIO_PROCESSING_AEC3_RENDER_DELAY_CONTROLLER_H_
#include "webrtc/api/array_view.h" #include "webrtc/api/array_view.h"
#include "webrtc/api/optional.h"
#include "webrtc/modules/audio_processing/aec3/downsampled_render_buffer.h" #include "webrtc/modules/audio_processing/aec3/downsampled_render_buffer.h"
#include "webrtc/modules/audio_processing/aec3/render_delay_buffer.h" #include "webrtc/modules/audio_processing/aec3/render_delay_buffer.h"
#include "webrtc/modules/audio_processing/include/audio_processing.h" #include "webrtc/modules/audio_processing/include/audio_processing.h"
#include "webrtc/modules/audio_processing/logging/apm_data_dumper.h" #include "webrtc/modules/audio_processing/logging/apm_data_dumper.h"
#include "webrtc/rtc_base/optional.h"
namespace webrtc { namespace webrtc {

View File

@ -11,8 +11,8 @@
#ifndef WEBRTC_MODULES_AUDIO_PROCESSING_AEC3_RENDER_DELAY_CONTROLLER_METRICS_H_ #ifndef WEBRTC_MODULES_AUDIO_PROCESSING_AEC3_RENDER_DELAY_CONTROLLER_METRICS_H_
#define WEBRTC_MODULES_AUDIO_PROCESSING_AEC3_RENDER_DELAY_CONTROLLER_METRICS_H_ #define WEBRTC_MODULES_AUDIO_PROCESSING_AEC3_RENDER_DELAY_CONTROLLER_METRICS_H_
#include "webrtc/api/optional.h"
#include "webrtc/rtc_base/constructormagic.h" #include "webrtc/rtc_base/constructormagic.h"
#include "webrtc/rtc_base/optional.h"
namespace webrtc { namespace webrtc {

View File

@ -9,8 +9,8 @@
*/ */
#include "webrtc/modules/audio_processing/aec3/render_delay_controller_metrics.h" #include "webrtc/modules/audio_processing/aec3/render_delay_controller_metrics.h"
#include "webrtc/api/optional.h"
#include "webrtc/modules/audio_processing/aec3/aec3_common.h" #include "webrtc/modules/audio_processing/aec3/aec3_common.h"
#include "webrtc/rtc_base/optional.h"
#include "webrtc/test/gtest.h" #include "webrtc/test/gtest.h"

View File

@ -14,10 +14,10 @@
#include <array> #include <array>
#include <memory> #include <memory>
#include "webrtc/api/optional.h"
#include "webrtc/modules/audio_processing/aec3/aec3_common.h" #include "webrtc/modules/audio_processing/aec3/aec3_common.h"
#include "webrtc/modules/audio_processing/aec3/render_buffer.h" #include "webrtc/modules/audio_processing/aec3/render_buffer.h"
#include "webrtc/rtc_base/constructormagic.h" #include "webrtc/rtc_base/constructormagic.h"
#include "webrtc/rtc_base/optional.h"
namespace webrtc { namespace webrtc {

View File

@ -14,7 +14,7 @@
#include <cmath> #include <cmath>
#include <vector> #include <vector>
#include "webrtc/rtc_base/optional.h" #include "webrtc/api/optional.h"
namespace webrtc { namespace webrtc {

View File

@ -13,7 +13,7 @@
#include <vector> #include <vector>
#include "webrtc/rtc_base/optional.h" #include "webrtc/api/optional.h"
namespace webrtc { namespace webrtc {

View File

@ -10,11 +10,11 @@
#include "webrtc/modules/audio_processing/gain_control_impl.h" #include "webrtc/modules/audio_processing/gain_control_impl.h"
#include "webrtc/api/optional.h"
#include "webrtc/modules/audio_processing/agc/legacy/gain_control.h" #include "webrtc/modules/audio_processing/agc/legacy/gain_control.h"
#include "webrtc/modules/audio_processing/audio_buffer.h" #include "webrtc/modules/audio_processing/audio_buffer.h"
#include "webrtc/modules/audio_processing/logging/apm_data_dumper.h" #include "webrtc/modules/audio_processing/logging/apm_data_dumper.h"
#include "webrtc/rtc_base/constructormagic.h" #include "webrtc/rtc_base/constructormagic.h"
#include "webrtc/rtc_base/optional.h"
namespace webrtc { namespace webrtc {

View File

@ -14,6 +14,7 @@
#include <memory> #include <memory>
#include <vector> #include <vector>
#include "webrtc/api/optional.h"
#include "webrtc/modules/audio_processing/include/audio_processing.h" #include "webrtc/modules/audio_processing/include/audio_processing.h"
#include "webrtc/modules/audio_processing/level_controller/gain_applier.h" #include "webrtc/modules/audio_processing/level_controller/gain_applier.h"
#include "webrtc/modules/audio_processing/level_controller/gain_selector.h" #include "webrtc/modules/audio_processing/level_controller/gain_selector.h"
@ -22,7 +23,6 @@
#include "webrtc/modules/audio_processing/level_controller/saturating_gain_estimator.h" #include "webrtc/modules/audio_processing/level_controller/saturating_gain_estimator.h"
#include "webrtc/modules/audio_processing/level_controller/signal_classifier.h" #include "webrtc/modules/audio_processing/level_controller/signal_classifier.h"
#include "webrtc/rtc_base/constructormagic.h" #include "webrtc/rtc_base/constructormagic.h"
#include "webrtc/rtc_base/optional.h"
namespace webrtc { namespace webrtc {

View File

@ -11,12 +11,12 @@
#include <vector> #include <vector>
#include "webrtc/api/array_view.h" #include "webrtc/api/array_view.h"
#include "webrtc/api/optional.h"
#include "webrtc/modules/audio_processing/audio_buffer.h" #include "webrtc/modules/audio_processing/audio_buffer.h"
#include "webrtc/modules/audio_processing/include/audio_processing.h" #include "webrtc/modules/audio_processing/include/audio_processing.h"
#include "webrtc/modules/audio_processing/level_controller/level_controller.h" #include "webrtc/modules/audio_processing/level_controller/level_controller.h"
#include "webrtc/modules/audio_processing/test/audio_buffer_tools.h" #include "webrtc/modules/audio_processing/test/audio_buffer_tools.h"
#include "webrtc/modules/audio_processing/test/bitexactness_tools.h" #include "webrtc/modules/audio_processing/test/bitexactness_tools.h"
#include "webrtc/rtc_base/optional.h"
#include "webrtc/test/gtest.h" #include "webrtc/test/gtest.h"
namespace webrtc { namespace webrtc {

Some files were not shown because too many files have changed in this diff Show More