WebKit Bugzilla
Attachment 348240 Details for
Bug 189036
: Reenable -Wexit-time-destructors -and Wglobal-constructors in libwebrtc
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-189036-20180827170758.patch (text/plain), 30.90 KB, created by
youenn fablet
on 2018-08-27 17:07:58 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
youenn fablet
Created:
2018-08-27 17:07:58 PDT
Size:
30.90 KB
patch
obsolete
>Subversion Revision: 235392 >diff --git a/Source/ThirdParty/libwebrtc/ChangeLog b/Source/ThirdParty/libwebrtc/ChangeLog >index 69c674cd29964ad2b393fefbd33186ec2bc7d112..962a3fe7a7830af923d337dab291f2d785accff6 100644 >--- a/Source/ThirdParty/libwebrtc/ChangeLog >+++ b/Source/ThirdParty/libwebrtc/ChangeLog >@@ -1,3 +1,33 @@ >+2018-08-27 Youenn Fablet <youenn@apple.com> >+ >+ Reenable -Wexit-time-destructors -and Wglobal-constructors in libwebrtc >+ https://bugs.webkit.org/show_bug.cgi?id=189036 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Renable these compilation warnings and introduce rtc::NeverDestroyed as helper. >+ >+ * Configurations/Base.xcconfig: >+ * Source/webrtc/modules/audio_processing/agc2/rnn_vad/spectral_features_internal.cc: >+ * Source/webrtc/modules/congestion_controller/bbr/bbr_network_controller.cc: >+ * Source/webrtc/modules/congestion_controller/goog_cc/goog_cc_network_control.cc: >+ * Source/webrtc/pc/peerconnection.cc: >+ * Source/webrtc/rtc_base/flags.h: >+ * Source/webrtc/rtc_base/logging.cc: >+ * Source/webrtc/rtc_base/never_destroyed.h: Added. >+ (rtc::NeverDestroyed::NeverDestroyed): >+ (rtc::NeverDestroyed::operator T&): >+ (rtc::NeverDestroyed::get): >+ (rtc::NeverDestroyed::operator const T& const): >+ (rtc::NeverDestroyed::get const): >+ (rtc::NeverDestroyed::storagePointer const): >+ (rtc::makeNeverDestroyed): >+ * Source/webrtc/rtc_base/virtualsocketserver.cc: >+ * Source/webrtc/sdk/objc/Framework/Classes/PeerConnection/RTCVideoCodec.mm: >+ * Source/webrtc/system_wrappers/source/clock.cc: >+ * Source/webrtc/system_wrappers/source/runtime_enabled_features_default.cc: >+ * libwebrtc.xcodeproj/project.pbxproj: >+ > 2018-08-27 Keith Rollin <krollin@apple.com> > > Build system support for LTO >diff --git a/Source/ThirdParty/libwebrtc/Configurations/Base.xcconfig b/Source/ThirdParty/libwebrtc/Configurations/Base.xcconfig >index 513d82ee974563c8952e1405cb827f8f9f991cf0..019ee9b2232c530a3f731bd7ecb14e5491f8afe3 100644 >--- a/Source/ThirdParty/libwebrtc/Configurations/Base.xcconfig >+++ b/Source/ThirdParty/libwebrtc/Configurations/Base.xcconfig >@@ -52,7 +52,7 @@ GCC_WARN_UNUSED_FUNCTION = YES; > GCC_WARN_UNUSED_VARIABLE = YES; > PREBINDING = NO; > STRIP_INSTALLED_PRODUCT = NO; >-WARNING_CFLAGS = -Wthread-safety; >+WARNING_CFLAGS = -Wexit-time-destructors -Wglobal-constructors -Wthread-safety; > > SUPPORTED_PLATFORMS = iphoneos iphonesimulator macosx; > VALID_ARCHS = $(ARCHS_STANDARD_64_BIT); >diff --git a/Source/ThirdParty/libwebrtc/Source/webrtc/modules/audio_processing/agc2/rnn_vad/spectral_features_internal.cc b/Source/ThirdParty/libwebrtc/Source/webrtc/modules/audio_processing/agc2/rnn_vad/spectral_features_internal.cc >index 4cbe48a29e3a78f4e3a5ec86874bd1c2eeba7a67..9a14efdae7a21928641a03d74459432b44ffeb3f 100644 >--- a/Source/ThirdParty/libwebrtc/Source/webrtc/modules/audio_processing/agc2/rnn_vad/spectral_features_internal.cc >+++ b/Source/ThirdParty/libwebrtc/Source/webrtc/modules/audio_processing/agc2/rnn_vad/spectral_features_internal.cc >@@ -20,7 +20,11 @@ namespace rnn_vad { > namespace { > > // DCT scaling factor. >-const float kDctScalingFactor = std::sqrt(2.f / kNumBands); >+float kDctScalingFactor() >+{ >+ static const float kDctScalingFactor = std::sqrt(2.f / kNumBands); >+ return kDctScalingFactor; >+} > > } // namespace > >@@ -120,7 +124,7 @@ void ComputeDct(rtc::ArrayView<const float, kNumBands> in, > for (size_t j = 0; j < in.size(); ++j) { > out[i] += in[j] * dct_table[j * in.size() + i]; > } >- out[i] *= kDctScalingFactor; >+ out[i] *= kDctScalingFactor(); > } > } > >diff --git a/Source/ThirdParty/libwebrtc/Source/webrtc/modules/congestion_controller/bbr/bbr_network_controller.cc b/Source/ThirdParty/libwebrtc/Source/webrtc/modules/congestion_controller/bbr/bbr_network_controller.cc >index 890b285502417010334c7a3f4779a98f7df05866..ec5ef7765c2fbee0ab74e20857409db680aec028 100644 >--- a/Source/ThirdParty/libwebrtc/Source/webrtc/modules/congestion_controller/bbr/bbr_network_controller.cc >+++ b/Source/ThirdParty/libwebrtc/Source/webrtc/modules/congestion_controller/bbr/bbr_network_controller.cc >@@ -35,13 +35,13 @@ const double kProbeBWCongestionWindowGain = 2.0f; > // minus the IP and UDP headers. IPv6 has a 40 byte header, UDP adds an > // additional 8 bytes. This is a total overhead of 48 bytes. Ethernet's > // max packet size is 1500 bytes, 1500 - 48 = 1452. >-const DataSize kMaxPacketSize = DataSize::bytes(1452); >+const int kMaxPacketSize = 1452; > > // Default maximum packet size used in the Linux TCP implementation. > // Used in QUIC for congestion window computations in bytes. >-const DataSize kDefaultTCPMSS = DataSize::bytes(1460); >+const int kDefaultTCPMSS = 1460; > // Constants based on TCP defaults. >-const DataSize kMaxSegmentSize = kDefaultTCPMSS; >+const int kMaxSegmentSize = kDefaultTCPMSS; > > // The gain used for the slow start, equal to 2/ln(2). > const double kHighGain = 2.885f; >@@ -90,13 +90,13 @@ BbrNetworkController::BbrControllerConfig::BbrControllerConfig( > TimeDelta::PlusInfinity()), > initial_congestion_window( > "initial_cwin", >- kInitialCongestionWindowPackets * kDefaultTCPMSS), >+ kInitialCongestionWindowPackets * DataSize::bytes(kDefaultTCPMSS)), > min_congestion_window( > "min_cwin", >- kDefaultMinCongestionWindowPackets * kDefaultTCPMSS), >+ kDefaultMinCongestionWindowPackets * DataSize::bytes(kDefaultTCPMSS)), > max_congestion_window( > "max_cwin", >- kDefaultMaxCongestionWindowPackets * kDefaultTCPMSS), >+ kDefaultMaxCongestionWindowPackets * DataSize::bytes(kDefaultTCPMSS)), > probe_rtt_congestion_window_gain("probe_rtt_cwin_gain", 0.75), > pacing_rate_as_target("pacing_rate_as_target", false), > exit_startup_on_loss("exit_startup_on_loss", true), >@@ -725,7 +725,7 @@ void BbrNetworkController::MaybeEnterOrExitProbeRtt( > // PROBE_RTT. The CWND during PROBE_RTT is kMinimumCongestionWindow, but > // we allow an extra packet since QUIC checks CWND before sending a > // packet. >- if (msg.data_in_flight < ProbeRttCongestionWindow() + kMaxPacketSize) { >+ if (msg.data_in_flight < ProbeRttCongestionWindow() + DataSize::bytes(kMaxPacketSize)) { > exit_probe_rtt_at_ = msg.feedback_time + TimeDelta::ms(kProbeRttTimeMs); > probe_rtt_round_passed_ = false; > } >@@ -914,7 +914,7 @@ void BbrNetworkController::CalculateRecoveryWindow(DataSize bytes_acked, > // integer underflow. > recovery_window_ = recovery_window_ >= bytes_lost > ? recovery_window_ - bytes_lost >- : kMaxSegmentSize; >+ : DataSize::bytes(kMaxSegmentSize); > > // In CONSERVATION mode, just subtracting losses is sufficient. In GROWTH, > // release additional |bytes_acked| to achieve a slow-start-like behavior. >diff --git a/Source/ThirdParty/libwebrtc/Source/webrtc/modules/congestion_controller/goog_cc/goog_cc_network_control.cc b/Source/ThirdParty/libwebrtc/Source/webrtc/modules/congestion_controller/goog_cc/goog_cc_network_control.cc >index 4c33054fea8d5460652167ce1378acf5a3c4e93c..c9bb42e85588e545ec3750604f83c554382d1f3d 100644 >--- a/Source/ThirdParty/libwebrtc/Source/webrtc/modules/congestion_controller/goog_cc/goog_cc_network_control.cc >+++ b/Source/ThirdParty/libwebrtc/Source/webrtc/modules/congestion_controller/goog_cc/goog_cc_network_control.cc >@@ -39,7 +39,7 @@ const char kCwndExperiment[] = "WebRTC-CwndExperiment"; > const int64_t kDefaultAcceptedQueueMs = 250; > > // From RTCPSender video report interval. >-const TimeDelta kLossUpdateInterval = TimeDelta::ms(1000); >+const int kLossUpdateIntervalMs = 1000; > > // Pacing-rate relative to our target send rate. > // Multiplicative factor that is applied to the target bitrate to calculate >@@ -369,7 +369,7 @@ NetworkControlUpdate GoogCcNetworkController::OnTransportPacketsFeedback( > packet_feedback.receive_time.IsFinite() ? 0 : 1; > } > if (report.feedback_time > next_loss_update_) { >- next_loss_update_ += kLossUpdateInterval; >+ next_loss_update_ += TimeDelta::ms(kLossUpdateIntervalMs); > bandwidth_estimation_->UpdatePacketsLost( > expected_packets_since_last_loss_update_, > lost_packets_since_last_loss_update_, report.feedback_time.ms()); >diff --git a/Source/ThirdParty/libwebrtc/Source/webrtc/pc/peerconnection.cc b/Source/ThirdParty/libwebrtc/Source/webrtc/pc/peerconnection.cc >index e068f60de15b3eab624edb26f4a53c3819e9bba0..c0d7a218b0568ad39ba5fc4791b3ca1806107a2b 100644 >--- a/Source/ThirdParty/libwebrtc/Source/webrtc/pc/peerconnection.cc >+++ b/Source/ThirdParty/libwebrtc/Source/webrtc/pc/peerconnection.cc >@@ -46,6 +46,7 @@ > #include "rtc_base/bind.h" > #include "rtc_base/checks.h" > #include "rtc_base/logging.h" >+#include "rtc_base/never_destroyed.h" > #include "rtc_base/numerics/safe_conversions.h" > #include "rtc_base/stringencode.h" > #include "rtc_base/stringutils.h" >@@ -389,9 +390,8 @@ void NoteKeyProtocolAndMedia(KeyExchangeProtocolType protocol_type, > cricket::MediaType media_type) { > RTC_HISTOGRAM_ENUMERATION("WebRTC.PeerConnection.KeyProtocol", protocol_type, > kEnumCounterKeyProtocolMax); >- static const std::map<std::pair<KeyExchangeProtocolType, cricket::MediaType>, >- KeyExchangeProtocolMedia> >- proto_media_counter_map = { >+ auto proto_media_counter_map = rtc::makeNeverDestroyed(std::map<std::pair<KeyExchangeProtocolType, cricket::MediaType>, >+ KeyExchangeProtocolMedia> { > {{kEnumCounterKeyProtocolDtls, cricket::MEDIA_TYPE_AUDIO}, > kEnumCounterKeyProtocolMediaTypeDtlsAudio}, > {{kEnumCounterKeyProtocolDtls, cricket::MEDIA_TYPE_VIDEO}, >@@ -403,10 +403,10 @@ void NoteKeyProtocolAndMedia(KeyExchangeProtocolType protocol_type, > {{kEnumCounterKeyProtocolSdes, cricket::MEDIA_TYPE_VIDEO}, > kEnumCounterKeyProtocolMediaTypeSdesVideo}, > {{kEnumCounterKeyProtocolSdes, cricket::MEDIA_TYPE_DATA}, >- kEnumCounterKeyProtocolMediaTypeSdesData}}; >+ kEnumCounterKeyProtocolMediaTypeSdesData}}); > >- auto it = proto_media_counter_map.find({protocol_type, media_type}); >- if (it != proto_media_counter_map.end()) { >+ auto it = proto_media_counter_map.get().find({protocol_type, media_type}); >+ if (it != proto_media_counter_map.get().end()) { > RTC_HISTOGRAM_ENUMERATION("WebRTC.PeerConnection.KeyProtocolByMedia", > it->second, kEnumCounterKeyProtocolMediaTypeMax); > } >diff --git a/Source/ThirdParty/libwebrtc/Source/webrtc/rtc_base/flags.h b/Source/ThirdParty/libwebrtc/Source/webrtc/rtc_base/flags.h >index 33f6e5bda1dbda54c6df8e5f268fd860fd4768ad..30a52239ca3be66cae8109663a10536a15011b56 100644 >--- a/Source/ThirdParty/libwebrtc/Source/webrtc/rtc_base/flags.h >+++ b/Source/ThirdParty/libwebrtc/Source/webrtc/rtc_base/flags.h >@@ -152,18 +152,24 @@ class Flag { > }; > > // Internal use only. >-#define DEFINE_FLAG(type, c_type, name, default, comment) \ >- /* define and initialize the flag */ \ >- c_type FLAG_##name = (default); \ >- /* register the flag */ \ >- static rtc::Flag Flag_##name(__FILE__, #name, (comment), rtc::Flag::type, \ >- &FLAG_##name, \ >- rtc::FlagValue::New_##type(default)) >+#define DEFINE_FLAG(type, c_type, name, default, comment) \ >+ static std::pair<std::reference_wrapper<c_type>, std::reference_wrapper<rtc::Flag>> name() { \ >+ /* define and initialize the flag */ \ >+ static c_type FLAG_##name = (default); \ >+ /* register the flag */ \ >+ static rtc::Flag Flag_##name(__FILE__, #name, (comment), \ >+ rtc::Flag::type, &FLAG_##name, \ >+ rtc::FlagValue::New_##type(default)); \ >+ return std::make_pair<std::reference_wrapper<c_type>, std::reference_wrapper<rtc::Flag>>(FLAG_##name, Flag_##name); \ >+ } \ >+ c_type& FLAG_##name() { \ >+ return name().first; \ >+ } > > // Internal use only. > #define DECLARE_FLAG(c_type, name) \ >- /* declare the external flag */ \ >- extern c_type FLAG_##name >+ /* declare the flag getter */ \ >+ c_type& FLAG_##name(); > > // Use the following macros to define a new flag: > #define DEFINE_bool(name, default, comment) \ >diff --git a/Source/ThirdParty/libwebrtc/Source/webrtc/rtc_base/logging.cc b/Source/ThirdParty/libwebrtc/Source/webrtc/rtc_base/logging.cc >index c386600abbae200f200348f0047195fb5794bc99..718aab578ca97d31bf0839f097f90400bf96c5cb 100644 >--- a/Source/ThirdParty/libwebrtc/Source/webrtc/rtc_base/logging.cc >+++ b/Source/ThirdParty/libwebrtc/Source/webrtc/rtc_base/logging.cc >@@ -32,12 +32,15 @@ static const int kMaxLogLineSize = 1024 - 60; > #include <algorithm> > #include <cstdarg> > #include <iomanip> >+#include <mutex> > #include <ostream> >+#include <type_traits> > #include <vector> > > #include "rtc_base/criticalsection.h" > #include "rtc_base/logging.h" > #include "rtc_base/platform_thread_types.h" >+#include "rtc_base/never_destroyed.h" > #include "rtc_base/stringencode.h" > #include "rtc_base/strings/string_builder.h" > #include "rtc_base/stringutils.h" >@@ -69,13 +72,18 @@ std::ostream& GetNoopStream() { > public: > int overflow(int c) override { return c; } > }; >- static NoopStreamBuf noop_buffer; >- static std::ostream noop_stream(&noop_buffer); >- return noop_stream; >+ >+ static auto noop_buffer = makeNeverDestroyed(NoopStreamBuf { }); >+ static NeverDestroyed<std::ostream> noop_stream { &noop_buffer.get() }; >+ return noop_stream.get(); >+} >+ >+// Global lock for log subsystem, only needed to serialize access to streamList(). >+CriticalSection& logCriticalScope() { >+ static auto scope = makeNeverDestroyed<>(CriticalSection { }); >+ return scope.get(); > } > >-// Global lock for log subsystem, only needed to serialize access to streams_. >-CriticalSection g_log_crit; > } // namespace > > // Inefficient default implementation, override is recommended. >@@ -95,7 +103,15 @@ bool LogMessage::log_to_stderr_ = true; > // Note: we explicitly do not clean this up, because of the uncertain ordering > // of destructors at program exit. Let the person who sets the stream trigger > // cleanup by setting to null, or let it leak (safe at program exit). >-LogMessage::StreamList LogMessage::streams_ RTC_GUARDED_BY(g_log_crit); >+typedef std::pair<LogSink*, LoggingSeverity> StreamAndSeverity; >+typedef std::list<StreamAndSeverity> StreamList; >+ >+// The output streams and their associated severities >+StreamList& streamList() >+ RTC_EXCLUSIVE_LOCKS_REQUIRED(logCriticalScope()) { >+ static auto stream_list = makeNeverDestroyed<>(StreamList { }); >+ return stream_list.get(); >+} > > // Boolean options default to false (0) > bool LogMessage::thread_, LogMessage::timestamp_; >@@ -109,6 +125,10 @@ LogMessage::LogMessage(const char* file, > LogErrorContext err_ctx, > int err) > : severity_(sev), is_noop_(IsNoop(sev)) { >+ >+ static std::once_flag callLogCriticalScopeOnce; >+ std::call_once(callLogCriticalScopeOnce,[] { logCriticalScope(); }); >+ > // If there's no need to do any work, let's not :) > if (is_noop_) > return; >@@ -223,8 +243,8 @@ LogMessage::~LogMessage() { > #endif > } > >- CritScope cs(&g_log_crit); >- for (auto& kv : streams_) { >+ CritScope cs(&logCriticalScope()); >+ for (auto& kv : streamList()) { > if (severity_ >= kv.second) { > #if defined(WEBRTC_ANDROID) > kv.first->OnLogMessage(str, severity_, tag_); >@@ -278,7 +298,7 @@ void LogMessage::LogTimestamps(bool on) { > > void LogMessage::LogToDebug(LoggingSeverity min_sev) { > g_dbg_sev = min_sev; >- CritScope cs(&g_log_crit); >+ CritScope cs(&logCriticalScope()); > UpdateMinLogSeverity(); > } > >@@ -287,9 +307,9 @@ void LogMessage::SetLogToStderr(bool log_to_stderr) { > } > > int LogMessage::GetLogToStream(LogSink* stream) { >- CritScope cs(&g_log_crit); >+ CritScope cs(&logCriticalScope()); > LoggingSeverity sev = LS_NONE; >- for (auto& kv : streams_) { >+ for (auto& kv : streamList()) { > if (!stream || stream == kv.first) { > sev = std::min(sev, kv.second); > } >@@ -298,16 +318,16 @@ int LogMessage::GetLogToStream(LogSink* stream) { > } > > void LogMessage::AddLogToStream(LogSink* stream, LoggingSeverity min_sev) { >- CritScope cs(&g_log_crit); >- streams_.push_back(std::make_pair(stream, min_sev)); >+ CritScope cs(&logCriticalScope()); >+ streamList().push_back(std::make_pair(stream, min_sev)); > UpdateMinLogSeverity(); > } > > void LogMessage::RemoveLogToStream(LogSink* stream) { >- CritScope cs(&g_log_crit); >- for (StreamList::iterator it = streams_.begin(); it != streams_.end(); ++it) { >+ CritScope cs(&logCriticalScope()); >+ for (StreamList::iterator it = streamList().begin(); it != streamList().end(); ++it) { > if (stream == it->first) { >- streams_.erase(it); >+ streamList().erase(it); > break; > } > } >@@ -366,9 +386,9 @@ void LogMessage::ConfigureLogging(const char* params) { > } > > void LogMessage::UpdateMinLogSeverity() >- RTC_EXCLUSIVE_LOCKS_REQUIRED(g_log_crit) { >+ RTC_EXCLUSIVE_LOCKS_REQUIRED(logCriticalScope()) { > LoggingSeverity min_sev = g_dbg_sev; >- for (const auto& kv : streams_) { >+ for (const auto& kv : streamList()) { > const LoggingSeverity sev = kv.second; > min_sev = std::min(min_sev, sev); > } >@@ -482,8 +502,8 @@ bool LogMessage::IsNoop(LoggingSeverity severity) { > // TODO(tommi): We're grabbing this lock for every LogMessage instance that > // is going to be logged. This introduces unnecessary synchronization for > // a feature that's mostly used for testing. >- CritScope cs(&g_log_crit); >- return streams_.size() == 0; >+ CritScope cs(&logCriticalScope()); >+ return streamList().size() == 0; > } > > void LogMessage::FinishPrintStream() { >diff --git a/Source/ThirdParty/libwebrtc/Source/webrtc/rtc_base/never_destroyed.h b/Source/ThirdParty/libwebrtc/Source/webrtc/rtc_base/never_destroyed.h >new file mode 100644 >index 0000000000000000000000000000000000000000..fcc62e355341f889cb16a5e5297ea0460ed2d1cf >--- /dev/null >+++ b/Source/ThirdParty/libwebrtc/Source/webrtc/rtc_base/never_destroyed.h >@@ -0,0 +1,69 @@ >+/* >+ * Copyright (C) 2018 Apple Inc. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#pragma once >+ >+#include <type_traits> >+#include <utility> >+ >+namespace rtc { >+ >+template<typename T> class NeverDestroyed { >+public: >+ template<typename... Args> NeverDestroyed(Args&&... args) >+ { >+ new (storagePointer()) T(std::forward<Args>(args)...); >+ } >+ >+ NeverDestroyed(NeverDestroyed&& other) >+ { >+ new (storagePointer()) T(std::move(*other.storagePointer())); >+ } >+ >+ operator T&() { return *storagePointer(); } >+ T& get() { return *storagePointer(); } >+ >+ operator const T&() const { return *storagePointer(); } >+ const T& get() const { return *storagePointer(); } >+ >+private: >+ NeverDestroyed(const NeverDestroyed&) = delete; >+ NeverDestroyed& operator=(const NeverDestroyed&) = delete; >+ >+ using PointerType = typename std::remove_const<T>::type*; >+ >+ PointerType storagePointer() const { return const_cast<PointerType>(reinterpret_cast<const T*>(&m_storage)); } >+ >+ // FIXME: Investigate whether we should allocate a hunk of virtual memory >+ // and hand out chunks of it to NeverDestroyed instead, to reduce fragmentation. >+ typename std::aligned_storage<sizeof(T), std::alignment_of<T>::value>::type m_storage; >+}; >+ >+template<typename T> inline NeverDestroyed<T> makeNeverDestroyed(T&& argument) >+{ >+ return NeverDestroyed<T>(std::move(argument)); >+} >+ >+} // namespace rtc >diff --git a/Source/ThirdParty/libwebrtc/Source/webrtc/rtc_base/virtualsocketserver.cc b/Source/ThirdParty/libwebrtc/Source/webrtc/rtc_base/virtualsocketserver.cc >index 53dad46fced2cad02b50ed890e142f93d0076aac..ae40d7888f551bf7c5abcb88ba4a77f66c40b76a 100644 >--- a/Source/ThirdParty/libwebrtc/Source/webrtc/rtc_base/virtualsocketserver.cc >+++ b/Source/ThirdParty/libwebrtc/Source/webrtc/rtc_base/virtualsocketserver.cc >@@ -1027,9 +1027,8 @@ void VirtualSocketServer::UpdateDelayDistribution() { > } > } > >-static double PI = 4 * atan(1.0); >- > static double Normal(double x, double mean, double stddev) { >+ static const double PI = 4 * atan(1.0); > double a = (x - mean) * (x - mean) / (2 * stddev * stddev); > return exp(-a) / (stddev * sqrt(2 * PI)); > } >diff --git a/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/objc/Framework/Classes/PeerConnection/RTCVideoCodec.mm b/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/objc/Framework/Classes/PeerConnection/RTCVideoCodec.mm >index 955d974586398f867bd1f7eec4ec48f802ed4d35..ace46fa4f003af4ceb566f805015cdd36898d882 100644 >--- a/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/objc/Framework/Classes/PeerConnection/RTCVideoCodec.mm >+++ b/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/objc/Framework/Classes/PeerConnection/RTCVideoCodec.mm >@@ -21,16 +21,23 @@ > > namespace { > >+#if !defined(WEBRTC_WEBKIT_BUILD) > NSString *MaxSupportedProfileLevelConstrainedHigh(); > NSString *MaxSupportedProfileLevelConstrainedBaseline(); >+#endif > > } // namespace > >-NSString *const kRTCVideoCodecVp8Name = @(cricket::kVp8CodecName); >-NSString *const kRTCVideoCodecVp9Name = @(cricket::kVp9CodecName); >-NSString *const kRTCVideoCodecH264Name = @(cricket::kH264CodecName); >+NSString *const kRTCVideoCodecVp8Name = @"VP8"; >+NSString *const kRTCVideoCodecVp9Name = @"VP9"; >+NSString *const kRTCVideoCodecH264Name = @"H264"; > NSString *const kRTCLevel31ConstrainedHigh = @"640c1f"; > NSString *const kRTCLevel31ConstrainedBaseline = @"42e01f"; >+ >+#if defined(WEBRTC_WEBKIT_BUILD) >+NSString *const kRTCMaxSupportedH264ProfileLevelConstrainedHigh = kRTCLevel31ConstrainedHigh; >+NSString *const kRTCMaxSupportedH264ProfileLevelConstrainedBaseline = kRTCLevel31ConstrainedBaseline; >+#else > NSString *const kRTCMaxSupportedH264ProfileLevelConstrainedHigh = > MaxSupportedProfileLevelConstrainedHigh(); > NSString *const kRTCMaxSupportedH264ProfileLevelConstrainedBaseline = >@@ -43,7 +50,6 @@ namespace { > using namespace webrtc::H264; > > NSString *MaxSupportedLevelForProfile(Profile profile) { >-#if !defined(WEBRTC_WEBKIT_BUILD) > const absl::optional<ProfileLevelId> profileLevelId = [UIDevice maxSupportedH264Profile]; > if (profileLevelId && profileLevelId->profile >= profile) { > const absl::optional<std::string> profileString = >@@ -52,7 +58,6 @@ NSString *MaxSupportedLevelForProfile(Profile profile) { > return [NSString stringForStdString:*profileString]; > } > } >-#endif > return nil; > } > #endif >@@ -79,6 +84,8 @@ NSString *MaxSupportedProfileLevelConstrainedHigh() { > > } // namespace > >+#endif // WEBRTC_WEBKIT_BUILD >+ > @implementation RTCVideoCodecInfo > > @synthesize name = _name; >diff --git a/Source/ThirdParty/libwebrtc/Source/webrtc/system_wrappers/source/clock.cc b/Source/ThirdParty/libwebrtc/Source/webrtc/system_wrappers/source/clock.cc >index c9940fbe99e439ddebc8c2d3dfada9657dfe861a..973d77c10af4945b2416ae2c481f5475bd7a1ae4 100644 >--- a/Source/ThirdParty/libwebrtc/Source/webrtc/system_wrappers/source/clock.cc >+++ b/Source/ThirdParty/libwebrtc/Source/webrtc/system_wrappers/source/clock.cc >@@ -25,6 +25,7 @@ > #endif // defined(WEBRTC_POSIX) > > #include "rtc_base/criticalsection.h" >+#include "rtc_base/never_destroyed.h" > #include "rtc_base/synchronization/rw_lock_wrapper.h" > #include "rtc_base/timeutils.h" > >@@ -221,8 +222,8 @@ Clock* Clock::GetRealTimeClock() { > } > return g_shared_clock; > #elif defined(WEBRTC_POSIX) >- static UnixRealTimeClock clock; >- return &clock; >+ static auto clock = rtc::makeNeverDestroyed(UnixRealTimeClock { }); >+ return &clock.get(); > #else // defined(WEBRTC_POSIX) > return nullptr; > #endif // !defined(WEBRTC_WIN) || defined(WEBRTC_POSIX) >diff --git a/Source/ThirdParty/libwebrtc/Source/webrtc/system_wrappers/source/runtime_enabled_features_default.cc b/Source/ThirdParty/libwebrtc/Source/webrtc/system_wrappers/source/runtime_enabled_features_default.cc >index 1d040a91b0e44d302e437fc96f3250d18d33cb83..0e88fe9cf66cf2203cf8901dc747079b6285bf37 100644 >--- a/Source/ThirdParty/libwebrtc/Source/webrtc/system_wrappers/source/runtime_enabled_features_default.cc >+++ b/Source/ThirdParty/libwebrtc/Source/webrtc/system_wrappers/source/runtime_enabled_features_default.cc >@@ -12,6 +12,9 @@ > > #include "rtc_base/flags.h" > >+#include <functional> >+#include <utility> >+ > namespace flags { > DEFINE_bool(enable_dual_stream_mode, false, "Enables dual video stream mode."); > } >@@ -21,7 +24,7 @@ namespace runtime_enabled_features { > > bool IsFeatureEnabled(std::string feature_name) { > if (feature_name == kDualStreamModeFeatureName) >- return flags::FLAG_enable_dual_stream_mode; >+ return flags::FLAG_enable_dual_stream_mode(); > return false; > } > >diff --git a/Source/ThirdParty/libwebrtc/libwebrtc.xcodeproj/project.pbxproj b/Source/ThirdParty/libwebrtc/libwebrtc.xcodeproj/project.pbxproj >index 6bc19ce4012a1669c47a0b804bdbf59e78a15955..ff31662cada91823f63391e899c83eac62b18e8b 100644 >--- a/Source/ThirdParty/libwebrtc/libwebrtc.xcodeproj/project.pbxproj >+++ b/Source/ThirdParty/libwebrtc/libwebrtc.xcodeproj/project.pbxproj >@@ -522,6 +522,7 @@ > 416D3BEC212731C200775F09 /* vad_with_level.cc in Sources */ = {isa = PBXBuildFile; fileRef = 41D6B46C212731A4008F9353 /* vad_with_level.cc */; }; > 416D3BED212731C200775F09 /* vector_float_frame.cc in Sources */ = {isa = PBXBuildFile; fileRef = 41D6B466212731A2008F9353 /* vector_float_frame.cc */; }; > 417DA4581EF9CD0D00E869DB /* RTCUIApplicationStatusObserver.h in Headers */ = {isa = PBXBuildFile; fileRef = 417DA4561EF9CD0A00E869DB /* RTCUIApplicationStatusObserver.h */; }; >+ 417F7AC72134A08000FBA7EC /* never_destroyed.h in Headers */ = {isa = PBXBuildFile; fileRef = 417F7AC62134A07F00FBA7EC /* never_destroyed.h */; }; > 4192413A2127372400634FCF /* features_extraction.cc in Sources */ = {isa = PBXBuildFile; fileRef = 419241312127372200634FCF /* features_extraction.cc */; }; > 4192413B2127372400634FCF /* features_extraction.h in Headers */ = {isa = PBXBuildFile; fileRef = 419241322127372200634FCF /* features_extraction.h */; }; > 4192413C2127372400634FCF /* pitch_search.h in Headers */ = {isa = PBXBuildFile; fileRef = 419241332127372300634FCF /* pitch_search.h */; }; >@@ -3793,6 +3794,7 @@ > 415F1FDA2127313F00064CBF /* call_config.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = call_config.h; path = call/call_config.h; sourceTree = "<group>"; }; > 416D2F101FA8CC0400097345 /* VideoProcessing.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = VideoProcessing.framework; path = System/Library/PrivateFrameworks/VideoProcessing.framework; sourceTree = SDKROOT; }; > 417DA4561EF9CD0A00E869DB /* RTCUIApplicationStatusObserver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RTCUIApplicationStatusObserver.h; path = Source/webrtc/sdk/objc/Framework/Classes/Common/RTCUIApplicationStatusObserver.h; sourceTree = SOURCE_ROOT; }; >+ 417F7AC62134A07F00FBA7EC /* never_destroyed.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = never_destroyed.h; path = rtc_base/never_destroyed.h; sourceTree = "<group>"; }; > 419241312127372200634FCF /* features_extraction.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = features_extraction.cc; sourceTree = "<group>"; }; > 419241322127372200634FCF /* features_extraction.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = features_extraction.h; sourceTree = "<group>"; }; > 419241332127372300634FCF /* pitch_search.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = pitch_search.h; sourceTree = "<group>"; }; >@@ -6504,8 +6506,6 @@ > 413A21431FE18D0100373E99 /* rtc_base */ = { > isa = PBXGroup; > children = ( >- 4192417A2127390C00634FCF /* time */, >- 419241652127387900634FCF /* experiments */, > 41F2639D2126800000274F59 /* aligned_array.h */, > 41F2639B21267FFF00274F59 /* aligned_malloc.cc */, > 41F2639C21267FFF00274F59 /* aligned_malloc.h */, >@@ -6577,6 +6577,7 @@ > 413A222B1FE18DCF00373E99 /* event_tracer.h */, > 413A22641FE18DEB00373E99 /* event.cc */, > 413A22521FE18DE200373E99 /* event.h */, >+ 419241652127387900634FCF /* experiments */, > 41F9BFC82051DD8E00ABF0B9 /* experiments */, > 413A21BC1FE18D9B00373E99 /* fakeclock.cc */, > 413A222C1FE18DD000373E99 /* fakeclock.h */, >@@ -6668,6 +6669,7 @@ > 413A22381FE18DD600373E99 /* networkmonitor.cc */, > 413A22291FE18DCF00373E99 /* networkmonitor.h */, > 413A21691FE18D6500373E99 /* networkroute.h */, >+ 417F7AC62134A07F00FBA7EC /* never_destroyed.h */, > 413A220C1FE18DC100373E99 /* noop.cc */, > 413A229C1FE18E0400373E99 /* noop.mm */, > 413A227C1FE18DF800373E99 /* nullsocketserver_unittest.cc */, >@@ -6830,6 +6832,7 @@ > 413A22261FE18DCD00373E99 /* thread_unittest.cc */, > 413A21901FE18D8500373E99 /* thread.cc */, > 413A21EE1FE18DB400373E99 /* thread.h */, >+ 4192417A2127390C00634FCF /* time */, > 413A224B1FE18DDF00373E99 /* timestampaligner_unittest.cc */, > 413A22281FE18DCE00373E99 /* timestampaligner.cc */, > 413A22011FE18DBD00373E99 /* timestampaligner.h */, >@@ -11838,6 +11841,7 @@ > 5CDD841A1E439B2900621E92 /* audio_format_conversion.h in Headers */, > 5CD284931E6A5F410094FDC8 /* audio_frame_manipulator.h in Headers */, > 5CD2854E1E6A62130094FDC8 /* audio_frame_operations.h in Headers */, >+ 417F7AC72134A08000FBA7EC /* never_destroyed.h in Headers */, > 5CDD8A901E43C00F00621E92 /* audio_loop.h in Headers */, > 5CD284961E6A5F410094FDC8 /* audio_mixer_impl.h in Headers */, > 5C11A00E1E457448004F0987 /* audio_mixer_manager_mac.h in Headers */,
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 189036
:
348240
|
348293