Changeset 218973 in webkit


Ignore:
Timestamp:
Jun 29, 2017 5:15:56 PM (7 years ago)
Author:
Matt Lewis
Message:

Unreviewed, rolling out r218903.

This patch and its fix cause immediate flakiness on all WK2
testers

Reverted changeset:

"Support PeerConnectionStates::BundlePolicy::MaxBundle when
setting rtc configuration"
https://bugs.webkit.org/show_bug.cgi?id=169389
http://trac.webkit.org/changeset/218903

Location:
trunk/Source
Files:
15 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r218972 r218973  
     12017-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
    1152017-06-29  Matt Lewis  <jlewis3@apple.com>
    216
  • trunk/Source/WebCore/Modules/mediastream/MediaEndpointPeerConnection.cpp

    r218903 r218973  
    603603}
    604604
    605 bool MediaEndpointPeerConnection::setConfiguration(MediaEndpointConfiguration&& configuration)
     605void MediaEndpointPeerConnection::setConfiguration(MediaEndpointConfiguration&& configuration)
    606606{
    607607    m_mediaEndpoint->setConfiguration(WTFMove(configuration));
    608     return true;
    609608}
    610609
  • trunk/Source/WebCore/Modules/mediastream/MediaEndpointPeerConnection.h

    r218903 r218973  
    5757    RefPtr<RTCSessionDescription> pendingRemoteDescription() const final;
    5858
    59     bool setConfiguration(MediaEndpointConfiguration&&) final;
     59    void setConfiguration(MediaEndpointConfiguration&&) final;
    6060
    6161    void getStats(MediaStreamTrack*, Ref<DeferredPromise>&&) final;
  • trunk/Source/WebCore/Modules/mediastream/PeerConnectionBackend.h

    r218903 r218973  
    8989    virtual RefPtr<RTCSessionDescription> pendingRemoteDescription() const = 0;
    9090
    91     virtual bool setConfiguration(MediaEndpointConfiguration&&) = 0;
     91    virtual void setConfiguration(MediaEndpointConfiguration&&) = 0;
    9292
    9393    virtual void getStats(MediaStreamTrack*, Ref<DeferredPromise>&&) = 0;
  • trunk/Source/WebCore/Modules/mediastream/RTCPeerConnection.cpp

    r218903 r218973  
    9898        return Exception { NOT_SUPPORTED_ERR };
    9999
    100     return initializeConfiguration(WTFMove(configuration));
     100    return setConfiguration(WTFMove(configuration));
    101101}
    102102
     
    299299}
    300300
    301 static inline std::optional<Vector<MediaEndpointConfiguration::IceServerInfo>> iceServersFromConfiguration(RTCConfiguration& configuration)
    302 {
     301ExceptionOr<void> RTCPeerConnection::setConfiguration(RTCConfiguration&& configuration)
     302{
     303    if (isClosed())
     304        return Exception { INVALID_STATE_ERR };
     305
    303306    Vector<MediaEndpointConfiguration::IceServerInfo> servers;
    304307    if (configuration.iceServers) {
     
    306309        for (auto& server : configuration.iceServers.value()) {
    307310            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);
    314314                    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            );
    316322            for (auto& serverURL : serverURLs) {
    317323                if (!(serverURL.protocolIs("turn") || serverURL.protocolIs("turns") || serverURL.protocolIs("stun")))
    318                     return std::nullopt;
     324                    return Exception { INVALID_ACCESS_ERR };
    319325            }
    320326            servers.uncheckedAppend({ WTFMove(serverURLs), server.credential, server.username });
    321327        }
    322328    }
    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 });
    352331    m_configuration = WTFMove(configuration);
    353332    return { };
  • trunk/Source/WebCore/Modules/mediastream/RTCPeerConnection.h

    r218903 r218973  
    154154    RTCPeerConnection(ScriptExecutionContext&);
    155155
    156     ExceptionOr<void> initializeConfiguration(RTCConfiguration&&);
    157156    Ref<RTCRtpTransceiver> completeAddTransceiver(Ref<RTCRtpSender>&&, const RTCRtpTransceiverInit&, const String& trackId, const String& trackKind);
    158157
  • trunk/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp

    r218903 r218973  
    6060    : m_peerConnectionBackend(peerConnection)
    6161    , m_peerConnectionFactory(*client.factory())
     62    , m_backend(client.createPeerConnection(*this))
    6263    , m_createSessionDescriptionObserver(*this)
    6364    , m_setLocalSessionDescriptionObserver(*this)
     
    6566    , m_statsLogTimer(*this, &LibWebRTCMediaEndpoint::gatherStatsForLogging)
    6667{
     68    ASSERT(m_backend);
    6769    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));
    7770}
    7871
     
    774767void LibWebRTCMediaEndpoint::stop()
    775768{
    776     if (!m_backend)
    777         return;
    778 
    779769    stopLoggingStats();
    780770
     771    ASSERT(m_backend);
    781772    m_backend->Close();
    782773    m_backend = nullptr;
  • trunk/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.h

    r218903 r218973  
    6363    virtual ~LibWebRTCMediaEndpoint() { }
    6464
    65     bool setConfiguration(LibWebRTCProvider&, webrtc::PeerConnectionInterface::RTCConfiguration&&);
    66 
    6765    webrtc::PeerConnectionInterface& backend() const { ASSERT(m_backend); return *m_backend.get(); }
    6866    void doSetLocalDescription(RTCSessionDescription&);
  • trunk/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp

    r218972 r218973  
    7272}
    7373
    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 
    9674static webrtc::PeerConnectionInterface::RTCConfiguration configurationFromMediaEndpointConfiguration(MediaEndpointConfiguration&& configuration)
    9775{
    9876    webrtc::PeerConnectionInterface::RTCConfiguration rtcConfiguration;
    9977
    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;
    10287
    10388    for (auto& server : configuration.iceServers) {
     
    116101}
    117102
    118 bool LibWebRTCPeerConnectionBackend::setConfiguration(MediaEndpointConfiguration&& configuration)
    119 {
    120     return m_endpoint->setConfiguration(libWebRTCProvider(m_peerConnection), configurationFromMediaEndpointConfiguration(WTFMove(configuration)));
     103void LibWebRTCPeerConnectionBackend::setConfiguration(MediaEndpointConfiguration&& configuration)
     104{
     105    m_endpoint->backend().SetConfiguration(configurationFromMediaEndpointConfiguration(WTFMove(configuration)));
    121106}
    122107
  • trunk/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.h

    r218903 r218973  
    6161    void doStop() final;
    6262    std::unique_ptr<RTCDataChannelHandler> createDataChannelHandler(const String&, const RTCDataChannelInit&) final;
    63     bool setConfiguration(MediaEndpointConfiguration&&) final;
     63    void setConfiguration(MediaEndpointConfiguration&&) final;
    6464    void getStats(MediaStreamTrack*, Ref<DeferredPromise>&&) final;
    6565    Ref<RTCRtpReceiver> createReceiver(const String& transceiverMid, const String& trackKind, const String& trackId) final;
  • trunk/Source/WebCore/platform/mediastream/libwebrtc/LibWebRTCProvider.cpp

    r218903 r218973  
    169169}
    170170
    171 static rtc::scoped_refptr<webrtc::PeerConnectionInterface> createActualPeerConnection(webrtc::PeerConnectionObserver& observer, std::unique_ptr<cricket::BasicPortAllocator>&& portAllocator, webrtc::PeerConnectionInterface::RTCConfiguration&& configuration)
     171static rtc::scoped_refptr<webrtc::PeerConnectionInterface> createActualPeerConnection(webrtc::PeerConnectionObserver& observer, std::unique_ptr<cricket::BasicPortAllocator>&& portAllocator)
    172172{
    173173    ASSERT(staticFactoryAndThreads().factory);
    174174
    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
     180rtc::scoped_refptr<webrtc::PeerConnectionInterface> LibWebRTCProvider::createPeerConnection(webrtc::PeerConnectionObserver& observer)
    179181{
    180182    // Default WK1 implementation.
     
    186188    ASSERT(staticFactoryAndThreads().networkThreadWithSocketServer);
    187189
    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
     193rtc::scoped_refptr<webrtc::PeerConnectionInterface> LibWebRTCProvider::createPeerConnection(webrtc::PeerConnectionObserver& observer, rtc::NetworkManager& networkManager, rtc::PacketSocketFactory& packetSocketFactory)
    192194{
    193195    ASSERT(!staticFactoryAndThreads().networkThreadWithSocketServer);
     
    205207    });
    206208
    207     return createActualPeerConnection(observer, WTFMove(portAllocator), WTFMove(configuration));
     209    return createActualPeerConnection(observer, WTFMove(portAllocator));
    208210}
    209211
  • trunk/Source/WebCore/platform/mediastream/libwebrtc/LibWebRTCProvider.h

    r218903 r218973  
    5353    static bool webRTCAvailable();
    5454#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&);
    5656
    5757    WEBCORE_EXPORT webrtc::PeerConnectionFactoryInterface* factory();
     
    7070
    7171protected:
    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&);
    7373
    7474    bool m_enableEnumeratingAllNetworkInterfaces { false };
  • trunk/Source/WebKit2/ChangeLog

    r218968 r218973  
     12017-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
    1152017-06-29  Chris Dumez  <cdumez@apple.com>
    216
  • trunk/Source/WebKit2/WebProcess/Network/webrtc/LibWebRTCProvider.cpp

    r218903 r218973  
    3535namespace WebKit {
    3636
    37 rtc::scoped_refptr<webrtc::PeerConnectionInterface> LibWebRTCProvider::createPeerConnection(webrtc::PeerConnectionObserver& observer, webrtc::PeerConnectionInterface::RTCConfiguration&& configuration)
     37rtc::scoped_refptr<webrtc::PeerConnectionInterface> LibWebRTCProvider::createPeerConnection(webrtc::PeerConnectionObserver& observer)
    3838{
    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());
    4040}
    4141
  • trunk/Source/WebKit2/WebProcess/Network/webrtc/LibWebRTCProvider.h

    r218903 r218973  
    3737
    3838private:
    39     rtc::scoped_refptr<webrtc::PeerConnectionInterface> createPeerConnection(webrtc::PeerConnectionObserver&, webrtc::PeerConnectionInterface::RTCConfiguration&&) final;
     39    rtc::scoped_refptr<webrtc::PeerConnectionInterface> createPeerConnection(webrtc::PeerConnectionObserver&) final;
    4040};
    4141#else
Note: See TracChangeset for help on using the changeset viewer.