| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * | 7 * |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 272 webConfiguration.rtcpMuxPolicy = rtcpMuxPolicy; | 272 webConfiguration.rtcpMuxPolicy = rtcpMuxPolicy; |
| 273 | 273 |
| 274 if (configuration.hasIceServers()) { | 274 if (configuration.hasIceServers()) { |
| 275 Vector<WebRTCIceServer> iceServers; | 275 Vector<WebRTCIceServer> iceServers; |
| 276 for (const RTCIceServer& iceServer : configuration.iceServers()) { | 276 for (const RTCIceServer& iceServer : configuration.iceServers()) { |
| 277 Vector<String> urlStrings; | 277 Vector<String> urlStrings; |
| 278 if (iceServer.hasURLs()) { | 278 if (iceServer.hasURLs()) { |
| 279 UseCounter::count(context, UseCounter::RTCIceServerURLs); | 279 UseCounter::count(context, UseCounter::RTCIceServerURLs); |
| 280 const StringOrStringSequence& urls = iceServer.urls(); | 280 const StringOrStringSequence& urls = iceServer.urls(); |
| 281 if (urls.isString()) { | 281 if (urls.isString()) { |
| 282 urlStrings.append(urls.getAsString()); | 282 urlStrings.push_back(urls.getAsString()); |
| 283 } else { | 283 } else { |
| 284 DCHECK(urls.isStringSequence()); | 284 DCHECK(urls.isStringSequence()); |
| 285 urlStrings = urls.getAsStringSequence(); | 285 urlStrings = urls.getAsStringSequence(); |
| 286 } | 286 } |
| 287 } else if (iceServer.hasURL()) { | 287 } else if (iceServer.hasURL()) { |
| 288 UseCounter::count(context, UseCounter::RTCIceServerURL); | 288 UseCounter::count(context, UseCounter::RTCIceServerURL); |
| 289 urlStrings.append(iceServer.url()); | 289 urlStrings.push_back(iceServer.url()); |
| 290 } else { | 290 } else { |
| 291 exceptionState.throwTypeError("Malformed RTCIceServer"); | 291 exceptionState.throwTypeError("Malformed RTCIceServer"); |
| 292 return WebRTCConfiguration(); | 292 return WebRTCConfiguration(); |
| 293 } | 293 } |
| 294 | 294 |
| 295 String username = iceServer.username(); | 295 String username = iceServer.username(); |
| 296 String credential = iceServer.credential(); | 296 String credential = iceServer.credential(); |
| 297 | 297 |
| 298 for (const String& urlString : urlStrings) { | 298 for (const String& urlString : urlStrings) { |
| 299 KURL url(KURL(), urlString); | 299 KURL url(KURL(), urlString); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 310 "'stun', 'turn' or 'turns'."); | 310 "'stun', 'turn' or 'turns'."); |
| 311 return WebRTCConfiguration(); | 311 return WebRTCConfiguration(); |
| 312 } | 312 } |
| 313 if ((url.protocolIs("turn") || url.protocolIs("turns")) && | 313 if ((url.protocolIs("turn") || url.protocolIs("turns")) && |
| 314 (username.isNull() || credential.isNull())) { | 314 (username.isNull() || credential.isNull())) { |
| 315 exceptionState.throwDOMException(InvalidAccessError, | 315 exceptionState.throwDOMException(InvalidAccessError, |
| 316 "Both username and credential are " | 316 "Both username and credential are " |
| 317 "required when the URL scheme is " | 317 "required when the URL scheme is " |
| 318 "\"turn\" or \"turns\"."); | 318 "\"turn\" or \"turns\"."); |
| 319 } | 319 } |
| 320 iceServers.append(WebRTCIceServer{url, username, credential}); | 320 iceServers.push_back(WebRTCIceServer{url, username, credential}); |
| 321 } | 321 } |
| 322 } | 322 } |
| 323 webConfiguration.iceServers = iceServers; | 323 webConfiguration.iceServers = iceServers; |
| 324 } | 324 } |
| 325 | 325 |
| 326 if (configuration.hasCertificates()) { | 326 if (configuration.hasCertificates()) { |
| 327 const HeapVector<Member<RTCCertificate>>& certificates = | 327 const HeapVector<Member<RTCCertificate>>& certificates = |
| 328 configuration.certificates(); | 328 configuration.certificates(); |
| 329 WebVector<std::unique_ptr<WebRTCCertificate>> certificatesCopy( | 329 WebVector<std::unique_ptr<WebRTCCertificate>> certificatesCopy( |
| 330 certificates.size()); | 330 certificates.size()); |
| (...skipping 738 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1069 return; | 1069 return; |
| 1070 | 1070 |
| 1071 MediaErrorState mediaErrorState; | 1071 MediaErrorState mediaErrorState; |
| 1072 WebMediaConstraints constraints = | 1072 WebMediaConstraints constraints = |
| 1073 MediaConstraintsImpl::create(context, mediaConstraints, mediaErrorState); | 1073 MediaConstraintsImpl::create(context, mediaConstraints, mediaErrorState); |
| 1074 if (mediaErrorState.hadException()) { | 1074 if (mediaErrorState.hadException()) { |
| 1075 mediaErrorState.raiseException(exceptionState); | 1075 mediaErrorState.raiseException(exceptionState); |
| 1076 return; | 1076 return; |
| 1077 } | 1077 } |
| 1078 | 1078 |
| 1079 m_localStreams.append(stream); | 1079 m_localStreams.push_back(stream); |
| 1080 | 1080 |
| 1081 bool valid = m_peerHandler->addStream(stream->descriptor(), constraints); | 1081 bool valid = m_peerHandler->addStream(stream->descriptor(), constraints); |
| 1082 if (!valid) | 1082 if (!valid) |
| 1083 exceptionState.throwDOMException(SyntaxError, | 1083 exceptionState.throwDOMException(SyntaxError, |
| 1084 "Unable to add the provided stream."); | 1084 "Unable to add the provided stream."); |
| 1085 } | 1085 } |
| 1086 | 1086 |
| 1087 void RTCPeerConnection::removeStream(MediaStream* stream, | 1087 void RTCPeerConnection::removeStream(MediaStream* stream, |
| 1088 ExceptionState& exceptionState) { | 1088 ExceptionState& exceptionState) { |
| 1089 if (throwExceptionIfSignalingStateClosed(m_signalingState, exceptionState)) | 1089 if (throwExceptionIfSignalingStateClosed(m_signalingState, exceptionState)) |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1280 | 1280 |
| 1281 void RTCPeerConnection::didAddRemoteStream(const WebMediaStream& remoteStream) { | 1281 void RTCPeerConnection::didAddRemoteStream(const WebMediaStream& remoteStream) { |
| 1282 DCHECK(!m_closed); | 1282 DCHECK(!m_closed); |
| 1283 DCHECK(getExecutionContext()->isContextThread()); | 1283 DCHECK(getExecutionContext()->isContextThread()); |
| 1284 | 1284 |
| 1285 if (m_signalingState == SignalingStateClosed) | 1285 if (m_signalingState == SignalingStateClosed) |
| 1286 return; | 1286 return; |
| 1287 | 1287 |
| 1288 MediaStream* stream = | 1288 MediaStream* stream = |
| 1289 MediaStream::create(getExecutionContext(), remoteStream); | 1289 MediaStream::create(getExecutionContext(), remoteStream); |
| 1290 m_remoteStreams.append(stream); | 1290 m_remoteStreams.push_back(stream); |
| 1291 | 1291 |
| 1292 scheduleDispatchEvent( | 1292 scheduleDispatchEvent( |
| 1293 MediaStreamEvent::create(EventTypeNames::addstream, stream)); | 1293 MediaStreamEvent::create(EventTypeNames::addstream, stream)); |
| 1294 } | 1294 } |
| 1295 | 1295 |
| 1296 void RTCPeerConnection::didRemoveRemoteStream( | 1296 void RTCPeerConnection::didRemoveRemoteStream( |
| 1297 const WebMediaStream& remoteStream) { | 1297 const WebMediaStream& remoteStream) { |
| 1298 DCHECK(!m_closed); | 1298 DCHECK(!m_closed); |
| 1299 DCHECK(getExecutionContext()->isContextThread()); | 1299 DCHECK(getExecutionContext()->isContextThread()); |
| 1300 | 1300 |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1414 changeSignalingState(SignalingStateClosed); | 1414 changeSignalingState(SignalingStateClosed); |
| 1415 } | 1415 } |
| 1416 | 1416 |
| 1417 void RTCPeerConnection::scheduleDispatchEvent(Event* event) { | 1417 void RTCPeerConnection::scheduleDispatchEvent(Event* event) { |
| 1418 scheduleDispatchEvent(event, nullptr); | 1418 scheduleDispatchEvent(event, nullptr); |
| 1419 } | 1419 } |
| 1420 | 1420 |
| 1421 void RTCPeerConnection::scheduleDispatchEvent( | 1421 void RTCPeerConnection::scheduleDispatchEvent( |
| 1422 Event* event, | 1422 Event* event, |
| 1423 std::unique_ptr<BoolFunction> setupFunction) { | 1423 std::unique_ptr<BoolFunction> setupFunction) { |
| 1424 m_scheduledEvents.append(new EventWrapper(event, std::move(setupFunction))); | 1424 m_scheduledEvents.push_back( |
| 1425 new EventWrapper(event, std::move(setupFunction))); |
| 1425 | 1426 |
| 1426 m_dispatchScheduledEventRunner->runAsync(); | 1427 m_dispatchScheduledEventRunner->runAsync(); |
| 1427 } | 1428 } |
| 1428 | 1429 |
| 1429 void RTCPeerConnection::dispatchScheduledEvent() { | 1430 void RTCPeerConnection::dispatchScheduledEvent() { |
| 1430 if (m_stopped) | 1431 if (m_stopped) |
| 1431 return; | 1432 return; |
| 1432 | 1433 |
| 1433 HeapVector<Member<EventWrapper>> events; | 1434 HeapVector<Member<EventWrapper>> events; |
| 1434 events.swap(m_scheduledEvents); | 1435 events.swap(m_scheduledEvents); |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1471 DEFINE_TRACE(RTCPeerConnection) { | 1472 DEFINE_TRACE(RTCPeerConnection) { |
| 1472 visitor->trace(m_localStreams); | 1473 visitor->trace(m_localStreams); |
| 1473 visitor->trace(m_remoteStreams); | 1474 visitor->trace(m_remoteStreams); |
| 1474 visitor->trace(m_dispatchScheduledEventRunner); | 1475 visitor->trace(m_dispatchScheduledEventRunner); |
| 1475 visitor->trace(m_scheduledEvents); | 1476 visitor->trace(m_scheduledEvents); |
| 1476 EventTargetWithInlineData::trace(visitor); | 1477 EventTargetWithInlineData::trace(visitor); |
| 1477 SuspendableObject::trace(visitor); | 1478 SuspendableObject::trace(visitor); |
| 1478 } | 1479 } |
| 1479 | 1480 |
| 1480 } // namespace blink | 1481 } // namespace blink |
| OLD | NEW |