Title: [216884] trunk/Source/WebCore
Revision
216884
Author
jer.no...@apple.com
Date
2017-05-15 15:34:15 -0700 (Mon, 15 May 2017)

Log Message

Only ever initialize LibWebRTCProvider's staticFactoryAndThreads() factories once.
https://bugs.webkit.org/show_bug.cgi?id=172047

Reviewed by Youenn Fablet.

Wrap the initilization of the factories contained in staticFactoryAndThreads() in a call_once to ensure
new factories aren't created every time it's called.

* platform/mediastream/libwebrtc/LibWebRTCProvider.cpp:
(WebCore::staticFactoryAndThreads):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (216883 => 216884)


--- trunk/Source/WebCore/ChangeLog	2017-05-15 22:32:27 UTC (rev 216883)
+++ trunk/Source/WebCore/ChangeLog	2017-05-15 22:34:15 UTC (rev 216884)
@@ -1,3 +1,16 @@
+2017-05-15  Jer Noble  <jer.no...@apple.com>
+
+        Only ever initialize LibWebRTCProvider's staticFactoryAndThreads() factories once.
+        https://bugs.webkit.org/show_bug.cgi?id=172047
+
+        Reviewed by Youenn Fablet.
+
+        Wrap the initilization of the factories contained in staticFactoryAndThreads() in a call_once to ensure
+        new factories aren't created every time it's called.
+
+        * platform/mediastream/libwebrtc/LibWebRTCProvider.cpp:
+        (WebCore::staticFactoryAndThreads):
+
 2017-05-15  Joseph Pecoraro  <pecor...@apple.com>
 
         Web Inspector: CRASH seen with DOM.setOuterHTML when there is no documentElement

Modified: trunk/Source/WebCore/platform/mediastream/libwebrtc/LibWebRTCProvider.cpp (216883 => 216884)


--- trunk/Source/WebCore/platform/mediastream/libwebrtc/LibWebRTCProvider.cpp	2017-05-15 22:32:27 UTC (rev 216883)
+++ trunk/Source/WebCore/platform/mediastream/libwebrtc/LibWebRTCProvider.cpp	2017-05-15 22:34:15 UTC (rev 216884)
@@ -61,8 +61,11 @@
 {
     static NeverDestroyed<PeerConnectionFactoryAndThreads> factoryAndThreads;
 #if PLATFORM(COCOA)
-    factoryAndThreads.get().encoderFactoryGetter = []() -> std::unique_ptr<cricket::WebRtcVideoEncoderFactory> { return std::make_unique<VideoToolboxVideoEncoderFactory>(); };
-    factoryAndThreads.get().decoderFactoryGetter = []() -> std::unique_ptr<cricket::WebRtcVideoDecoderFactory> { return std::make_unique<webrtc::VideoToolboxVideoDecoderFactory>(); };
+    static std::once_flag once;
+    std::call_once(once, [] {
+        factoryAndThreads.get().encoderFactoryGetter = []() -> std::unique_ptr<cricket::WebRtcVideoEncoderFactory> { return std::make_unique<VideoToolboxVideoEncoderFactory>(); };
+        factoryAndThreads.get().decoderFactoryGetter = []() -> std::unique_ptr<cricket::WebRtcVideoDecoderFactory> { return std::make_unique<webrtc::VideoToolboxVideoDecoderFactory>(); };
+    });
 #endif
     return factoryAndThreads.get();
 }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to