12015-10-28 Adam Bergkvist <adam.bergkvist@ericsson.com>
2
3 WebRTC: Update RTCPeerConnection API and introduce PeerConnectionBackend
4 https://bugs.webkit.org/show_bug.cgi?id=150166
5
6 Reviewed by NOBODY (OOPS!).
7
8 This change introduces PeerConnectionBackend which is a WebCore interface
9 that allows RTCPeerConnection to have platform abstractions at different
10 levels. For example, the MediaEndpoint interface [1] is a lower level
11 WebRTC backend abstraction where a big part of the WebRTC specification
12 is implemented in WebCore to be reusable. RTCPeerConnectionHandler (in
13 the repo today) is on the other hand a higher level WebRTC backend
14 abstraction where the calls are mostly forwarded directly to the
15 backend. The PeerConnectionBackend interface facilitates both approaches.
16
17 RTCPeerConnection
18 | (has)
19 |
20 PeerConnectionBackend
21 | |
22 | | (realizes)
23 | MediaEndpointPeerConnection
24 | | (has)
25 | |
26 | MediaEndpoint (platform interface)
27 |
28 | (realizes)
29 RTCPeerHandlerPeerConnection
30 | (has)
31 |
32 RCPeerConnectionHandler (existing platform interface)
33
34 Notable changes:
35
36 # Overloaded methods on RTCPeerConnection (Promise + legacy callback
37 signatures) are implemented with JSBuiltins.
38
39 # "Queued operations" ([1] Section 4.3.1) is implemented in JS bindings
40 with Promises. Issue: Non-queued operations are still exposed to the
41 script (see FIXME in RTCPeerConnection.idl).
42
43 # New RTCPeerConnection features
44 - add/removeTrack()
45 - pending/currentLocal/RemoteDescription attributes
46 - RTCRtpSender/Receiver
47
48 # Information carrying objects like RTCSessionDescription and
49 RTCCandidate don't encapsulate a "mirrored" platform object anymore.
50
51 # Remove RTCPeerConnection specific callback implementations (not used
52 with JS bindings)
53
54 [1] http://webkit.org/b/150165
55 [2] https://w3c.github.io/webrtc-pc/archives/20151006/webrtc.html
56
57 Tests: Mock should be added to test future WebRTC backend abstractions.
58
59 * CMakeLists.txt:
60 * DerivedSources.make:
61 * Modules/mediastream/PeerConnectionBackend.cpp: Added.
62 (WebCore::createPeerConnectionBackend):
63 * Modules/mediastream/PeerConnectionBackend.h: Added.
64 (WebCore::PeerConnectionBackendClient::~PeerConnectionBackendClient):
65 (WebCore::PeerConnectionBackend::~PeerConnectionBackend):
66 * Modules/mediastream/PeerConnectionStates.h: Added.
67 * Modules/mediastream/RTCConfiguration.cpp: Added.
68 (WebCore::validateIceServerURL):
69 (WebCore::parseIceServer):
70 (WebCore::RTCConfiguration::create):
71 (WebCore::RTCConfiguration::RTCConfiguration):
72 (WebCore::RTCConfiguration::initialize):
73 * Modules/mediastream/RTCConfiguration.h:
74 (WebCore::RTCConfiguration::iceTransportPolicy):
75 (WebCore::RTCConfiguration::bundlePolicy):
76 (WebCore::RTCConfiguration::iceServers):
77 (WebCore::RTCConfiguration::create): Deleted.
78 (WebCore::RTCConfiguration::appendServer): Deleted.
79 (WebCore::RTCConfiguration::numberOfServers): Deleted.
80 (WebCore::RTCConfiguration::server): Deleted.
81 (WebCore::RTCConfiguration::iceTransports): Deleted.
82 (WebCore::RTCConfiguration::setIceTransports): Deleted.
83 (WebCore::RTCConfiguration::requestIdentity): Deleted.
84 (WebCore::RTCConfiguration::setRequestIdentity): Deleted.
85 (WebCore::RTCConfiguration::privateConfiguration): Deleted.
86 (WebCore::RTCConfiguration::RTCConfiguration): Deleted.
87 * Modules/mediastream/RTCConfiguration.idl:
88 * Modules/mediastream/RTCIceCandidate.cpp:
89 (WebCore::RTCIceCandidate::create):
90 (WebCore::RTCIceCandidate::RTCIceCandidate):
91 (WebCore::RTCIceCandidate::candidate):
92 (WebCore::RTCIceCandidate::setCandidate):
93 (WebCore::RTCIceCandidate::sdpMid):
94 (WebCore::RTCIceCandidate::setSdpMid):
95 (WebCore::RTCIceCandidate::sdpMLineIndex):
96 (WebCore::RTCIceCandidate::setSdpMLineIndex):
97 (WebCore::RTCIceCandidate::descriptor): Deleted.
98 * Modules/mediastream/RTCIceCandidate.h:
99 * Modules/mediastream/RTCIceCandidate.idl:
100 * Modules/mediastream/RTCIceCandidateEvent.cpp:
101 (WebCore::RTCIceCandidateEvent::create):
102 (WebCore::RTCIceCandidateEvent::RTCIceCandidateEvent):
103 * Modules/mediastream/RTCIceCandidateEvent.h:
104 * Modules/mediastream/RTCIceServer.h:
105 (WebCore::RTCIceServer::urls):
106 (WebCore::RTCIceServer::credential):
107 (WebCore::RTCIceServer::username):
108 (WebCore::RTCIceServer::RTCIceServer):
109 (WebCore::RTCIceServer::create): Deleted.
110 (WebCore::RTCIceServer::privateServer): Deleted.
111 * Modules/mediastream/RTCOfferAnswerOptions.cpp:
112 (WebCore::RTCOfferAnswerOptions::RTCOfferAnswerOptions):
113 (WebCore::RTCOfferAnswerOptions::initialize):
114 (WebCore::RTCOfferOptions::RTCOfferOptions):
115 (WebCore::RTCOfferOptions::initialize):
116 (WebCore::RTCAnswerOptions::create):
117 (WebCore::RTCAnswerOptions::initialize):
118 (WebCore::RTCOfferAnswerOptions::create): Deleted.
119 * Modules/mediastream/RTCOfferAnswerOptions.h:
120 (WebCore::RTCOfferAnswerOptions::voiceActivityDetection):
121 (WebCore::RTCOfferOptions::~RTCOfferOptions):
122 (WebCore::RTCOfferOptions::offerToReceiveVideo):
123 (WebCore::RTCOfferOptions::offerToReceiveAudio):
124 (WebCore::RTCOfferOptions::iceRestart):
125 (WebCore::RTCAnswerOptions::~RTCAnswerOptions):
126 (WebCore::RTCAnswerOptions::RTCAnswerOptions):
127 (WebCore::RTCOfferAnswerOptions::requestIdentity): Deleted.
128 (WebCore::RTCOfferAnswerOptions::privateOfferAnswerOptions): Deleted.
129 (WebCore::RTCOfferAnswerOptions::RTCOfferAnswerOptions): Deleted.
130 (WebCore::RTCOfferOptions::voiceActivityDetection): Deleted.
131 (WebCore::RTCOfferOptions::privateOfferOptions): Deleted.
132 (WebCore::RTCOfferOptions::RTCOfferOptions): Deleted.
133 * Modules/mediastream/RTCPeerConnection.cpp:
134 (WebCore::RTCPeerConnection::create):
135 (WebCore::RTCPeerConnection::RTCPeerConnection):
136 (WebCore::RTCPeerConnection::getSenders):
137 (WebCore::RTCPeerConnection::getReceivers):
138 (WebCore::RTCPeerConnection::addTrack):
139 (WebCore::RTCPeerConnection::removeTrack):
140 (WebCore::RTCPeerConnection::internalCreateOffer):
141 (WebCore::RTCPeerConnection::internalCreateAnswer):
142 (WebCore::RTCPeerConnection::internalSetLocalDescription):
143 (WebCore::RTCPeerConnection::localDescription):
144 (WebCore::RTCPeerConnection::currentLocalDescription):
145 (WebCore::RTCPeerConnection::pendingLocalDescription):
146 (WebCore::RTCPeerConnection::internalSetRemoteDescription):
147 (WebCore::RTCPeerConnection::remoteDescription):
148 (WebCore::RTCPeerConnection::currentRemoteDescription):
149 (WebCore::RTCPeerConnection::pendingRemoteDescription):
150 (WebCore::RTCPeerConnection::internalAddIceCandidate):
151 (WebCore::RTCPeerConnection::signalingState):
152 (WebCore::RTCPeerConnection::iceGatheringState):
153 (WebCore::RTCPeerConnection::iceConnectionState):
154 (WebCore::RTCPeerConnection::setConfiguration):
155 (WebCore::RTCPeerConnection::internalGetStats):
156 (WebCore::RTCPeerConnection::createDataChannel):
157 (WebCore::RTCPeerConnection::close):
158 (WebCore::RTCPeerConnection::stop):
159 (WebCore::RTCPeerConnection::setSignalingState):
160 (WebCore::RTCPeerConnection::updateIceGatheringState):
161 (WebCore::RTCPeerConnection::updateIceConnectionState):
162 (WebCore::RTCPeerConnection::scheduleNegotiationNeededEvent):
163 (WebCore::RTCPeerConnection::fireEvent):
164 (WebCore::validateIceServerURL): Deleted.
165 (WebCore::processIceServer): Deleted.
166 (WebCore::RTCPeerConnection::parseConfiguration): Deleted.
167 (WebCore::RTCPeerConnection::~RTCPeerConnection): Deleted.
168 (WebCore::RTCPeerConnection::createOffer): Deleted.
169 (WebCore::RTCPeerConnection::createAnswer): Deleted.
170 (WebCore::RTCPeerConnection::checkStateForLocalDescription): Deleted.
171 (WebCore::RTCPeerConnection::checkStateForRemoteDescription): Deleted.
172 (WebCore::RTCPeerConnection::setLocalDescription): Deleted.
173 (WebCore::RTCPeerConnection::setRemoteDescription): Deleted.
174 (WebCore::RTCPeerConnection::updateIce): Deleted.
175 (WebCore::RTCPeerConnection::addIceCandidate): Deleted.
176 (WebCore::RTCPeerConnection::addStream): Deleted.
177 (WebCore::RTCPeerConnection::removeStream): Deleted.
178 (WebCore::RTCPeerConnection::getLocalStreams): Deleted.
179 (WebCore::RTCPeerConnection::getRemoteStreams): Deleted.
180 (WebCore::RTCPeerConnection::getStreamById): Deleted.
181 (WebCore::RTCPeerConnection::getStats): Deleted.
182 (WebCore::RTCPeerConnection::hasLocalStreamWithTrackId): Deleted.
183 (WebCore::RTCPeerConnection::createDTMFSender): Deleted.
184 (WebCore::RTCPeerConnection::negotiationNeeded): Deleted.
185 (WebCore::RTCPeerConnection::didGenerateIceCandidate): Deleted.
186 (WebCore::RTCPeerConnection::didChangeSignalingState): Deleted.
187 (WebCore::RTCPeerConnection::didChangeIceGatheringState): Deleted.
188 (WebCore::RTCPeerConnection::didChangeIceConnectionState): Deleted.
189 (WebCore::RTCPeerConnection::didAddRemoteStream): Deleted.
190 (WebCore::RTCPeerConnection::didRemoveRemoteStream): Deleted.
191 (WebCore::RTCPeerConnection::didAddRemoteDataChannel): Deleted.
192 (WebCore::RTCPeerConnection::didAddOrRemoveTrack): Deleted.
193 (WebCore::RTCPeerConnection::changeSignalingState): Deleted.
194 (WebCore::RTCPeerConnection::changeIceGatheringState): Deleted.
195 (WebCore::RTCPeerConnection::changeIceConnectionState): Deleted.
196 (WebCore::RTCPeerConnection::scheduleDispatchEvent): Deleted.
197 (WebCore::RTCPeerConnection::scheduledEventTimerFired): Deleted.
198 * Modules/mediastream/RTCPeerConnection.h:
199 * Modules/mediastream/RTCPeerConnection.idl:
200 * Modules/mediastream/RTCPeerConnection.js: Added.
201 (createOffer):
202 (createAnswer):
203 (setLocalDescription):
204 (setRemoteDescription):
205 (addIceCandidate):
206 (getStats):
207 * Modules/mediastream/RTCPeerConnectionErrorCallback.h:
208 (WebCore::RTCPeerConnectionErrorCallback::~RTCPeerConnectionErrorCallback): Deleted.
209 * Modules/mediastream/RTCPeerConnectionInternals.js: Added.
210 (runNext):
211 (runQueuedOperation):
212 * Modules/mediastream/RTCRtpReceiver.cpp: Added.
213 (WebCore::RTCRtpReceiver::create):
214 (WebCore::RTCRtpReceiver::RTCRtpReceiver):
215 (WebCore::RTCRtpReceiver::~RTCRtpReceiver):
216 * Modules/mediastream/RTCRtpReceiver.h: Added.
217 * Modules/mediastream/RTCRtpReceiver.idl: Added.
218 * Modules/mediastream/RTCRtpSender.cpp: Added.
219 (WebCore::RTCRtpSender::create):
220 (WebCore::RTCRtpSender::RTCRtpSender):
221 (WebCore::RTCRtpSender::~RTCRtpSender):
222 * Modules/mediastream/RTCRtpSender.h: Added.
223 (WebCore::RTCRtpSender::mediaStreamId):
224 * Modules/mediastream/RTCRtpSender.idl: Added.
225 * Modules/mediastream/RTCRtpSenderReceiverBase.cpp: Added.
226 (WebCore::RTCRtpSenderReceiverBase::RTCRtpSenderReceiverBase):
227 (WebCore::RTCRtpSenderReceiverBase::~RTCRtpSenderReceiverBase):
228 (WebCore::RTCRtpSenderReceiverBase::track):
229 * Modules/mediastream/RTCRtpSenderReceiverBase.h: Added.
230 * Modules/mediastream/RTCSessionDescription.cpp:
231 (WebCore::RTCSessionDescription::create):
232 (WebCore::RTCSessionDescription::RTCSessionDescription):
233 (WebCore::RTCSessionDescription::type):
234 (WebCore::RTCSessionDescription::setType):
235 (WebCore::RTCSessionDescription::sdp):
236 (WebCore::RTCSessionDescription::setSdp):
237 (WebCore::RTCSessionDescription::descriptor): Deleted.
238 * Modules/mediastream/RTCSessionDescription.h:
239 * Modules/mediastream/RTCSessionDescriptionCallback.h:
240 (WebCore::RTCSessionDescriptionCallback::~RTCSessionDescriptionCallback): Deleted.
241 * Modules/mediastream/RTCSessionDescriptionRequestImpl.cpp: Removed.
242 (WebCore::RTCSessionDescriptionRequestImpl::create): Deleted.
243 (WebCore::RTCSessionDescriptionRequestImpl::RTCSessionDescriptionRequestImpl): Deleted.
244 (WebCore::RTCSessionDescriptionRequestImpl::~RTCSessionDescriptionRequestImpl): Deleted.
245 (WebCore::RTCSessionDescriptionRequestImpl::requestSucceeded): Deleted.
246 (WebCore::RTCSessionDescriptionRequestImpl::requestFailed): Deleted.
247 (WebCore::RTCSessionDescriptionRequestImpl::stop): Deleted.
248 (WebCore::RTCSessionDescriptionRequestImpl::activeDOMObjectName): Deleted.
249 (WebCore::RTCSessionDescriptionRequestImpl::canSuspendForPageCache): Deleted.
250 (WebCore::RTCSessionDescriptionRequestImpl::clear): Deleted.
251 * Modules/mediastream/RTCSessionDescriptionRequestImpl.h: Removed.
252 * Modules/mediastream/RTCStatsCallback.h: Removed.
253 (WebCore::RTCStatsCallback::~RTCStatsCallback): Deleted.
254 * Modules/mediastream/RTCStatsCallback.idl: Removed.
255 * Modules/mediastream/RTCStatsRequestImpl.cpp: Removed.
256 (WebCore::RTCStatsRequestImpl::create): Deleted.
257 (WebCore::RTCStatsRequestImpl::RTCStatsRequestImpl): Deleted.
258 (WebCore::RTCStatsRequestImpl::~RTCStatsRequestImpl): Deleted.
259 (WebCore::RTCStatsRequestImpl::createResponse): Deleted.
260 (WebCore::RTCStatsRequestImpl::hasSelector): Deleted.
261 (WebCore::RTCStatsRequestImpl::track): Deleted.
262 (WebCore::RTCStatsRequestImpl::requestSucceeded): Deleted.
263 (WebCore::RTCStatsRequestImpl::requestFailed): Deleted.
264 (WebCore::RTCStatsRequestImpl::stop): Deleted.
265 (WebCore::RTCStatsRequestImpl::activeDOMObjectName): Deleted.
266 (WebCore::RTCStatsRequestImpl::canSuspendForPageCache): Deleted.
267 (WebCore::RTCStatsRequestImpl::clear): Deleted.
268 * Modules/mediastream/RTCStatsRequestImpl.h: Removed.
269 * Modules/mediastream/RTCTrackEvent.cpp: Added.
270 (WebCore::RTCTrackEventInit::RTCTrackEventInit):
271 (WebCore::RTCTrackEvent::create):
272 (WebCore::RTCTrackEvent::RTCTrackEvent):
273 (WebCore::RTCTrackEvent::~RTCTrackEvent):
274 * Modules/mediastream/RTCTrackEvent.h: Added.
275 (WebCore::RTCTrackEvent::receiver):
276 (WebCore::RTCTrackEvent::track):
277 (WebCore::RTCTrackEvent::eventInterface):
278 * Modules/mediastream/RTCTrackEvent.idl: Added.
279 * Modules/mediastream/RTCVoidRequestImpl.cpp: Removed.
280 (WebCore::RTCVoidRequestImpl::create): Deleted.
281 (WebCore::RTCVoidRequestImpl::RTCVoidRequestImpl): Deleted.
282 (WebCore::RTCVoidRequestImpl::~RTCVoidRequestImpl): Deleted.
283 (WebCore::RTCVoidRequestImpl::requestSucceeded): Deleted.
284 (WebCore::RTCVoidRequestImpl::requestFailed): Deleted.
285 (WebCore::RTCVoidRequestImpl::stop): Deleted.
286 (WebCore::RTCVoidRequestImpl::activeDOMObjectName): Deleted.
287 (WebCore::RTCVoidRequestImpl::canSuspendForPageCache): Deleted.
288 (WebCore::RTCVoidRequestImpl::clear): Deleted.
289 * WebCore.xcodeproj/project.pbxproj:
290 * bindings/js/JSDictionary.cpp:
291 (WebCore::JSDictionary::convertValue):
292 * bindings/js/JSDictionary.h:
293 * bindings/js/WebCoreBuiltinNames.h:
294 * bindings/js/WebCoreJSBuiltinInternals.h:
295 (WebCore::JSBuiltinInternalFunctions::JSBuiltinInternalFunctions):
296 (WebCore::JSBuiltinInternalFunctions::rTCPeerConnectionInternals):
297 (WebCore::JSBuiltinInternalFunctions::visit):
298 (WebCore::JSBuiltinInternalFunctions::init):
299 * bindings/js/WebCoreJSBuiltins.cpp:
300 * bindings/js/WebCoreJSBuiltins.h:
301 (WebCore::JSBuiltinFunctions::JSBuiltinFunctions):
302 (WebCore::JSBuiltinFunctions::rTCPeerConnectionBuiltins):
303 (WebCore::JSBuiltinFunctions::rTCPeerConnectionInternalsBuiltins):
304 * dom/EventNames.in:
305