WebRTC: Implement MediaEndpointPeerConnection::setConfiguration()
authoradam.bergkvist@ericsson.com <adam.bergkvist@ericsson.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 30 Jun 2016 04:49:26 +0000 (04:49 +0000)
committeradam.bergkvist@ericsson.com <adam.bergkvist@ericsson.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 30 Jun 2016 04:49:26 +0000 (04:49 +0000)
https://bugs.webkit.org/show_bug.cgi?id=159254

Reviewed by Eric Carlson.

Source/WebCore:

Implement MediaEndpointPeerConnection::setConfiguration() which is the
MediaEndpointPeerConnection implementation of RTCPeerConnection.setConfiguration() [1].

[1] https://w3c.github.io/webrtc-pc/archives/20160513/webrtc.html#dom-rtcpeerconnection-setconfiguration

Testing: Updated existing test.

* Modules/mediastream/MediaEndpointPeerConnection.cpp:
(WebCore::MediaEndpointPeerConnection::setConfiguration):
Implemented.
* Modules/mediastream/RTCConfiguration.cpp:
(WebCore::RTCConfiguration::initialize):
* Modules/mediastream/RTCConfiguration.h:
Use shared enums.
* Modules/mediastream/RTCConfiguration.idl:
Remove 'None'/'Public' IceTransportPolicy enum value (removed from WebRTC 1.0).
* platform/mediastream/MediaEndpointConfiguration.cpp:
(WebCore::MediaEndpointConfiguration::MediaEndpointConfiguration):
* platform/mediastream/MediaEndpointConfiguration.h:
Use shared enums.
(WebCore::MediaEndpointConfiguration::create):
* platform/mediastream/PeerConnectionStates.h: Renamed from Source/WebCore/Modules/mediastream/PeerConnectionStates.h.
Make shared enums accessible to platform objects (currently MediaEndpointConfiguration).

LayoutTests:

Test configuring an RTCPeerConnection object via the constructor and setConfiguration() and
check the resulting configuration with getConfiguration().

* fast/mediastream/RTCPeerConnection-getConfiguration-expected.txt:
* fast/mediastream/RTCPeerConnection-getConfiguration.html:
Remove 'requestIdentity' tests (dictionary member removed from WebRTC 1.0). Add tests for
'bundlePolicy'.
* platform/gtk/TestExpectations:
Unskip above test.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@202671 268f45cc-cd09-0410-ab3c-d52691b4dbfc

12 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/mediastream/RTCPeerConnection-getConfiguration-expected.txt
LayoutTests/fast/mediastream/RTCPeerConnection-getConfiguration.html
LayoutTests/platform/gtk/TestExpectations
Source/WebCore/ChangeLog
Source/WebCore/Modules/mediastream/MediaEndpointPeerConnection.cpp
Source/WebCore/Modules/mediastream/RTCConfiguration.cpp
Source/WebCore/Modules/mediastream/RTCConfiguration.h
Source/WebCore/Modules/mediastream/RTCConfiguration.idl
Source/WebCore/platform/mediastream/MediaEndpointConfiguration.cpp
Source/WebCore/platform/mediastream/MediaEndpointConfiguration.h
Source/WebCore/platform/mediastream/PeerConnectionStates.h [moved from Source/WebCore/Modules/mediastream/PeerConnectionStates.h with 91% similarity]

index 76c932e..b5fa0f7 100644 (file)
@@ -1,3 +1,20 @@
+2016-06-29  Adam Bergkvist  <adam.bergkvist@ericsson.com>
+
+        WebRTC: Implement MediaEndpointPeerConnection::setConfiguration()
+        https://bugs.webkit.org/show_bug.cgi?id=159254
+
+        Reviewed by Eric Carlson.
+
+        Test configuring an RTCPeerConnection object via the constructor and setConfiguration() and
+        check the resulting configuration with getConfiguration().
+
+        * fast/mediastream/RTCPeerConnection-getConfiguration-expected.txt:
+        * fast/mediastream/RTCPeerConnection-getConfiguration.html:
+        Remove 'requestIdentity' tests (dictionary member removed from WebRTC 1.0). Add tests for
+        'bundlePolicy'.
+        * platform/gtk/TestExpectations:
+        Unskip above test.
+
 2016-06-29  Benjamin Poulain  <bpoulain@apple.com>
 
         [JSC] Minor TypedArray fixes
index 9be5ccc..455952b 100644 (file)
@@ -1,17 +1,17 @@
-Tests RTCPeerConnection getConfiguration.
+Tests RTCPeerConnection get/setConfiguration.
 
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 
 
 PASS iceServers.length is 1
-PASS configuration.iceTransports is "all"
-PASS configuration.requestIdentity is "ifconfigured"
+PASS configuration.iceTransportPolicy is "all"
+PASS configuration.bundlePolicy is "balanced"
 PASS iceServers[i].username is ""
 PASS iceServers[i].credential is ""
 PASS urls[j] is "stun:foo.com"
 PASS iceServers.length is 2
-PASS configuration.iceTransports is "all"
-PASS configuration.requestIdentity is "ifconfigured"
+PASS configuration.iceTransportPolicy is "all"
+PASS configuration.bundlePolicy is "balanced"
 PASS iceServers[i].username is "user"
 PASS iceServers[i].credential is "x"
 PASS urls[j] is "turn:foo.com"
@@ -19,8 +19,8 @@ PASS iceServers[i].username is "user2"
 PASS iceServers[i].credential is "x"
 PASS urls[j] is "stun:bar.com"
 PASS iceServers.length is 2
-PASS configuration.iceTransports is "all"
-PASS configuration.requestIdentity is "ifconfigured"
+PASS configuration.iceTransportPolicy is "all"
+PASS configuration.bundlePolicy is "balanced"
 PASS iceServers[i].username is "user"
 PASS iceServers[i].credential is "x"
 PASS urls[j] is "turn:foo.com"
@@ -30,14 +30,20 @@ PASS urls[j] is "stun:bar.com"
 PASS urls[j] is "turn:foo.com"
 PASS urls[j] is "turn:foo2.com"
 PASS iceServers.length is 1
-PASS configuration.iceTransports is "relay"
-PASS configuration.requestIdentity is "no"
+PASS configuration.iceTransportPolicy is "relay"
+PASS configuration.bundlePolicy is "balanced"
+PASS iceServers[i].username is ""
+PASS iceServers[i].credential is ""
+PASS urls[j] is "stun:foo.com"
+PASS iceServers.length is 1
+PASS configuration.iceTransportPolicy is "relay"
+PASS configuration.bundlePolicy is "max-compat"
 PASS iceServers[i].username is ""
 PASS iceServers[i].credential is ""
 PASS urls[j] is "stun:foo.com"
 PASS iceServers.length is 2
-PASS configuration.iceTransports is "none"
-PASS configuration.requestIdentity is "yes"
+PASS configuration.iceTransportPolicy is "relay"
+PASS configuration.bundlePolicy is "max-bundle"
 PASS iceServers[i].username is "user"
 PASS iceServers[i].credential is "x"
 PASS urls[j] is "turn:foo.com"
@@ -47,11 +53,54 @@ PASS urls[j] is "stun:bar.com"
 PASS urls[j] is "turn:foo.com"
 PASS urls[j] is "turn:foo2.com"
 PASS iceServers.length is 1
-PASS configuration.iceTransports is "all"
-PASS configuration.requestIdentity is "ifconfigured"
+PASS configuration.iceTransportPolicy is "all"
+PASS configuration.bundlePolicy is "balanced"
 PASS iceServers[i].username is ""
 PASS iceServers[i].credential is ""
 PASS urls[j] is "stun:foo.com"
+PASS iceServers.length is 2
+PASS configuration.iceTransportPolicy is "all"
+PASS configuration.bundlePolicy is "balanced"
+PASS iceServers[i].username is "user"
+PASS iceServers[i].credential is "x"
+PASS urls[j] is "turn:foo.com"
+PASS iceServers[i].username is "user2"
+PASS iceServers[i].credential is "x"
+PASS urls[j] is "stun:bar.com"
+PASS iceServers.length is 2
+PASS configuration.iceTransportPolicy is "all"
+PASS configuration.bundlePolicy is "balanced"
+PASS iceServers[i].username is "user"
+PASS iceServers[i].credential is "x"
+PASS urls[j] is "turn:foo.com"
+PASS iceServers[i].username is "user2"
+PASS iceServers[i].credential is "x"
+PASS urls[j] is "stun:bar.com"
+PASS urls[j] is "turn:foo.com"
+PASS urls[j] is "turn:foo2.com"
+PASS iceServers.length is 1
+PASS configuration.iceTransportPolicy is "relay"
+PASS configuration.bundlePolicy is "balanced"
+PASS iceServers[i].username is ""
+PASS iceServers[i].credential is ""
+PASS urls[j] is "stun:foo.com"
+PASS iceServers.length is 1
+PASS configuration.iceTransportPolicy is "relay"
+PASS configuration.bundlePolicy is "max-compat"
+PASS iceServers[i].username is ""
+PASS iceServers[i].credential is ""
+PASS urls[j] is "stun:foo.com"
+PASS iceServers.length is 2
+PASS configuration.iceTransportPolicy is "relay"
+PASS configuration.bundlePolicy is "max-bundle"
+PASS iceServers[i].username is "user"
+PASS iceServers[i].credential is "x"
+PASS urls[j] is "turn:foo.com"
+PASS iceServers[i].username is "user2"
+PASS iceServers[i].credential is "x"
+PASS urls[j] is "stun:bar.com"
+PASS urls[j] is "turn:foo.com"
+PASS urls[j] is "turn:foo2.com"
 PASS successfullyParsed is true
 
 TEST COMPLETE
index 58230aa..66824fe 100644 (file)
@@ -5,19 +5,19 @@
     </head>
     <body>
         <script>
-            description("Tests RTCPeerConnection getConfiguration.");
+            description("Tests RTCPeerConnection get/setConfiguration.");
 
             var pc = null;
             var configuration = null;
             var iceServers = null;
             var urls = null;
 
-            function checkConfiguration(serversList, iceTransports, requestIdentity)
+            function checkConfiguration(serversList, iceTransportPolicy, bundlePolicy)
             {
                 iceServers = configuration.iceServers
                 shouldBe('iceServers.length', serversList.length.toString());
-                shouldBeEqualToString('configuration.iceTransports', iceTransports);
-                shouldBeEqualToString('configuration.requestIdentity', requestIdentity);
+                shouldBeEqualToString('configuration.iceTransportPolicy', iceTransportPolicy);
+                shouldBeEqualToString('configuration.bundlePolicy', bundlePolicy);
                 for (i = 0; i < iceServers.length; ++i) {
                     shouldBeEqualToString('iceServers[i].username', serversList[i].username);
                     shouldBeEqualToString('iceServers[i].credential', serversList[i].credential);
             pc = new webkitRTCPeerConnection({iceServers:[{urls:'stun:foo.com'}]});
             var servers = [{urls:['stun:foo.com'], username:'', credential:''}];
             configuration = pc.getConfiguration();
-            checkConfiguration(servers, 'all', 'ifconfigured');
+            checkConfiguration(servers, 'all', 'balanced');
 
             pc = new webkitRTCPeerConnection({iceServers:[{urls:'turn:foo.com', username:'user', credential:'x'},{urls:'stun:bar.com', username:'user2', credential:'x'}]});
             servers = [{urls:['turn:foo.com'], username:'user', credential:'x'}, {urls:['stun:bar.com'], username:'user2', credential:'x'}];
             configuration = pc.getConfiguration();
-            checkConfiguration(servers, 'all', 'ifconfigured');
+            checkConfiguration(servers, 'all', 'balanced');
 
             pc = new webkitRTCPeerConnection({iceServers:[{urls:'turn:foo.com', username:'user', credential:'x'},{urls:['stun:bar.com', 'turn:foo.com', 'turn:foo2.com'], username:'user2', credential:'x'}]});
             servers = [{urls:['turn:foo.com'], username:'user', credential:'x'},{urls:['stun:bar.com', 'turn:foo.com', 'turn:foo2.com'], username:'user2', credential:'x'}];
             configuration = pc.getConfiguration();
-            checkConfiguration(servers, 'all', 'ifconfigured');
+            checkConfiguration(servers, 'all', 'balanced');
 
-            pc = new webkitRTCPeerConnection({iceServers:[{urls:'stun:foo.com'}], iceTransports:'relay', requestIdentity:'no'});
+            pc = new webkitRTCPeerConnection({iceServers:[{urls:'stun:foo.com'}], iceTransportPolicy:'relay', bundlePolicy:'balanced'});
             var servers = [{urls:['stun:foo.com'], username:'', credential:''}];
             configuration = pc.getConfiguration();
-            checkConfiguration(servers, 'relay', 'no');
+            checkConfiguration(servers, 'relay', 'balanced');
 
-            pc = new webkitRTCPeerConnection({iceServers:[{urls:'turn:foo.com', username:'user', credential:'x'},{urls:['stun:bar.com', 'turn:foo.com', 'turn:foo2.com'], username:'user2', credential:'x'}], iceTransports:'none', requestIdentity:'yes'});
+            pc = new webkitRTCPeerConnection({iceServers:[{urls:'stun:foo.com'}], iceTransportPolicy:'relay', bundlePolicy:'max-compat'});
+            var servers = [{urls:['stun:foo.com'], username:'', credential:''}];
+            configuration = pc.getConfiguration();
+            checkConfiguration(servers, 'relay', 'max-compat');
+
+            pc = new webkitRTCPeerConnection({iceServers:[{urls:'turn:foo.com', username:'user', credential:'x'},{urls:['stun:bar.com', 'turn:foo.com', 'turn:foo2.com'], username:'user2', credential:'x'}], iceTransportPolicy:'relay', bundlePolicy:'max-bundle'});
+            servers = [{urls:['turn:foo.com'], username:'user', credential:'x'},{urls:['stun:bar.com', 'turn:foo.com', 'turn:foo2.com'], username:'user2', credential:'x'}];
+            configuration = pc.getConfiguration();
+            checkConfiguration(servers, 'relay', 'max-bundle');
+
+            pc.setConfiguration({iceServers:[{urls:'stun:foo.com'}]});
+            var servers = [{urls:['stun:foo.com'], username:'', credential:''}];
+            configuration = pc.getConfiguration();
+            checkConfiguration(servers, 'all', 'balanced');
+
+            pc.setConfiguration({iceServers:[{urls:'turn:foo.com', username:'user', credential:'x'},{urls:'stun:bar.com', username:'user2', credential:'x'}]});
+            servers = [{urls:['turn:foo.com'], username:'user', credential:'x'}, {urls:['stun:bar.com'], username:'user2', credential:'x'}];
+            configuration = pc.getConfiguration();
+            checkConfiguration(servers, 'all', 'balanced');
+
+            pc.setConfiguration({iceServers:[{urls:'turn:foo.com', username:'user', credential:'x'},{urls:['stun:bar.com', 'turn:foo.com', 'turn:foo2.com'], username:'user2', credential:'x'}]});
             servers = [{urls:['turn:foo.com'], username:'user', credential:'x'},{urls:['stun:bar.com', 'turn:foo.com', 'turn:foo2.com'], username:'user2', credential:'x'}];
             configuration = pc.getConfiguration();
-            checkConfiguration(servers, 'none', 'yes');
+            checkConfiguration(servers, 'all', 'balanced');
 
-            pc = new webkitRTCPeerConnection({iceServers:[{urls:'stun:foo.com'}], iceTransports:'foo', requestIdentity:'bar'});
+            pc.setConfiguration({iceServers:[{urls:'stun:foo.com'}], iceTransportPolicy:'relay', bundlePolicy:'balanced'});
             var servers = [{urls:['stun:foo.com'], username:'', credential:''}];
             configuration = pc.getConfiguration();
-            checkConfiguration(servers, 'all', 'ifconfigured');
+            checkConfiguration(servers, 'relay', 'balanced');
+
+            pc.setConfiguration({iceServers:[{urls:'stun:foo.com'}], iceTransportPolicy:'relay', bundlePolicy:'max-compat'});
+            var servers = [{urls:['stun:foo.com'], username:'', credential:''}];
+            configuration = pc.getConfiguration();
+            checkConfiguration(servers, 'relay', 'max-compat');
+
+            pc.setConfiguration({iceServers:[{urls:'turn:foo.com', username:'user', credential:'x'},{urls:['stun:bar.com', 'turn:foo.com', 'turn:foo2.com'], username:'user2', credential:'x'}], iceTransportPolicy:'relay', bundlePolicy:'max-bundle'});
+            servers = [{urls:['turn:foo.com'], username:'user', credential:'x'},{urls:['stun:bar.com', 'turn:foo.com', 'turn:foo2.com'], username:'user2', credential:'x'}];
+            configuration = pc.getConfiguration();
+            checkConfiguration(servers, 'relay', 'max-bundle');
 
             finishJSTest();
 
index 528f88d..d072544 100644 (file)
@@ -341,7 +341,6 @@ webkit.org/b/79203 fast/mediastream/RTCPeerConnection-createOffer.html [ Skip ]
 webkit.org/b/79203 fast/mediastream/RTCPeerConnection-datachannel.html [ Skip ]
 webkit.org/b/79203 fast/mediastream/RTCPeerConnection-dtmf.html [ Skip ]
 webkit.org/b/79203 fast/mediastream/RTCPeerConnection-events.html [ Skip ]
-webkit.org/b/79203 fast/mediastream/RTCPeerConnection-getConfiguration.html [ Skip ]
 webkit.org/b/79203 fast/mediastream/RTCPeerConnection-have-local-offer.html [ Skip ]
 webkit.org/b/79203 fast/mediastream/RTCPeerConnection-have-local-pranswer.html [ Skip ]
 webkit.org/b/79203 fast/mediastream/RTCPeerConnection-have-remote-offer.html [ Skip ]
index e568eb3..d4ec67b 100644 (file)
@@ -1,3 +1,34 @@
+2016-06-29  Adam Bergkvist  <adam.bergkvist@ericsson.com>
+
+        WebRTC: Implement MediaEndpointPeerConnection::setConfiguration()
+        https://bugs.webkit.org/show_bug.cgi?id=159254
+
+        Reviewed by Eric Carlson.
+
+        Implement MediaEndpointPeerConnection::setConfiguration() which is the
+        MediaEndpointPeerConnection implementation of RTCPeerConnection.setConfiguration() [1].
+
+        [1] https://w3c.github.io/webrtc-pc/archives/20160513/webrtc.html#dom-rtcpeerconnection-setconfiguration
+
+        Testing: Updated existing test.
+
+        * Modules/mediastream/MediaEndpointPeerConnection.cpp:
+        (WebCore::MediaEndpointPeerConnection::setConfiguration):
+        Implemented.
+        * Modules/mediastream/RTCConfiguration.cpp:
+        (WebCore::RTCConfiguration::initialize):
+        * Modules/mediastream/RTCConfiguration.h:
+        Use shared enums.
+        * Modules/mediastream/RTCConfiguration.idl:
+        Remove 'None'/'Public' IceTransportPolicy enum value (removed from WebRTC 1.0).
+        * platform/mediastream/MediaEndpointConfiguration.cpp:
+        (WebCore::MediaEndpointConfiguration::MediaEndpointConfiguration):
+        * platform/mediastream/MediaEndpointConfiguration.h:
+        Use shared enums.
+        (WebCore::MediaEndpointConfiguration::create):
+        * platform/mediastream/PeerConnectionStates.h: Renamed from Source/WebCore/Modules/mediastream/PeerConnectionStates.h.
+        Make shared enums accessible to platform objects (currently MediaEndpointConfiguration).
+
 2016-06-29  Hunseop Jeong  <hs85.jeong@samsung.com>
 
         Unreviewed, CMake build fix - 2.
index 7a41972..534d307 100644 (file)
@@ -40,6 +40,7 @@
 #include "MediaStreamEvent.h"
 #include "MediaStreamTrack.h"
 #include "PeerMediaDescription.h"
+#include "RTCConfiguration.h"
 #include "RTCIceCandidate.h"
 #include "RTCOfferAnswerOptions.h"
 #include "RTCRtpTransceiver.h"
@@ -609,9 +610,11 @@ RefPtr<RTCSessionDescription> MediaEndpointPeerConnection::pendingRemoteDescript
 
 void MediaEndpointPeerConnection::setConfiguration(RTCConfiguration& configuration)
 {
-    UNUSED_PARAM(configuration);
+    Vector<RefPtr<IceServerInfo>> iceServers;
+    for (auto& server : configuration.iceServers())
+        iceServers.append(IceServerInfo::create(server->urls(), server->credential(), server->username()));
 
-    notImplemented();
+    m_mediaEndpoint->setConfiguration(MediaEndpointConfiguration::create(iceServers, configuration.iceTransportPolicy(), configuration.bundlePolicy()));
 }
 
 void MediaEndpointPeerConnection::addIceCandidate(RTCIceCandidate& rtcCandidate, PeerConnection::VoidPromise&& promise)
index b9fa48f..585325f 100644 (file)
@@ -141,9 +141,7 @@ void RTCConfiguration::initialize(const Dictionary& configuration, ExceptionCode
 
     String iceTransportPolicy;
     if (configuration.get("iceTransportPolicy", iceTransportPolicy)) {
-        if (iceTransportPolicy == "public")
-            m_iceTransportPolicy = IceTransportPolicy::Public;
-        else if (iceTransportPolicy == "relay")
+        if (iceTransportPolicy == "relay")
             m_iceTransportPolicy = IceTransportPolicy::Relay;
         else if (iceTransportPolicy == "all")
             m_iceTransportPolicy = IceTransportPolicy::All;
index e5b443b..5845a43 100644 (file)
@@ -33,6 +33,7 @@
 
 #if ENABLE(WEB_RTC)
 
+#include "PeerConnectionStates.h"
 #include "RTCIceServer.h"
 #include <wtf/RefCounted.h>
 #include <wtf/RefPtr.h>
@@ -50,10 +51,10 @@ public:
     static RefPtr<RTCConfiguration> create(const Dictionary& configuration, ExceptionCode&);
     virtual ~RTCConfiguration() { }
 
-    enum class IceTransportPolicy { Public, Relay, All };
+    using IceTransportPolicy = PeerConnectionStates::IceTransportPolicy;
     IceTransportPolicy iceTransportPolicy() const { return m_iceTransportPolicy; }
 
-    enum class BundlePolicy { Balanced, MaxCompat, MaxBundle };
+    using BundlePolicy = PeerConnectionStates::BundlePolicy;
     BundlePolicy bundlePolicy() const { return m_bundlePolicy; }
 
     Vector<RefPtr<RTCIceServer>> iceServers() const { return m_iceServers; }
index 63f5140..13f623c 100644 (file)
@@ -23,7 +23,7 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-enum RTCIceTransportPolicy { "public", "relay", "all" };
+enum RTCIceTransportPolicy { "relay", "all" };
 enum RTCBundlePolicy { "balanced", "max-compat", "max-bundle" };
 
 [
index 5365571..dd0d86e 100644 (file)
@@ -44,26 +44,11 @@ IceServerInfo::IceServerInfo(const Vector<String>& urls, const String& credentia
         m_urls.append(URL(URL(), url));
 }
 
-MediaEndpointConfiguration::MediaEndpointConfiguration(Vector<RefPtr<IceServerInfo>>& iceServers, const String& iceTransportPolicy, const String& bundlePolicy)
+MediaEndpointConfiguration::MediaEndpointConfiguration(Vector<RefPtr<IceServerInfo>>& iceServers, IceTransportPolicy iceTransportPolicy, BundlePolicy bundlePolicy)
     : m_iceServers(iceServers)
+    , m_iceTransportPolicy(iceTransportPolicy)
+    , m_bundlePolicy(bundlePolicy)
 {
-    if (iceTransportPolicy == "none")
-        m_iceTransportPolicy = IceTransportPolicy::None;
-    else if (iceTransportPolicy == "relay")
-        m_iceTransportPolicy = IceTransportPolicy::Relay;
-    else if (iceTransportPolicy == "all")
-        m_iceTransportPolicy = IceTransportPolicy::All;
-    else
-        ASSERT_NOT_REACHED();
-
-    if (bundlePolicy == "balanced")
-        m_bundlePolicy = BundlePolicy::Balanced;
-    else if (bundlePolicy == "max-compat")
-        m_bundlePolicy = BundlePolicy::MaxCompat;
-    else if (bundlePolicy == "max-bundle")
-        m_bundlePolicy = BundlePolicy::MaxBundle;
-    else
-        ASSERT_NOT_REACHED();
 }
 
 } // namespace WebCore
index e373c51..09a457d 100644 (file)
@@ -33,6 +33,7 @@
 
 #if ENABLE(WEB_RTC)
 
+#include "PeerConnectionStates.h"
 #include "URL.h"
 #include <wtf/RefCounted.h>
 #include <wtf/RefPtr.h>
@@ -63,29 +64,20 @@ private:
 
 class MediaEndpointConfiguration : public RefCounted<MediaEndpointConfiguration> {
 public:
-    static RefPtr<MediaEndpointConfiguration> create(Vector<RefPtr<IceServerInfo>>& iceServers, const String& iceTransportPolicy, const String& bundlePolicy)
+    using IceTransportPolicy = PeerConnectionStates::IceTransportPolicy;
+    using BundlePolicy = PeerConnectionStates::BundlePolicy;
+
+    static RefPtr<MediaEndpointConfiguration> create(Vector<RefPtr<IceServerInfo>>& iceServers, IceTransportPolicy iceTransportPolicy, BundlePolicy bundlePolicy)
     {
         return adoptRef(new MediaEndpointConfiguration(iceServers, iceTransportPolicy, bundlePolicy));
     }
 
-    enum class IceTransportPolicy {
-        None,
-        Relay,
-        All
-    };
-
-    enum class BundlePolicy {
-        Balanced,
-        MaxCompat,
-        MaxBundle
-    };
-
     const Vector<RefPtr<IceServerInfo>>& iceServers() const { return m_iceServers; }
     IceTransportPolicy iceTransportPolicy() const { return m_iceTransportPolicy; }
     BundlePolicy bundlePolicy() const { return m_bundlePolicy; }
 
 private:
-    MediaEndpointConfiguration(Vector<RefPtr<IceServerInfo>>&, const String& iceTransportPolicy, const String& bundlePolicy);
+    MediaEndpointConfiguration(Vector<RefPtr<IceServerInfo>>&, IceTransportPolicy, BundlePolicy);
 
     Vector<RefPtr<IceServerInfo>> m_iceServers;
     IceTransportPolicy m_iceTransportPolicy;
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2015 Ericsson AB. All rights reserved.
+ * Copyright (C) 2015, 2016 Ericsson AB. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -28,8 +28,7 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#ifndef PeerConnectionStates_h
-#define PeerConnectionStates_h
+#pragma once
 
 #if ENABLE(WEB_RTC)
 
@@ -62,10 +61,19 @@ enum class IceGatheringState {
     Complete = 3
 };
 
+enum class IceTransportPolicy {
+    Relay,
+    All
+};
+
+enum class BundlePolicy {
+    Balanced,
+    MaxCompat,
+    MaxBundle
+};
+
 }
 
 } // namespace WebCore
 
 #endif // ENABLE(WEB_RTC)
-
-#endif // PeerConnectionStates_h