Changeset 218973 in webkit
- Timestamp:
- Jun 29, 2017 5:15:56 PM (7 years ago)
- Location:
- trunk/Source
- Files:
-
- 15 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r218972 r218973 1 2017-06-29 Matt Lewis <jlewis3@apple.com> 2 3 Unreviewed, rolling out r218903. 4 5 This patch and its fix cause immediate flakiness on all WK2 6 testers 7 8 Reverted changeset: 9 10 "Support PeerConnectionStates::BundlePolicy::MaxBundle when 11 setting rtc configuration" 12 https://bugs.webkit.org/show_bug.cgi?id=169389 13 http://trac.webkit.org/changeset/218903 14 1 15 2017-06-29 Matt Lewis <jlewis3@apple.com> 2 16 -
trunk/Source/WebCore/Modules/mediastream/MediaEndpointPeerConnection.cpp
r218903 r218973 603 603 } 604 604 605 boolMediaEndpointPeerConnection::setConfiguration(MediaEndpointConfiguration&& configuration)605 void MediaEndpointPeerConnection::setConfiguration(MediaEndpointConfiguration&& configuration) 606 606 { 607 607 m_mediaEndpoint->setConfiguration(WTFMove(configuration)); 608 return true;609 608 } 610 609 -
trunk/Source/WebCore/Modules/mediastream/MediaEndpointPeerConnection.h
r218903 r218973 57 57 RefPtr<RTCSessionDescription> pendingRemoteDescription() const final; 58 58 59 boolsetConfiguration(MediaEndpointConfiguration&&) final;59 void setConfiguration(MediaEndpointConfiguration&&) final; 60 60 61 61 void getStats(MediaStreamTrack*, Ref<DeferredPromise>&&) final; -
trunk/Source/WebCore/Modules/mediastream/PeerConnectionBackend.h
r218903 r218973 89 89 virtual RefPtr<RTCSessionDescription> pendingRemoteDescription() const = 0; 90 90 91 virtual boolsetConfiguration(MediaEndpointConfiguration&&) = 0;91 virtual void setConfiguration(MediaEndpointConfiguration&&) = 0; 92 92 93 93 virtual void getStats(MediaStreamTrack*, Ref<DeferredPromise>&&) = 0; -
trunk/Source/WebCore/Modules/mediastream/RTCPeerConnection.cpp
r218903 r218973 98 98 return Exception { NOT_SUPPORTED_ERR }; 99 99 100 return initializeConfiguration(WTFMove(configuration));100 return setConfiguration(WTFMove(configuration)); 101 101 } 102 102 … … 299 299 } 300 300 301 static inline std::optional<Vector<MediaEndpointConfiguration::IceServerInfo>> iceServersFromConfiguration(RTCConfiguration& configuration) 302 { 301 ExceptionOr<void> RTCPeerConnection::setConfiguration(RTCConfiguration&& configuration) 302 { 303 if (isClosed()) 304 return Exception { INVALID_STATE_ERR }; 305 303 306 Vector<MediaEndpointConfiguration::IceServerInfo> servers; 304 307 if (configuration.iceServers) { … … 306 309 for (auto& server : configuration.iceServers.value()) { 307 310 Vector<URL> serverURLs; 308 WTF::switchOn(server.urls, [&serverURLs] (const String& string) { 309 serverURLs.reserveInitialCapacity(1); 310 serverURLs.uncheckedAppend(URL { URL { }, string }); 311 }, [&serverURLs] (const Vector<String>& vector) { 312 serverURLs.reserveInitialCapacity(vector.size()); 313 for (auto& string : vector) 311 WTF::switchOn(server.urls, 312 [&serverURLs] (const String& string) { 313 serverURLs.reserveInitialCapacity(1); 314 314 serverURLs.uncheckedAppend(URL { URL { }, string }); 315 }); 315 }, 316 [&serverURLs] (const Vector<String>& vector) { 317 serverURLs.reserveInitialCapacity(vector.size()); 318 for (auto& string : vector) 319 serverURLs.uncheckedAppend(URL { URL { }, string }); 320 } 321 ); 316 322 for (auto& serverURL : serverURLs) { 317 323 if (!(serverURL.protocolIs("turn") || serverURL.protocolIs("turns") || serverURL.protocolIs("stun"))) 318 return std::nullopt;324 return Exception { INVALID_ACCESS_ERR }; 319 325 } 320 326 servers.uncheckedAppend({ WTFMove(serverURLs), server.credential, server.username }); 321 327 } 322 328 } 323 return servers; 324 } 325 326 ExceptionOr<void> RTCPeerConnection::initializeConfiguration(RTCConfiguration&& configuration) 327 { 328 auto servers = iceServersFromConfiguration(configuration); 329 if (!servers) 330 return Exception { INVALID_ACCESS_ERR }; 331 332 // FIXME: https://bugs.webkit.org/show_bug.cgi?id=173938 333 // Also decide whether to report an exception or output a message in the console log if setting configuration fails. 334 m_backend->setConfiguration({ WTFMove(servers.value()), configuration.iceTransportPolicy, configuration.bundlePolicy, configuration.iceCandidatePoolSize }); 335 336 m_configuration = WTFMove(configuration); 337 return { }; 338 } 339 340 ExceptionOr<void> RTCPeerConnection::setConfiguration(RTCConfiguration&& configuration) 341 { 342 if (isClosed()) 343 return Exception { INVALID_STATE_ERR }; 344 345 auto servers = iceServersFromConfiguration(configuration); 346 if (!servers) 347 return Exception { INVALID_ACCESS_ERR }; 348 349 // FIXME: https://bugs.webkit.org/show_bug.cgi?id=173938 350 // Also decide whether to report an exception or output a message in the console log if setting configuration fails. 351 m_backend->setConfiguration({ WTFMove(servers.value()), configuration.iceTransportPolicy, configuration.bundlePolicy, configuration.iceCandidatePoolSize }); 329 330 m_backend->setConfiguration({ WTFMove(servers), configuration.iceTransportPolicy, configuration.bundlePolicy, configuration.iceCandidatePoolSize }); 352 331 m_configuration = WTFMove(configuration); 353 332 return { }; -
trunk/Source/WebCore/Modules/mediastream/RTCPeerConnection.h
r218903 r218973 154 154 RTCPeerConnection(ScriptExecutionContext&); 155 155 156 ExceptionOr<void> initializeConfiguration(RTCConfiguration&&);157 156 Ref<RTCRtpTransceiver> completeAddTransceiver(Ref<RTCRtpSender>&&, const RTCRtpTransceiverInit&, const String& trackId, const String& trackKind); 158 157 -
trunk/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp
r218903 r218973 60 60 : m_peerConnectionBackend(peerConnection) 61 61 , m_peerConnectionFactory(*client.factory()) 62 , m_backend(client.createPeerConnection(*this)) 62 63 , m_createSessionDescriptionObserver(*this) 63 64 , m_setLocalSessionDescriptionObserver(*this) … … 65 66 , m_statsLogTimer(*this, &LibWebRTCMediaEndpoint::gatherStatsForLogging) 66 67 { 68 ASSERT(m_backend); 67 69 ASSERT(client.factory()); 68 }69 70 bool LibWebRTCMediaEndpoint::setConfiguration(LibWebRTCProvider& client, webrtc::PeerConnectionInterface::RTCConfiguration&& configuration)71 {72 if (!m_backend) {73 m_backend = client.createPeerConnection(*this, WTFMove(configuration));74 return !!m_backend;75 }76 return m_backend->SetConfiguration(WTFMove(configuration));77 70 } 78 71 … … 774 767 void LibWebRTCMediaEndpoint::stop() 775 768 { 776 if (!m_backend)777 return;778 779 769 stopLoggingStats(); 780 770 771 ASSERT(m_backend); 781 772 m_backend->Close(); 782 773 m_backend = nullptr; -
trunk/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.h
r218903 r218973 63 63 virtual ~LibWebRTCMediaEndpoint() { } 64 64 65 bool setConfiguration(LibWebRTCProvider&, webrtc::PeerConnectionInterface::RTCConfiguration&&);66 67 65 webrtc::PeerConnectionInterface& backend() const { ASSERT(m_backend); return *m_backend.get(); } 68 66 void doSetLocalDescription(RTCSessionDescription&); -
trunk/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp
r218972 r218973 72 72 } 73 73 74 static inline webrtc::PeerConnectionInterface::BundlePolicy bundlePolicyfromConfiguration(const MediaEndpointConfiguration& configuration)75 {76 switch (configuration.bundlePolicy) {77 case RTCBundlePolicy::MaxCompat:78 return webrtc::PeerConnectionInterface::kBundlePolicyMaxCompat;79 case RTCBundlePolicy::MaxBundle:80 return webrtc::PeerConnectionInterface::kBundlePolicyMaxBundle;81 case RTCBundlePolicy::Balanced:82 return webrtc::PeerConnectionInterface::kBundlePolicyBalanced;83 }84 }85 86 static inline webrtc::PeerConnectionInterface::IceTransportsType iceTransportPolicyfromConfiguration(const MediaEndpointConfiguration& configuration)87 {88 switch (configuration.iceTransportPolicy) {89 case RTCIceTransportPolicy::Relay:90 return webrtc::PeerConnectionInterface::kRelay;91 case RTCIceTransportPolicy::All:92 return webrtc::PeerConnectionInterface::kAll;93 }94 }95 96 74 static webrtc::PeerConnectionInterface::RTCConfiguration configurationFromMediaEndpointConfiguration(MediaEndpointConfiguration&& configuration) 97 75 { 98 76 webrtc::PeerConnectionInterface::RTCConfiguration rtcConfiguration; 99 77 100 rtcConfiguration.type = iceTransportPolicyfromConfiguration(configuration); 101 rtcConfiguration.bundle_policy = bundlePolicyfromConfiguration(configuration); 78 if (configuration.iceTransportPolicy == RTCIceTransportPolicy::Relay) 79 rtcConfiguration.type = webrtc::PeerConnectionInterface::kRelay; 80 81 // FIXME: Support PeerConnectionStates::BundlePolicy::MaxBundle. 82 // LibWebRTC does not like it and will fail to set any configuration field otherwise. 83 // See https://bugs.webkit.org/show_bug.cgi?id=169389. 84 85 if (configuration.bundlePolicy == RTCBundlePolicy::MaxCompat) 86 rtcConfiguration.bundle_policy = webrtc::PeerConnectionInterface::kBundlePolicyMaxCompat; 102 87 103 88 for (auto& server : configuration.iceServers) { … … 116 101 } 117 102 118 boolLibWebRTCPeerConnectionBackend::setConfiguration(MediaEndpointConfiguration&& configuration)119 { 120 return m_endpoint->setConfiguration(libWebRTCProvider(m_peerConnection),configurationFromMediaEndpointConfiguration(WTFMove(configuration)));103 void LibWebRTCPeerConnectionBackend::setConfiguration(MediaEndpointConfiguration&& configuration) 104 { 105 m_endpoint->backend().SetConfiguration(configurationFromMediaEndpointConfiguration(WTFMove(configuration))); 121 106 } 122 107 -
trunk/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.h
r218903 r218973 61 61 void doStop() final; 62 62 std::unique_ptr<RTCDataChannelHandler> createDataChannelHandler(const String&, const RTCDataChannelInit&) final; 63 boolsetConfiguration(MediaEndpointConfiguration&&) final;63 void setConfiguration(MediaEndpointConfiguration&&) final; 64 64 void getStats(MediaStreamTrack*, Ref<DeferredPromise>&&) final; 65 65 Ref<RTCRtpReceiver> createReceiver(const String& transceiverMid, const String& trackKind, const String& trackId) final; -
trunk/Source/WebCore/platform/mediastream/libwebrtc/LibWebRTCProvider.cpp
r218903 r218973 169 169 } 170 170 171 static rtc::scoped_refptr<webrtc::PeerConnectionInterface> createActualPeerConnection(webrtc::PeerConnectionObserver& observer, std::unique_ptr<cricket::BasicPortAllocator>&& portAllocator , webrtc::PeerConnectionInterface::RTCConfiguration&& configuration)171 static rtc::scoped_refptr<webrtc::PeerConnectionInterface> createActualPeerConnection(webrtc::PeerConnectionObserver& observer, std::unique_ptr<cricket::BasicPortAllocator>&& portAllocator) 172 172 { 173 173 ASSERT(staticFactoryAndThreads().factory); 174 174 175 return staticFactoryAndThreads().factory->CreatePeerConnection(configuration, WTFMove(portAllocator), nullptr, &observer); 176 } 177 178 rtc::scoped_refptr<webrtc::PeerConnectionInterface> LibWebRTCProvider::createPeerConnection(webrtc::PeerConnectionObserver& observer, webrtc::PeerConnectionInterface::RTCConfiguration&& configuration) 175 webrtc::PeerConnectionInterface::RTCConfiguration config; 176 // FIXME: Add a default configuration. 177 return staticFactoryAndThreads().factory->CreatePeerConnection(config, WTFMove(portAllocator), nullptr, &observer); 178 } 179 180 rtc::scoped_refptr<webrtc::PeerConnectionInterface> LibWebRTCProvider::createPeerConnection(webrtc::PeerConnectionObserver& observer) 179 181 { 180 182 // Default WK1 implementation. … … 186 188 ASSERT(staticFactoryAndThreads().networkThreadWithSocketServer); 187 189 188 return createActualPeerConnection(observer, nullptr , WTFMove(configuration));189 } 190 191 rtc::scoped_refptr<webrtc::PeerConnectionInterface> LibWebRTCProvider::createPeerConnection(webrtc::PeerConnectionObserver& observer, rtc::NetworkManager& networkManager, rtc::PacketSocketFactory& packetSocketFactory , webrtc::PeerConnectionInterface::RTCConfiguration&& configuration)190 return createActualPeerConnection(observer, nullptr); 191 } 192 193 rtc::scoped_refptr<webrtc::PeerConnectionInterface> LibWebRTCProvider::createPeerConnection(webrtc::PeerConnectionObserver& observer, rtc::NetworkManager& networkManager, rtc::PacketSocketFactory& packetSocketFactory) 192 194 { 193 195 ASSERT(!staticFactoryAndThreads().networkThreadWithSocketServer); … … 205 207 }); 206 208 207 return createActualPeerConnection(observer, WTFMove(portAllocator) , WTFMove(configuration));209 return createActualPeerConnection(observer, WTFMove(portAllocator)); 208 210 } 209 211 -
trunk/Source/WebCore/platform/mediastream/libwebrtc/LibWebRTCProvider.h
r218903 r218973 53 53 static bool webRTCAvailable(); 54 54 #if USE(LIBWEBRTC) 55 WEBCORE_EXPORT virtual rtc::scoped_refptr<webrtc::PeerConnectionInterface> createPeerConnection(webrtc::PeerConnectionObserver& , webrtc::PeerConnectionInterface::RTCConfiguration&&);55 WEBCORE_EXPORT virtual rtc::scoped_refptr<webrtc::PeerConnectionInterface> createPeerConnection(webrtc::PeerConnectionObserver&); 56 56 57 57 WEBCORE_EXPORT webrtc::PeerConnectionFactoryInterface* factory(); … … 70 70 71 71 protected: 72 WEBCORE_EXPORT rtc::scoped_refptr<webrtc::PeerConnectionInterface> createPeerConnection(webrtc::PeerConnectionObserver&, rtc::NetworkManager&, rtc::PacketSocketFactory& , webrtc::PeerConnectionInterface::RTCConfiguration&&);72 WEBCORE_EXPORT rtc::scoped_refptr<webrtc::PeerConnectionInterface> createPeerConnection(webrtc::PeerConnectionObserver&, rtc::NetworkManager&, rtc::PacketSocketFactory&); 73 73 74 74 bool m_enableEnumeratingAllNetworkInterfaces { false }; -
trunk/Source/WebKit2/ChangeLog
r218968 r218973 1 2017-06-29 Matt Lewis <jlewis3@apple.com> 2 3 Unreviewed, rolling out r218903. 4 5 This patch and its fix cause immediate flakiness on all WK2 6 testers 7 8 Reverted changeset: 9 10 "Support PeerConnectionStates::BundlePolicy::MaxBundle when 11 setting rtc configuration" 12 https://bugs.webkit.org/show_bug.cgi?id=169389 13 http://trac.webkit.org/changeset/218903 14 1 15 2017-06-29 Chris Dumez <cdumez@apple.com> 2 16 -
trunk/Source/WebKit2/WebProcess/Network/webrtc/LibWebRTCProvider.cpp
r218903 r218973 35 35 namespace WebKit { 36 36 37 rtc::scoped_refptr<webrtc::PeerConnectionInterface> LibWebRTCProvider::createPeerConnection(webrtc::PeerConnectionObserver& observer , webrtc::PeerConnectionInterface::RTCConfiguration&& configuration)37 rtc::scoped_refptr<webrtc::PeerConnectionInterface> LibWebRTCProvider::createPeerConnection(webrtc::PeerConnectionObserver& observer) 38 38 { 39 return WebCore::LibWebRTCProvider::createPeerConnection(observer, WebProcess::singleton().libWebRTCNetwork().monitor(), WebProcess::singleton().libWebRTCNetwork().socketFactory() , WTFMove(configuration));39 return WebCore::LibWebRTCProvider::createPeerConnection(observer, WebProcess::singleton().libWebRTCNetwork().monitor(), WebProcess::singleton().libWebRTCNetwork().socketFactory()); 40 40 } 41 41 -
trunk/Source/WebKit2/WebProcess/Network/webrtc/LibWebRTCProvider.h
r218903 r218973 37 37 38 38 private: 39 rtc::scoped_refptr<webrtc::PeerConnectionInterface> createPeerConnection(webrtc::PeerConnectionObserver& , webrtc::PeerConnectionInterface::RTCConfiguration&&) final;39 rtc::scoped_refptr<webrtc::PeerConnectionInterface> createPeerConnection(webrtc::PeerConnectionObserver&) final; 40 40 }; 41 41 #else
Note: See TracChangeset
for help on using the changeset viewer.