Title: [214288] trunk/Source/ThirdParty/libwebrtc
Revision
214288
Author
achristen...@apple.com
Date
2017-03-22 17:57:27 -0700 (Wed, 22 Mar 2017)

Log Message

Fix warnings in libwebrtc
https://bugs.webkit.org/show_bug.cgi?id=169973

Reviewed by Geoffrey Garen.

* Configurations/boringssl.xcconfig:
* Configurations/libsrtp.xcconfig:
* Configurations/libwebrtc.xcconfig:
* Configurations/libwebrtcpcrtc.xcconfig:
* Configurations/libyuv.xcconfig:
* Configurations/opus.xcconfig:
* Configurations/usrsctp.xcconfig:
Build with more warnings.
opus still needs some incompatible pointer warnings disabled because it converts 
const opus_int16 * to const opus_val16 * and opus_int32 * to opus_val32 *
and that's ok because its a codec and that's what codecs do.
* Source/webrtc/base/logging.cc:
* Source/webrtc/base/logging.h:
* Source/webrtc/base/neverdestroyed.h: Added.
(webrtc::NeverDestroyed::NeverDestroyed):
(webrtc::NeverDestroyed::operator T&):
(webrtc::NeverDestroyed::get):
(webrtc::NeverDestroyed::operator&):
(webrtc::NeverDestroyed::asPtr):
Added webrtc::NeverDestroyed which may or may not be based on WTF::NeverDestroyed.
This allows us to avoid exit time destructors, which would slow down program termination for no reason.
* Source/webrtc/base/virtualsocketserver.cc:
* Source/webrtc/modules/audio_coding/codecs/builtin_audio_decoder_factory_internal.cc:
Adopt NeverDestroyed in function scope so we don't have global constructors or destructors.
* Source/webrtc/modules/audio_processing/beamformer/array_util.h:
(webrtc::DegreesToRadians):
(webrtc::RadiansToDegrees):
Add constexpr so we can calculate values at compile time instead of launch time.
* Source/webrtc/modules/rtp_rtcp/source/rtp_utility.cc:
* Source/webrtc/system_wrappers/source/clock.cc:
* libwebrtc.xcodeproj/project.pbxproj:
Don't compile ssl_test.cc.  We don't need it.

Modified Paths

Added Paths

Diff

Modified: trunk/Source/ThirdParty/libwebrtc/ChangeLog (214287 => 214288)


--- trunk/Source/ThirdParty/libwebrtc/ChangeLog	2017-03-23 00:27:01 UTC (rev 214287)
+++ trunk/Source/ThirdParty/libwebrtc/ChangeLog	2017-03-23 00:57:27 UTC (rev 214288)
@@ -1,3 +1,43 @@
+2017-03-22  Alex Christensen  <achristen...@webkit.org>
+
+        Fix warnings in libwebrtc
+        https://bugs.webkit.org/show_bug.cgi?id=169973
+
+        Reviewed by Geoffrey Garen.
+
+        * Configurations/boringssl.xcconfig:
+        * Configurations/libsrtp.xcconfig:
+        * Configurations/libwebrtc.xcconfig:
+        * Configurations/libwebrtcpcrtc.xcconfig:
+        * Configurations/libyuv.xcconfig:
+        * Configurations/opus.xcconfig:
+        * Configurations/usrsctp.xcconfig:
+        Build with more warnings.
+        opus still needs some incompatible pointer warnings disabled because it converts 
+        const opus_int16 * to const opus_val16 * and opus_int32 * to opus_val32 *
+        and that's ok because its a codec and that's what codecs do.
+        * Source/webrtc/base/logging.cc:
+        * Source/webrtc/base/logging.h:
+        * Source/webrtc/base/neverdestroyed.h: Added.
+        (webrtc::NeverDestroyed::NeverDestroyed):
+        (webrtc::NeverDestroyed::operator T&):
+        (webrtc::NeverDestroyed::get):
+        (webrtc::NeverDestroyed::operator&):
+        (webrtc::NeverDestroyed::asPtr):
+        Added webrtc::NeverDestroyed which may or may not be based on WTF::NeverDestroyed.
+        This allows us to avoid exit time destructors, which would slow down program termination for no reason.
+        * Source/webrtc/base/virtualsocketserver.cc:
+        * Source/webrtc/modules/audio_coding/codecs/builtin_audio_decoder_factory_internal.cc:
+        Adopt NeverDestroyed in function scope so we don't have global constructors or destructors.
+        * Source/webrtc/modules/audio_processing/beamformer/array_util.h:
+        (webrtc::DegreesToRadians):
+        (webrtc::RadiansToDegrees):
+        Add constexpr so we can calculate values at compile time instead of launch time.
+        * Source/webrtc/modules/rtp_rtcp/source/rtp_utility.cc:
+        * Source/webrtc/system_wrappers/source/clock.cc:
+        * libwebrtc.xcodeproj/project.pbxproj:
+        Don't compile ssl_test.cc.  We don't need it.
+
 2017-03-10  Youenn Fablet  <you...@apple.com>
 
         Move libwebrtc backend to using tracks

Modified: trunk/Source/ThirdParty/libwebrtc/Configurations/boringssl.xcconfig (214287 => 214288)


--- trunk/Source/ThirdParty/libwebrtc/Configurations/boringssl.xcconfig	2017-03-23 00:27:01 UTC (rev 214287)
+++ trunk/Source/ThirdParty/libwebrtc/Configurations/boringssl.xcconfig	2017-03-23 00:57:27 UTC (rev 214288)
@@ -10,7 +10,6 @@
 INSTALL_PATH = /usr/local/lib;
 PUBLIC_HEADERS_FOLDER_PATH = /usr/local/include/libwebrtc;
 USE_HEADERMAP = NO;
-WARNING_CFLAGS = -Wno-exit-time-destructors;
 
 // FIXME: There's no assembly used in the boringssl build yet :(
 GCC_PREPROCESSOR_DEFINITIONS = OPENSSL_NO_ASM;

Modified: trunk/Source/ThirdParty/libwebrtc/Configurations/libsrtp.xcconfig (214287 => 214288)


--- trunk/Source/ThirdParty/libwebrtc/Configurations/libsrtp.xcconfig	2017-03-23 00:27:01 UTC (rev 214287)
+++ trunk/Source/ThirdParty/libwebrtc/Configurations/libsrtp.xcconfig	2017-03-23 00:57:27 UTC (rev 214288)
@@ -11,5 +11,5 @@
 INSTALL_PATH = /usr/local/lib;
 PUBLIC_HEADERS_FOLDER_PATH = /usr/local/include/libwebrtc;
 USE_HEADERMAP = NO;
-WARNING_CFLAGS = -Wno-exit-time-destructors -Wno-implicit-function-declaration -Wno-incompatible-pointer-types -Wno-deprecated-declarations;
+WARNING_CFLAGS = -Wno-implicit-function-declaration -Wno-deprecated-declarations;
 GCC_PREPROCESSOR_DEFINITIONS = V8_DEPRECATION_WARNINGS ENABLE_NOTIFICATIONS ENABLE_PLUGINS=1 ENABLE_PDF=1 ENABLE_PRINTING=1 ENABLE_BASIC_PRINTING=1 ENABLE_PRINT_PREVIEW=1 ENABLE_SPELLCHECK=1 USE_BROWSER_SPELLCHECKER=1 NO_TCMALLOC USE_EXTERNAL_POPUP_MENU=1 ENABLE_WEBRTC=1 ENABLE_EXTENSIONS=1 ENABLE_TASK_MANAGER=1 ENABLE_THEMES=1 ENABLE_SESSION_SERVICE=1 ENABLE_SUPERVISED_USERS=1 FULL_SAFE_BROWSING SAFE_BROWSING_CSD SAFE_BROWSING_DB_LOCAL CHROMIUM_BUILD ENABLE_MEDIA_ROUTER=1 FIELDTRIAL_TESTING_ENABLED CR_CLANG_REVISION=284979-1 CR_XCODE_VERSION=0820 __ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORE=0 _DEBUG DYNAMIC_ANNOTATIONS_ENABLED=1 WTF_USE_DYNAMIC_ANNOTATIONS=1 PACKAGE_STRING="\"libsrtp2 2.0.0-pre\"" PACKAGE_VERSION="\"2.0.0-pre\"" HAVE_CONFIG_H OPENSSL HAVE_STDLIB_H HAVE_STRING_H HAVE_STDINT_H HAVE_INTTYPES_H HAVE_INT16_T HAVE_INT32_T HAVE_INT8_T HAVE_UINT16_T HAVE_UINT32_T HAVE_UINT64_T HAVE_UINT8_T HAVE_AR
 PA_INET_H HAVE_NETINET_IN_H HAVE_SYS_TYPES_H HAVE_UNISTD_H;

Modified: trunk/Source/ThirdParty/libwebrtc/Configurations/libwebrtc.xcconfig (214287 => 214288)


--- trunk/Source/ThirdParty/libwebrtc/Configurations/libwebrtc.xcconfig	2017-03-23 00:27:01 UTC (rev 214287)
+++ trunk/Source/ThirdParty/libwebrtc/Configurations/libwebrtc.xcconfig	2017-03-23 00:57:27 UTC (rev 214288)
@@ -24,7 +24,7 @@
 PUBLIC_HEADERS_FOLDER_PATH = /usr/local/include/libwebrtc;
 USE_HEADERMAP = NO;
 INSTALLHDRS_SCRIPT_PHASE = YES;
-WARNING_CFLAGS = -Wno-exit-time-destructors -Wno-objc-property-no-attribute -Wno-objc-missing-super-calls -Wno-deprecated-declarations;
+WARNING_CFLAGS = -Wno-objc-property-no-attribute -Wno-objc-missing-super-calls -Wno-deprecated-declarations;
 
 GCC_PREPROCESSOR_DEFINITIONS = WEBRTC_POSIX WEBRTC_MAC SSL_USE_OPENSSL FEATURE_ENABLE_SSL HAVE_SRTP HAVE_OPENSSL_SSL_H SCTP_PROCESS_LEVEL_LOCKS SCTP_SIMPLE_ALLOCATOR SCTP_USE_OPENSSL_SHA1 __Userspace__ HAVE_SA_LEN HAVE_SCONN_LEN __APPLE_USE_RFC_2292 __Userspace_os_Darwin NON_WINDOWS_DEFINE HAVE_WEBRTC_VIDEO HAVE_WEBRTC_VOICE WEBRTC_INTELLIGIBILITY_ENHANCER=0 WEBRTC_APM_DEBUG_DUMP=0 WEBRTC_NS_FLOAT WEBRTC_CODEC_ILBC WEBRTC_CODEC_OPUS WEBRTC_CODEC_ISAC WEBRTC_CODEC_RED RTC_DISABLE_VP9 RTC_DISABLE_VP8 HAVE_STDINT_H HAVE_STDLIB_H HAVE_UINT64_T OPENSSL HAVE_CONFIG_H WEBRTC_WEBKIT_BUILD HAVE_PTHREAD_COND_TIMEDWAIT_RELATIVE  HAVE_SCTP WEBRTC_CODEC_G711 WEBRTC_CODEC_G722;
 

Modified: trunk/Source/ThirdParty/libwebrtc/Configurations/libwebrtcpcrtc.xcconfig (214287 => 214288)


--- trunk/Source/ThirdParty/libwebrtc/Configurations/libwebrtcpcrtc.xcconfig	2017-03-23 00:27:01 UTC (rev 214287)
+++ trunk/Source/ThirdParty/libwebrtc/Configurations/libwebrtcpcrtc.xcconfig	2017-03-23 00:57:27 UTC (rev 214288)
@@ -11,7 +11,7 @@
 INSTALL_PATH = /usr/local/lib;
 PUBLIC_HEADERS_FOLDER_PATH = /usr/local/include/libwebrtc;
 USE_HEADERMAP = NO;
-WARNING_CFLAGS = -Wno-exit-time-destructors -Wno-objc-property-no-attribute -Wno-objc-missing-super-calls;
+WARNING_CFLAGS = -Wno-objc-property-no-attribute -Wno-objc-missing-super-calls;
 
 GCC_PREPROCESSOR_DEFINITIONS = WEBRTC_POSIX WEBRTC_MAC SSL_USE_OPENSSL FEATURE_ENABLE_SSL HAVE_SRTP HAVE_OPENSSL_SSL_H SCTP_PROCESS_LEVEL_LOCKS SCTP_SIMPLE_ALLOCATOR SCTP_USE_OPENSSL_SHA1 __Userspace__ HAVE_SA_LEN HAVE_SCONN_LEN __APPLE_USE_RFC_2292 __Userspace_os_Darwin NON_WINDOWS_DEFINE HAVE_WEBRTC_VIDEO HAVE_WEBRTC_VOICE WEBRTC_INTELLIGIBILITY_ENHANCER=0 WEBRTC_APM_DEBUG_DUMP=0 WEBRTC_NS_FLOAT WEBRTC_CODEC_ILBC WEBRTC_CODEC_OPUS WEBRTC_CODEC_ISAC WEBRTC_CODEC_RED RTC_DISABLE_VP9 RTC_DISABLE_VP8 HAVE_STDINT_H HAVE_STDLIB_H HAVE_UINT64_T OPENSSL HAVE_CONFIG_H WEBRTC_WEBKIT_BUILD HAVE_PTHREAD_COND_TIMEDWAIT_RELATIVE  HAVE_SCTP;
 

Modified: trunk/Source/ThirdParty/libwebrtc/Configurations/libyuv.xcconfig (214287 => 214288)


--- trunk/Source/ThirdParty/libwebrtc/Configurations/libyuv.xcconfig	2017-03-23 00:27:01 UTC (rev 214287)
+++ trunk/Source/ThirdParty/libwebrtc/Configurations/libyuv.xcconfig	2017-03-23 00:57:27 UTC (rev 214288)
@@ -10,4 +10,3 @@
 INSTALL_PATH = /usr/local/lib;
 PUBLIC_HEADERS_FOLDER_PATH = /usr/local/include/libwebrtc;
 USE_HEADERMAP = NO;
-WARNING_CFLAGS = -Wno-exit-time-destructors -Wno-implicit-function-declaration -Wno-incompatible-pointer-types -Wno-deprecated-declarations;

Modified: trunk/Source/ThirdParty/libwebrtc/Configurations/opus.xcconfig (214287 => 214288)


--- trunk/Source/ThirdParty/libwebrtc/Configurations/opus.xcconfig	2017-03-23 00:27:01 UTC (rev 214287)
+++ trunk/Source/ThirdParty/libwebrtc/Configurations/opus.xcconfig	2017-03-23 00:57:27 UTC (rev 214288)
@@ -10,7 +10,7 @@
 INSTALL_PATH = /usr/local/lib;
 PUBLIC_HEADERS_FOLDER_PATH = /usr/local/include/libwebrtc;
 USE_HEADERMAP = NO;
-WARNING_CFLAGS = -Wno-exit-time-destructors -Wno-implicit-function-declaration -Wno-incompatible-pointer-types
+WARNING_CFLAGS = -Wno-incompatible-pointer-types
 GCC_PREPROCESSOR_DEFINITIONS = VAR_ARRAYS OPUS_BUILD OPUS_EXPORT= HAVE_LRINT HAVE_LRINTF OPUS_X86_MAY_HAVE_SSE2;
 
 EXCLUDED_SOURCE_FILE_NAMES[sdk=iphone*] = *_sse.c *_sse2.c;

Modified: trunk/Source/ThirdParty/libwebrtc/Configurations/usrsctp.xcconfig (214287 => 214288)


--- trunk/Source/ThirdParty/libwebrtc/Configurations/usrsctp.xcconfig	2017-03-23 00:27:01 UTC (rev 214287)
+++ trunk/Source/ThirdParty/libwebrtc/Configurations/usrsctp.xcconfig	2017-03-23 00:57:27 UTC (rev 214288)
@@ -10,6 +10,6 @@
 INSTALL_PATH = /usr/local/lib;
 PUBLIC_HEADERS_FOLDER_PATH = /usr/local/include/libwebrtc;
 USE_HEADERMAP = NO;
-WARNING_CFLAGS = -Wno-exit-time-destructors -Wno-implicit-function-declaration -Wno-incompatible-pointer-types -Wno-deprecated-declarations;
+WARNING_CFLAGS = -Wno-deprecated-declarations;
 GCC_PREPROCESSOR_DEFINITIONS = SCTP_PROCESS_LEVEL_LOCKS SCTP_SIMPLE_ALLOCATOR SCTP_USE_OPENSSL_SHA1 __Userspace__ HAVE_SA_LEN HAVE_SCONN_LEN __APPLE_USE_RFC_2292 __Userspace_os_Darwin;
 OTHER_CFLAGS = -UINET -UINET6 -U__APPLE__;

Modified: trunk/Source/ThirdParty/libwebrtc/Source/webrtc/base/logging.cc (214287 => 214288)


--- trunk/Source/ThirdParty/libwebrtc/Source/webrtc/base/logging.cc	2017-03-23 00:27:01 UTC (rev 214287)
+++ trunk/Source/ThirdParty/libwebrtc/Source/webrtc/base/logging.cc	2017-03-23 00:57:27 UTC (rev 214288)
@@ -41,6 +41,7 @@
 
 #include "webrtc/base/criticalsection.h"
 #include "webrtc/base/logging.h"
+#include "webrtc/base/neverdestroyed.h"
 #include "webrtc/base/platform_thread.h"
 #include "webrtc/base/stringencode.h"
 #include "webrtc/base/stringutils.h"
@@ -103,8 +104,12 @@
 bool LogMessage::log_to_stderr_ = true;
 
 namespace {
-// Global lock for log subsystem, only needed to serialize access to streams_.
-CriticalSection g_log_crit;
+// Global lock for log subsystem, only needed to serialize access to streams.
+const CriticalSection& g_log_crit()
+{
+    static webrtc::NeverDestroyed<CriticalSection> g_log_crit;
+    return g_log_crit;
+}
 }  // namespace
 
 // The list of logging streams currently configured.
@@ -111,7 +116,11 @@
 // 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_ GUARDED_BY(g_log_crit);
+LogMessage::StreamList& LogMessage::streams()
+{
+    static webrtc::NeverDestroyed<LogMessage::StreamList> streams GUARDED_BY(g_log_crit);
+    return streams;
+}
 
 // Boolean options default to false (0)
 bool LogMessage::thread_, LogMessage::timestamp_;
@@ -207,8 +216,8 @@
     OutputToDebug(str, severity_, tag_);
   }
 
-  CritScope cs(&g_log_crit);
-  for (auto& kv : streams_) {
+  CritScope cs(&g_log_crit());
+  for (auto& kv : streams()) {
     if (severity_ >= kv.second) {
       kv.first->OnLogMessage(str);
     }
@@ -235,7 +244,7 @@
 
 void LogMessage::LogToDebug(LoggingSeverity min_sev) {
   dbg_sev_ = min_sev;
-  CritScope cs(&g_log_crit);
+  CritScope cs(&g_log_crit());
   UpdateMinLogSeverity();
 }
 
@@ -244,9 +253,9 @@
 }
 
 int LogMessage::GetLogToStream(LogSink* stream) {
-  CritScope cs(&g_log_crit);
+  CritScope cs(&g_log_crit());
   LoggingSeverity sev = LS_NONE;
-  for (auto& kv : streams_) {
+  for (auto& kv : streams()) {
     if (!stream || stream == kv.first) {
       sev = std::min(sev, kv.second);
     }
@@ -255,16 +264,16 @@
 }
 
 void LogMessage::AddLogToStream(LogSink* stream, LoggingSeverity min_sev) {
-  CritScope cs(&g_log_crit);
-  streams_.push_back(std::make_pair(stream, min_sev));
+  CritScope cs(&g_log_crit());
+  streams().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(&g_log_crit());
+  for (StreamList::iterator it = streams().begin(); it != streams().end(); ++it) {
     if (stream == it->first) {
-      streams_.erase(it);
+      streams().erase(it);
       break;
     }
   }
@@ -335,7 +344,7 @@
 
 void LogMessage::UpdateMinLogSeverity() EXCLUSIVE_LOCKS_REQUIRED(g_log_crit) {
   LoggingSeverity min_sev = dbg_sev_;
-  for (auto& kv : streams_) {
+  for (auto& kv : streams()) {
     min_sev = std::min(dbg_sev_, kv.second);
   }
   min_sev_ = min_sev;

Modified: trunk/Source/ThirdParty/libwebrtc/Source/webrtc/base/logging.h (214287 => 214288)


--- trunk/Source/ThirdParty/libwebrtc/Source/webrtc/base/logging.h	2017-03-23 00:27:01 UTC (rev 214287)
+++ trunk/Source/ThirdParty/libwebrtc/Source/webrtc/base/logging.h	2017-03-23 00:57:27 UTC (rev 214288)
@@ -234,7 +234,7 @@
   static LoggingSeverity min_sev_, dbg_sev_, ctx_sev_;
 
   // The output streams and their associated severities
-  static StreamList streams_;
+  static StreamList& streams();
 
   // Flags for formatting options
   static bool thread_, timestamp_;

Added: trunk/Source/ThirdParty/libwebrtc/Source/webrtc/base/neverdestroyed.h (0 => 214288)


--- trunk/Source/ThirdParty/libwebrtc/Source/webrtc/base/neverdestroyed.h	                        (rev 0)
+++ trunk/Source/ThirdParty/libwebrtc/Source/webrtc/base/neverdestroyed.h	2017-03-23 00:57:27 UTC (rev 214288)
@@ -0,0 +1,33 @@
+/*
+ *  Copyright (c) 2017 Apple Inc. 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.
+ */
+
+#pragma once
+
+namespace webrtc {
+
+template<typename T> class NeverDestroyed {
+    NeverDestroyed(const NeverDestroyed&) = delete;
+    NeverDestroyed& operator=(const NeverDestroyed&) = delete;
+public:
+    template<typename... Args>
+    NeverDestroyed(Args&&... args)
+    {
+        new (&m_storage) T(std::forward<Args>(args)...);
+    }
+    operator T&() { return *asPtr(); }
+    T& get() { return *asPtr(); }
+    T* operator&() { return asPtr(); }
+private:
+    typedef typename std::remove_const<T>::type* PointerType;
+    PointerType asPtr() { return reinterpret_cast<PointerType>(&m_storage); }
+    typename std::aligned_storage<sizeof(T), std::alignment_of<T>::value>::type m_storage;
+};
+
+}

Modified: trunk/Source/ThirdParty/libwebrtc/Source/webrtc/base/virtualsocketserver.cc (214287 => 214288)


--- trunk/Source/ThirdParty/libwebrtc/Source/webrtc/base/virtualsocketserver.cc	2017-03-23 00:27:01 UTC (rev 214287)
+++ trunk/Source/ThirdParty/libwebrtc/Source/webrtc/base/virtualsocketserver.cc	2017-03-23 00:57:27 UTC (rev 214288)
@@ -1016,7 +1016,7 @@
   }
 }
 
-static double PI = 4 * atan(1.0);
+static const double PI = 3.141592653589793238462643383279502884;
 
 static double Normal(double x, double mean, double stddev) {
   double a = (x - mean) * (x - mean) / (2 * stddev * stddev);

Modified: trunk/Source/ThirdParty/libwebrtc/Source/webrtc/modules/audio_coding/codecs/builtin_audio_decoder_factory_internal.cc (214287 => 214288)


--- trunk/Source/ThirdParty/libwebrtc/Source/webrtc/modules/audio_coding/codecs/builtin_audio_decoder_factory_internal.cc	2017-03-23 00:27:01 UTC (rev 214287)
+++ trunk/Source/ThirdParty/libwebrtc/Source/webrtc/modules/audio_coding/codecs/builtin_audio_decoder_factory_internal.cc	2017-03-23 00:57:27 UTC (rev 214288)
@@ -15,6 +15,7 @@
 
 #include "webrtc/base/checks.h"
 #include "webrtc/base/optional.h"
+#include "webrtc/base/neverdestroyed.h"
 #include "webrtc/common_types.h"
 #include "webrtc/modules/audio_coding/codecs/cng/webrtc_cng.h"
 #include "webrtc/modules/audio_coding/codecs/g711/audio_decoder_pcm.h"
@@ -50,7 +51,8 @@
 
 // TODO(kwiberg): These factory functions should probably be moved to each
 // decoder.
-NamedDecoderConstructor decoder_constructors[] = {
+static const std::vector<NamedDecoderConstructor>& decoder_constructors() {
+ static NeverDestroyed<std::vector<NamedDecoderConstructor>> decoder_constructors = [] { return std::vector<NamedDecoderConstructor>({
     {"pcmu",
      [](const SdpAudioFormat& format, std::unique_ptr<AudioDecoder>* out) {
        if (format.clockrate_hz == 8000 && format.num_channels >= 1) {
@@ -170,7 +172,9 @@
        }
      }},
 #endif
-};
+  });}();
+  return decoder_constructors.get();
+}
 
 class BuiltinAudioDecoderFactory : public AudioDecoderFactory {
  public:
@@ -177,7 +181,7 @@
   std::vector<AudioCodecSpec> GetSupportedDecoders() override {
     // Although this looks a bit strange, it means specs need only be
     // initialized once, and that that initialization is thread-safe.
-    static std::vector<AudioCodecSpec> specs = [] {
+    static NeverDestroyed<std::vector<AudioCodecSpec>> specs = [] {
       std::vector<AudioCodecSpec> specs;
 #ifdef WEBRTC_CODEC_OPUS
       // clang-format off
@@ -210,7 +214,7 @@
   }
 
   bool IsSupportedDecoder(const SdpAudioFormat& format) override {
-    for (const auto& dc : decoder_constructors) {
+    for (const auto& dc : decoder_constructors()) {
       if (STR_CASE_CMP(format.name.c_str(), dc.name) == 0) {
         return dc.constructor(format, nullptr);
       }
@@ -220,7 +224,7 @@
 
   std::unique_ptr<AudioDecoder> MakeAudioDecoder(
       const SdpAudioFormat& format) override {
-    for (const auto& dc : decoder_constructors) {
+    for (const auto& dc : decoder_constructors()) {
       if (STR_CASE_CMP(format.name.c_str(), dc.name) == 0) {
         std::unique_ptr<AudioDecoder> decoder;
         bool ok = dc.constructor(format, &decoder);

Modified: trunk/Source/ThirdParty/libwebrtc/Source/webrtc/modules/audio_processing/beamformer/array_util.h (214287 => 214288)


--- trunk/Source/ThirdParty/libwebrtc/Source/webrtc/modules/audio_processing/beamformer/array_util.h	2017-03-23 00:27:01 UTC (rev 214287)
+++ trunk/Source/ThirdParty/libwebrtc/Source/webrtc/modules/audio_processing/beamformer/array_util.h	2017-03-23 00:57:27 UTC (rev 214288)
@@ -103,12 +103,14 @@
 
 // Helper functions to transform degrees to radians and the inverse.
 template <typename T>
-T DegreesToRadians(T angle_degrees) {
+constexpr T DegreesToRadians(T angle_degrees)
+{
   return M_PI * angle_degrees / 180;
 }
 
 template <typename T>
-T RadiansToDegrees(T angle_radians) {
+constexpr T RadiansToDegrees(T angle_radians)
+{
   return 180 * angle_radians / M_PI;
 }
 

Modified: trunk/Source/ThirdParty/libwebrtc/Source/webrtc/modules/rtp_rtcp/source/rtp_utility.cc (214287 => 214288)


--- trunk/Source/ThirdParty/libwebrtc/Source/webrtc/modules/rtp_rtcp/source/rtp_utility.cc	2017-03-23 00:27:01 UTC (rev 214287)
+++ trunk/Source/ThirdParty/libwebrtc/Source/webrtc/modules/rtp_rtcp/source/rtp_utility.cc	2017-03-23 00:57:27 UTC (rev 214288)
@@ -13,6 +13,7 @@
 #include <string.h>
 
 #include "webrtc/base/logging.h"
+#include "webrtc/base/neverdestroyed.h"
 #include "webrtc/modules/rtp_rtcp/include/rtp_cvo.h"
 #include "webrtc/modules/rtp_rtcp/source/byte_io.h"
 #include "webrtc/modules/rtp_rtcp/source/rtp_header_extensions.h"
@@ -20,17 +21,17 @@
 namespace webrtc {
 
 RtpData* NullObjectRtpData() {
-  static NullRtpData null_rtp_data;
+  static NeverDestroyed<NullRtpData> null_rtp_data;
   return &null_rtp_data;
 }
 
 RtpFeedback* NullObjectRtpFeedback() {
-  static NullRtpFeedback null_rtp_feedback;
+  static NeverDestroyed<NullRtpFeedback> null_rtp_feedback;
   return &null_rtp_feedback;
 }
 
 ReceiveStatistics* NullObjectReceiveStatistics() {
-  static NullReceiveStatistics null_receive_statistics;
+  static NeverDestroyed<NullReceiveStatistics> null_receive_statistics;
   return &null_receive_statistics;
 }
 

Modified: trunk/Source/ThirdParty/libwebrtc/Source/webrtc/system_wrappers/source/clock.cc (214287 => 214288)


--- trunk/Source/ThirdParty/libwebrtc/Source/webrtc/system_wrappers/source/clock.cc	2017-03-23 00:27:01 UTC (rev 214287)
+++ trunk/Source/ThirdParty/libwebrtc/Source/webrtc/system_wrappers/source/clock.cc	2017-03-23 00:57:27 UTC (rev 214288)
@@ -20,6 +20,7 @@
 #endif
 
 #include "webrtc/base/criticalsection.h"
+#include "webrtc/base/neverdestroyed.h"
 #include "webrtc/base/timeutils.h"
 #include "webrtc/system_wrappers/include/rw_lock_wrapper.h"
 
@@ -223,7 +224,7 @@
   }
   return g_shared_clock;
 #elif defined(WEBRTC_LINUX) || defined(WEBRTC_MAC)
-  static UnixRealTimeClock clock;
+  static NeverDestroyed<UnixRealTimeClock> clock;
   return &clock;
 #else
   return NULL;

Modified: trunk/Source/ThirdParty/libwebrtc/libwebrtc.xcodeproj/project.pbxproj (214287 => 214288)


--- trunk/Source/ThirdParty/libwebrtc/libwebrtc.xcodeproj/project.pbxproj	2017-03-23 00:27:01 UTC (rev 214287)
+++ trunk/Source/ThirdParty/libwebrtc/libwebrtc.xcodeproj/project.pbxproj	2017-03-23 00:57:27 UTC (rev 214288)
@@ -528,7 +528,6 @@
 		5C4B48391E42C06A002651C8 /* ssl_rsa.c in Sources */ = {isa = PBXBuildFile; fileRef = 5C4B47F51E42C066002651C8 /* ssl_rsa.c */; };
 		5C4B483A1E42C06A002651C8 /* ssl_session.c in Sources */ = {isa = PBXBuildFile; fileRef = 5C4B47F61E42C066002651C8 /* ssl_session.c */; };
 		5C4B483B1E42C06A002651C8 /* ssl_stat.c in Sources */ = {isa = PBXBuildFile; fileRef = 5C4B47F71E42C066002651C8 /* ssl_stat.c */; };
-		5C4B483C1E42C06A002651C8 /* ssl_test.cc in Sources */ = {isa = PBXBuildFile; fileRef = 5C4B47F81E42C066002651C8 /* ssl_test.cc */; };
 		5C4B483D1E42C06A002651C8 /* t1_enc.c in Sources */ = {isa = PBXBuildFile; fileRef = 5C4B47F91E42C066002651C8 /* t1_enc.c */; };
 		5C4B483E1E42C06A002651C8 /* t1_lib.c in Sources */ = {isa = PBXBuildFile; fileRef = 5C4B47FA1E42C066002651C8 /* t1_lib.c */; };
 		5C4B483F1E42C06A002651C8 /* tls_method.c in Sources */ = {isa = PBXBuildFile; fileRef = 5C4B47FB1E42C066002651C8 /* tls_method.c */; };
@@ -2489,6 +2488,7 @@
 		5CDD907F1E43D15C00621E92 /* mock_nonlinear_beamformer.h in Headers */ = {isa = PBXBuildFile; fileRef = 5CDD906F1E43D15C00621E92 /* mock_nonlinear_beamformer.h */; };
 		5CDD90821E43D15C00621E92 /* nonlinear_beamformer.cc in Sources */ = {isa = PBXBuildFile; fileRef = 5CDD90721E43D15C00621E92 /* nonlinear_beamformer.cc */; };
 		5CDD90831E43D15C00621E92 /* nonlinear_beamformer.h in Headers */ = {isa = PBXBuildFile; fileRef = 5CDD90731E43D15C00621E92 /* nonlinear_beamformer.h */; };
+		5CDEB3311E82110800209B14 /* neverdestroyed.h in Headers */ = {isa = PBXBuildFile; fileRef = 5CDEB3301E82110800209B14 /* neverdestroyed.h */; };
 		5CFD537C1E4BA4F500482908 /* audio_device_ios.h in Headers */ = {isa = PBXBuildFile; fileRef = 5CFD53751E4BA4F500482908 /* audio_device_ios.h */; };
 		5CFD53801E4BA4F500482908 /* audio_session_observer.h in Headers */ = {isa = PBXBuildFile; fileRef = 5CFD53791E4BA4F500482908 /* audio_session_observer.h */; };
 		5CFD53811E4BA4F500482908 /* voice_processing_audio_unit.h in Headers */ = {isa = PBXBuildFile; fileRef = 5CFD537A1E4BA4F500482908 /* voice_processing_audio_unit.h */; };
@@ -5208,6 +5208,7 @@
 		5CDD90AB1E43D52900621E92 /* aes_icm_ossl.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = aes_icm_ossl.c; path = cipher/aes_icm_ossl.c; sourceTree = "<group>"; };
 		5CDD90AC1E43D52900621E92 /* cipher.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = cipher.c; path = cipher/cipher.c; sourceTree = "<group>"; };
 		5CDD90AD1E43D52900621E92 /* null_cipher.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = null_cipher.c; path = cipher/null_cipher.c; sourceTree = "<group>"; };
+		5CDEB3301E82110800209B14 /* neverdestroyed.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = neverdestroyed.h; sourceTree = "<group>"; };
 		5CFD53751E4BA4F500482908 /* audio_device_ios.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = audio_device_ios.h; sourceTree = "<group>"; };
 		5CFD53761E4BA4F500482908 /* audio_device_ios.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = audio_device_ios.mm; sourceTree = "<group>"; };
 		5CFD53791E4BA4F500482908 /* audio_session_observer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = audio_session_observer.h; sourceTree = "<group>"; };
@@ -6687,6 +6688,7 @@
 		5C63F3041E4146D2002CA531 /* base */ = {
 			isa = PBXGroup;
 			children = (
+				5CDEB3301E82110800209B14 /* neverdestroyed.h */,
 				5CD286421E6A7B420094FDC8 /* sha1.cc */,
 				5CD286431E6A7B420094FDC8 /* sha1.h */,
 				5CD2854F1E6A62310094FDC8 /* numerics */,
@@ -10260,6 +10262,7 @@
 				5CDD8BEA1E43C2B500621E92 /* split_vq.h in Headers */,
 				5CDD84C21E43AF1300621E92 /* splitting_filter.h in Headers */,
 				5CDD83601E43257200621E92 /* sps_parser.h in Headers */,
+				5CDEB3311E82110800209B14 /* neverdestroyed.h in Headers */,
 				5CDD83631E43257200621E92 /* sps_vui_rewriter.h in Headers */,
 				5C63F88D1E416288002CA531 /* ssladapter.h in Headers */,
 				5C63F8901E416288002CA531 /* sslfingerprint.h in Headers */,
@@ -11211,7 +11214,6 @@
 				5C4B48391E42C06A002651C8 /* ssl_rsa.c in Sources */,
 				5C4B483A1E42C06A002651C8 /* ssl_session.c in Sources */,
 				5C4B483B1E42C06A002651C8 /* ssl_stat.c in Sources */,
-				5C4B483C1E42C06A002651C8 /* ssl_test.cc in Sources */,
 				5C4B46A51E42AA42002651C8 /* stack.c in Sources */,
 				5C4B483D1E42C06A002651C8 /* t1_enc.c in Sources */,
 				5C4B483E1E42C06A002651C8 /* t1_lib.c in Sources */,
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to