2 * Copyright (C) 2012 Google Inc. All rights reserved.
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above
11 * copyright notice, this list of conditions and the following disclaimer
12 * in the documentation and/or other materials provided with the
14 * * Neither the name of Google Inc. nor the names of its
15 * contributors may be used to endorse or promote products derived from
16 * this software without specific prior written permission.
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 #include "public/platform/WebRTCConfiguration.h"
35 #include "platform/mediastream/RTCConfiguration.h"
36 #include "public/platform/WebString.h"
37 #include "public/platform/WebURL.h"
41 WebRTCICEServer::WebRTCICEServer(RTCIceServer
* iceServer
)
42 : m_private(iceServer
)
46 void WebRTCICEServer::assign(const WebRTCICEServer
& other
)
48 m_private
= other
.m_private
;
51 void WebRTCICEServer::reset()
56 WebURL
WebRTCICEServer::uri() const
59 return m_private
->uri();
62 WebString
WebRTCICEServer::username() const
65 return m_private
->username();
68 WebString
WebRTCICEServer::credential() const
71 return m_private
->credential();
74 WebRTCICEServerArray::WebRTCICEServerArray(RTCIceServerArray
* iceServers
)
75 : m_private(iceServers
)
79 void WebRTCICEServerArray::assign(const WebRTCICEServerArray
& other
)
81 m_private
= other
.m_private
;
84 void WebRTCICEServerArray::reset()
89 size_t WebRTCICEServerArray::numberOfServers() const
92 return m_private
->numberOfServers();
95 WebRTCICEServer
WebRTCICEServerArray::server(size_t index
) const
98 return WebRTCICEServer(m_private
->server(index
));
101 WebRTCConfiguration::WebRTCConfiguration(RTCConfiguration
* configuration
)
102 : m_private(configuration
)
106 void WebRTCConfiguration::assign(const WebRTCConfiguration
& other
)
108 m_private
= other
.m_private
;
111 void WebRTCConfiguration::reset()
116 WebRTCIceTransports
WebRTCConfiguration::iceTransports() const
119 switch (m_private
->iceTransports()) {
120 case RTCIceTransportsNone
:
121 return WebRTCIceTransportsNone
;
122 case RTCIceTransportsRelay
:
123 return WebRTCIceTransportsRelay
;
124 case RTCIceTransportsAll
:
125 return WebRTCIceTransportsAll
;
127 ASSERT_NOT_REACHED();
129 return WebRTCIceTransportsAll
;
132 WebRTCBundlePolicy
WebRTCConfiguration::bundlePolicy() const
135 switch (m_private
->bundlePolicy()) {
136 case RTCBundlePolicyBalanced
:
137 return WebRTCBundlePolicyBalanced
;
138 case RTCBundlePolicyMaxCompat
:
139 return WebRTCBundlePolicyMaxCompat
;
140 case RTCBundlePolicyMaxBundle
:
141 return WebRTCBundlePolicyMaxBundle
;
143 ASSERT_NOT_REACHED();
145 return WebRTCBundlePolicyBalanced
;
148 WebRTCRtcpMuxPolicy
WebRTCConfiguration::rtcpMuxPolicy() const
151 switch (m_private
->rtcpMuxPolicy()) {
152 case RTCRtcpMuxPolicyNegotiate
:
153 return WebRTCRtcpMuxPolicyNegotiate
;
154 case RTCRtcpMuxPolicyRequire
:
155 return WebRTCRtcpMuxPolicyRequire
;
157 ASSERT_NOT_REACHED();
159 return WebRTCRtcpMuxPolicyNegotiate
;
162 WebRTCICEServerArray
WebRTCConfiguration::iceServers() const
165 return WebRTCICEServerArray(m_private
->iceServers());