| 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 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 206 RefPtr<RTCOfferOptions> rtcOfferOptions = RTCOfferOptions::create(offerToRec
eiveVideo, offerToReceiveAudio, voiceActivityDetection, iceRestart); | 206 RefPtr<RTCOfferOptions> rtcOfferOptions = RTCOfferOptions::create(offerToRec
eiveVideo, offerToReceiveAudio, voiceActivityDetection, iceRestart); |
| 207 return rtcOfferOptions.release(); | 207 return rtcOfferOptions.release(); |
| 208 } | 208 } |
| 209 | 209 |
| 210 RTCPeerConnection* RTCPeerConnection::create(ExecutionContext* context, const Di
ctionary& rtcConfiguration, const Dictionary& mediaConstraints, ExceptionState&
exceptionState) | 210 RTCPeerConnection* RTCPeerConnection::create(ExecutionContext* context, const Di
ctionary& rtcConfiguration, const Dictionary& mediaConstraints, ExceptionState&
exceptionState) |
| 211 { | 211 { |
| 212 RefPtr<RTCConfiguration> configuration = parseConfiguration(rtcConfiguration
, exceptionState); | 212 RefPtr<RTCConfiguration> configuration = parseConfiguration(rtcConfiguration
, exceptionState); |
| 213 if (exceptionState.hadException()) | 213 if (exceptionState.hadException()) |
| 214 return nullptr; | 214 return nullptr; |
| 215 | 215 |
| 216 blink::WebMediaConstraints constraints = MediaConstraintsImpl::create(mediaC
onstraints, exceptionState); | 216 WebMediaConstraints constraints = MediaConstraintsImpl::create(mediaConstrai
nts, exceptionState); |
| 217 if (exceptionState.hadException()) | 217 if (exceptionState.hadException()) |
| 218 return nullptr; | 218 return nullptr; |
| 219 | 219 |
| 220 RTCPeerConnection* peerConnection = adoptRefCountedGarbageCollectedWillBeNoo
p(new RTCPeerConnection(context, configuration.release(), constraints, exception
State)); | 220 RTCPeerConnection* peerConnection = adoptRefCountedGarbageCollectedWillBeNoo
p(new RTCPeerConnection(context, configuration.release(), constraints, exception
State)); |
| 221 peerConnection->suspendIfNeeded(); | 221 peerConnection->suspendIfNeeded(); |
| 222 if (exceptionState.hadException()) | 222 if (exceptionState.hadException()) |
| 223 return nullptr; | 223 return nullptr; |
| 224 | 224 |
| 225 return peerConnection; | 225 return peerConnection; |
| 226 } | 226 } |
| 227 | 227 |
| 228 RTCPeerConnection::RTCPeerConnection(ExecutionContext* context, PassRefPtr<RTCCo
nfiguration> configuration, blink::WebMediaConstraints constraints, ExceptionSta
te& exceptionState) | 228 RTCPeerConnection::RTCPeerConnection(ExecutionContext* context, PassRefPtr<RTCCo
nfiguration> configuration, WebMediaConstraints constraints, ExceptionState& exc
eptionState) |
| 229 : ActiveDOMObject(context) | 229 : ActiveDOMObject(context) |
| 230 , m_signalingState(SignalingStateStable) | 230 , m_signalingState(SignalingStateStable) |
| 231 , m_iceGatheringState(ICEGatheringStateNew) | 231 , m_iceGatheringState(ICEGatheringStateNew) |
| 232 , m_iceConnectionState(ICEConnectionStateNew) | 232 , m_iceConnectionState(ICEConnectionStateNew) |
| 233 , m_dispatchScheduledEventRunner(this, &RTCPeerConnection::dispatchScheduled
Event) | 233 , m_dispatchScheduledEventRunner(this, &RTCPeerConnection::dispatchScheduled
Event) |
| 234 , m_stopped(false) | 234 , m_stopped(false) |
| 235 , m_closed(false) | 235 , m_closed(false) |
| 236 { | 236 { |
| 237 ScriptWrappable::init(this); | 237 ScriptWrappable::init(this); |
| 238 Document* document = toDocument(executionContext()); | 238 Document* document = toDocument(executionContext()); |
| 239 | 239 |
| 240 // If we fail, set |m_closed| and |m_stopped| to true, to avoid hitting the
assert in the destructor. | 240 // If we fail, set |m_closed| and |m_stopped| to true, to avoid hitting the
assert in the destructor. |
| 241 | 241 |
| 242 if (!document->frame()) { | 242 if (!document->frame()) { |
| 243 m_closed = true; | 243 m_closed = true; |
| 244 m_stopped = true; | 244 m_stopped = true; |
| 245 exceptionState.throwDOMException(NotSupportedError, "PeerConnections may
not be created in detached documents."); | 245 exceptionState.throwDOMException(NotSupportedError, "PeerConnections may
not be created in detached documents."); |
| 246 return; | 246 return; |
| 247 } | 247 } |
| 248 | 248 |
| 249 m_peerHandler = adoptPtr(blink::Platform::current()->createRTCPeerConnection
Handler(this)); | 249 m_peerHandler = adoptPtr(Platform::current()->createRTCPeerConnectionHandler
(this)); |
| 250 if (!m_peerHandler) { | 250 if (!m_peerHandler) { |
| 251 m_closed = true; | 251 m_closed = true; |
| 252 m_stopped = true; | 252 m_stopped = true; |
| 253 exceptionState.throwDOMException(NotSupportedError, "No PeerConnection h
andler can be created, perhaps WebRTC is disabled?"); | 253 exceptionState.throwDOMException(NotSupportedError, "No PeerConnection h
andler can be created, perhaps WebRTC is disabled?"); |
| 254 return; | 254 return; |
| 255 } | 255 } |
| 256 | 256 |
| 257 document->frame()->loader().client()->dispatchWillStartUsingPeerConnectionHa
ndler(m_peerHandler.get()); | 257 document->frame()->loader().client()->dispatchWillStartUsingPeerConnectionHa
ndler(m_peerHandler.get()); |
| 258 | 258 |
| 259 if (!m_peerHandler->initialize(configuration, constraints)) { | 259 if (!m_peerHandler->initialize(configuration, constraints)) { |
| (...skipping 20 matching lines...) Expand all Loading... |
| 280 | 280 |
| 281 RefPtr<RTCOfferOptions> offerOptions = parseOfferOptions(rtcOfferOptions, ex
ceptionState); | 281 RefPtr<RTCOfferOptions> offerOptions = parseOfferOptions(rtcOfferOptions, ex
ceptionState); |
| 282 if (exceptionState.hadException()) | 282 if (exceptionState.hadException()) |
| 283 return; | 283 return; |
| 284 | 284 |
| 285 RefPtr<RTCSessionDescriptionRequest> request = RTCSessionDescriptionRequestI
mpl::create(executionContext(), this, successCallback, errorCallback); | 285 RefPtr<RTCSessionDescriptionRequest> request = RTCSessionDescriptionRequestI
mpl::create(executionContext(), this, successCallback, errorCallback); |
| 286 | 286 |
| 287 if (offerOptions) { | 287 if (offerOptions) { |
| 288 m_peerHandler->createOffer(request.release(), offerOptions.release()); | 288 m_peerHandler->createOffer(request.release(), offerOptions.release()); |
| 289 } else { | 289 } else { |
| 290 blink::WebMediaConstraints constraints = MediaConstraintsImpl::create(rt
cOfferOptions, exceptionState); | 290 WebMediaConstraints constraints = MediaConstraintsImpl::create(rtcOfferO
ptions, exceptionState); |
| 291 if (exceptionState.hadException()) | 291 if (exceptionState.hadException()) |
| 292 return; | 292 return; |
| 293 | 293 |
| 294 m_peerHandler->createOffer(request.release(), constraints); | 294 m_peerHandler->createOffer(request.release(), constraints); |
| 295 } | 295 } |
| 296 } | 296 } |
| 297 | 297 |
| 298 void RTCPeerConnection::createAnswer(PassOwnPtr<RTCSessionDescriptionCallback> s
uccessCallback, PassOwnPtr<RTCErrorCallback> errorCallback, const Dictionary& me
diaConstraints, ExceptionState& exceptionState) | 298 void RTCPeerConnection::createAnswer(PassOwnPtr<RTCSessionDescriptionCallback> s
uccessCallback, PassOwnPtr<RTCErrorCallback> errorCallback, const Dictionary& me
diaConstraints, ExceptionState& exceptionState) |
| 299 { | 299 { |
| 300 if (throwExceptionIfSignalingStateClosed(m_signalingState, exceptionState)) | 300 if (throwExceptionIfSignalingStateClosed(m_signalingState, exceptionState)) |
| 301 return; | 301 return; |
| 302 | 302 |
| 303 ASSERT(successCallback); | 303 ASSERT(successCallback); |
| 304 | 304 |
| 305 blink::WebMediaConstraints constraints = MediaConstraintsImpl::create(mediaC
onstraints, exceptionState); | 305 WebMediaConstraints constraints = MediaConstraintsImpl::create(mediaConstrai
nts, exceptionState); |
| 306 if (exceptionState.hadException()) | 306 if (exceptionState.hadException()) |
| 307 return; | 307 return; |
| 308 | 308 |
| 309 RefPtr<RTCSessionDescriptionRequest> request = RTCSessionDescriptionRequestI
mpl::create(executionContext(), this, successCallback, errorCallback); | 309 RefPtr<RTCSessionDescriptionRequest> request = RTCSessionDescriptionRequestI
mpl::create(executionContext(), this, successCallback, errorCallback); |
| 310 m_peerHandler->createAnswer(request.release(), constraints); | 310 m_peerHandler->createAnswer(request.release(), constraints); |
| 311 } | 311 } |
| 312 | 312 |
| 313 void RTCPeerConnection::setLocalDescription(RTCSessionDescription* sessionDescri
ption, PassOwnPtr<VoidCallback> successCallback, PassOwnPtr<RTCErrorCallback> er
rorCallback, ExceptionState& exceptionState) | 313 void RTCPeerConnection::setLocalDescription(RTCSessionDescription* sessionDescri
ption, PassOwnPtr<VoidCallback> successCallback, PassOwnPtr<RTCErrorCallback> er
rorCallback, ExceptionState& exceptionState) |
| 314 { | 314 { |
| 315 if (throwExceptionIfSignalingStateClosed(m_signalingState, exceptionState)) | 315 if (throwExceptionIfSignalingStateClosed(m_signalingState, exceptionState)) |
| 316 return; | 316 return; |
| 317 | 317 |
| 318 if (!sessionDescription) { | 318 if (!sessionDescription) { |
| 319 exceptionState.throwDOMException(TypeMismatchError, ExceptionMessages::a
rgumentNullOrIncorrectType(1, "RTCSessionDescription")); | 319 exceptionState.throwDOMException(TypeMismatchError, ExceptionMessages::a
rgumentNullOrIncorrectType(1, "RTCSessionDescription")); |
| 320 return; | 320 return; |
| 321 } | 321 } |
| 322 | 322 |
| 323 RefPtr<RTCVoidRequest> request = RTCVoidRequestImpl::create(executionContext
(), this, successCallback, errorCallback); | 323 RefPtr<RTCVoidRequest> request = RTCVoidRequestImpl::create(executionContext
(), this, successCallback, errorCallback); |
| 324 m_peerHandler->setLocalDescription(request.release(), sessionDescription->we
bSessionDescription()); | 324 m_peerHandler->setLocalDescription(request.release(), sessionDescription->we
bSessionDescription()); |
| 325 } | 325 } |
| 326 | 326 |
| 327 RTCSessionDescription* RTCPeerConnection::localDescription(ExceptionState& excep
tionState) | 327 RTCSessionDescription* RTCPeerConnection::localDescription(ExceptionState& excep
tionState) |
| 328 { | 328 { |
| 329 blink::WebRTCSessionDescription webSessionDescription = m_peerHandler->local
Description(); | 329 WebRTCSessionDescription webSessionDescription = m_peerHandler->localDescrip
tion(); |
| 330 if (webSessionDescription.isNull()) | 330 if (webSessionDescription.isNull()) |
| 331 return nullptr; | 331 return nullptr; |
| 332 | 332 |
| 333 return RTCSessionDescription::create(webSessionDescription); | 333 return RTCSessionDescription::create(webSessionDescription); |
| 334 } | 334 } |
| 335 | 335 |
| 336 void RTCPeerConnection::setRemoteDescription(RTCSessionDescription* sessionDescr
iption, PassOwnPtr<VoidCallback> successCallback, PassOwnPtr<RTCErrorCallback> e
rrorCallback, ExceptionState& exceptionState) | 336 void RTCPeerConnection::setRemoteDescription(RTCSessionDescription* sessionDescr
iption, PassOwnPtr<VoidCallback> successCallback, PassOwnPtr<RTCErrorCallback> e
rrorCallback, ExceptionState& exceptionState) |
| 337 { | 337 { |
| 338 if (throwExceptionIfSignalingStateClosed(m_signalingState, exceptionState)) | 338 if (throwExceptionIfSignalingStateClosed(m_signalingState, exceptionState)) |
| 339 return; | 339 return; |
| 340 | 340 |
| 341 if (!sessionDescription) { | 341 if (!sessionDescription) { |
| 342 exceptionState.throwDOMException(TypeMismatchError, ExceptionMessages::a
rgumentNullOrIncorrectType(1, "RTCSessionDescription")); | 342 exceptionState.throwDOMException(TypeMismatchError, ExceptionMessages::a
rgumentNullOrIncorrectType(1, "RTCSessionDescription")); |
| 343 return; | 343 return; |
| 344 } | 344 } |
| 345 | 345 |
| 346 RefPtr<RTCVoidRequest> request = RTCVoidRequestImpl::create(executionContext
(), this, successCallback, errorCallback); | 346 RefPtr<RTCVoidRequest> request = RTCVoidRequestImpl::create(executionContext
(), this, successCallback, errorCallback); |
| 347 m_peerHandler->setRemoteDescription(request.release(), sessionDescription->w
ebSessionDescription()); | 347 m_peerHandler->setRemoteDescription(request.release(), sessionDescription->w
ebSessionDescription()); |
| 348 } | 348 } |
| 349 | 349 |
| 350 RTCSessionDescription* RTCPeerConnection::remoteDescription(ExceptionState& exce
ptionState) | 350 RTCSessionDescription* RTCPeerConnection::remoteDescription(ExceptionState& exce
ptionState) |
| 351 { | 351 { |
| 352 blink::WebRTCSessionDescription webSessionDescription = m_peerHandler->remot
eDescription(); | 352 WebRTCSessionDescription webSessionDescription = m_peerHandler->remoteDescri
ption(); |
| 353 if (webSessionDescription.isNull()) | 353 if (webSessionDescription.isNull()) |
| 354 return nullptr; | 354 return nullptr; |
| 355 | 355 |
| 356 return RTCSessionDescription::create(webSessionDescription); | 356 return RTCSessionDescription::create(webSessionDescription); |
| 357 } | 357 } |
| 358 | 358 |
| 359 void RTCPeerConnection::updateIce(const Dictionary& rtcConfiguration, const Dict
ionary& mediaConstraints, ExceptionState& exceptionState) | 359 void RTCPeerConnection::updateIce(const Dictionary& rtcConfiguration, const Dict
ionary& mediaConstraints, ExceptionState& exceptionState) |
| 360 { | 360 { |
| 361 if (throwExceptionIfSignalingStateClosed(m_signalingState, exceptionState)) | 361 if (throwExceptionIfSignalingStateClosed(m_signalingState, exceptionState)) |
| 362 return; | 362 return; |
| 363 | 363 |
| 364 RefPtr<RTCConfiguration> configuration = parseConfiguration(rtcConfiguration
, exceptionState); | 364 RefPtr<RTCConfiguration> configuration = parseConfiguration(rtcConfiguration
, exceptionState); |
| 365 if (exceptionState.hadException()) | 365 if (exceptionState.hadException()) |
| 366 return; | 366 return; |
| 367 | 367 |
| 368 blink::WebMediaConstraints constraints = MediaConstraintsImpl::create(mediaC
onstraints, exceptionState); | 368 WebMediaConstraints constraints = MediaConstraintsImpl::create(mediaConstrai
nts, exceptionState); |
| 369 if (exceptionState.hadException()) | 369 if (exceptionState.hadException()) |
| 370 return; | 370 return; |
| 371 | 371 |
| 372 bool valid = m_peerHandler->updateICE(configuration.release(), constraints); | 372 bool valid = m_peerHandler->updateICE(configuration.release(), constraints); |
| 373 if (!valid) | 373 if (!valid) |
| 374 exceptionState.throwDOMException(SyntaxError, "Could not update the ICE
Agent with the given configuration."); | 374 exceptionState.throwDOMException(SyntaxError, "Could not update the ICE
Agent with the given configuration."); |
| 375 } | 375 } |
| 376 | 376 |
| 377 void RTCPeerConnection::addIceCandidate(RTCIceCandidate* iceCandidate, Exception
State& exceptionState) | 377 void RTCPeerConnection::addIceCandidate(RTCIceCandidate* iceCandidate, Exception
State& exceptionState) |
| 378 { | 378 { |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 474 return; | 474 return; |
| 475 | 475 |
| 476 if (!stream) { | 476 if (!stream) { |
| 477 exceptionState.throwDOMException(TypeMismatchError, ExceptionMessages::a
rgumentNullOrIncorrectType(1, "MediaStream")); | 477 exceptionState.throwDOMException(TypeMismatchError, ExceptionMessages::a
rgumentNullOrIncorrectType(1, "MediaStream")); |
| 478 return; | 478 return; |
| 479 } | 479 } |
| 480 | 480 |
| 481 if (m_localStreams.contains(stream)) | 481 if (m_localStreams.contains(stream)) |
| 482 return; | 482 return; |
| 483 | 483 |
| 484 blink::WebMediaConstraints constraints = MediaConstraintsImpl::create(mediaC
onstraints, exceptionState); | 484 WebMediaConstraints constraints = MediaConstraintsImpl::create(mediaConstrai
nts, exceptionState); |
| 485 if (exceptionState.hadException()) | 485 if (exceptionState.hadException()) |
| 486 return; | 486 return; |
| 487 | 487 |
| 488 m_localStreams.append(stream); | 488 m_localStreams.append(stream); |
| 489 | 489 |
| 490 bool valid = m_peerHandler->addStream(stream->descriptor(), constraints); | 490 bool valid = m_peerHandler->addStream(stream->descriptor(), constraints); |
| 491 if (!valid) | 491 if (!valid) |
| 492 exceptionState.throwDOMException(SyntaxError, "Unable to add the provide
d stream."); | 492 exceptionState.throwDOMException(SyntaxError, "Unable to add the provide
d stream."); |
| 493 } | 493 } |
| 494 | 494 |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 541 RefPtr<RTCStatsRequest> statsRequest = RTCStatsRequestImpl::create(execution
Context(), this, successCallback, selector); | 541 RefPtr<RTCStatsRequest> statsRequest = RTCStatsRequestImpl::create(execution
Context(), this, successCallback, selector); |
| 542 // FIXME: Add passing selector as part of the statsRequest. | 542 // FIXME: Add passing selector as part of the statsRequest. |
| 543 m_peerHandler->getStats(statsRequest.release()); | 543 m_peerHandler->getStats(statsRequest.release()); |
| 544 } | 544 } |
| 545 | 545 |
| 546 RTCDataChannel* RTCPeerConnection::createDataChannel(String label, const Diction
ary& options, ExceptionState& exceptionState) | 546 RTCDataChannel* RTCPeerConnection::createDataChannel(String label, const Diction
ary& options, ExceptionState& exceptionState) |
| 547 { | 547 { |
| 548 if (throwExceptionIfSignalingStateClosed(m_signalingState, exceptionState)) | 548 if (throwExceptionIfSignalingStateClosed(m_signalingState, exceptionState)) |
| 549 return nullptr; | 549 return nullptr; |
| 550 | 550 |
| 551 blink::WebRTCDataChannelInit init; | 551 WebRTCDataChannelInit init; |
| 552 DictionaryHelper::get(options, "ordered", init.ordered); | 552 DictionaryHelper::get(options, "ordered", init.ordered); |
| 553 DictionaryHelper::get(options, "negotiated", init.negotiated); | 553 DictionaryHelper::get(options, "negotiated", init.negotiated); |
| 554 | 554 |
| 555 unsigned short value = 0; | 555 unsigned short value = 0; |
| 556 if (DictionaryHelper::get(options, "id", value)) | 556 if (DictionaryHelper::get(options, "id", value)) |
| 557 init.id = value; | 557 init.id = value; |
| 558 if (DictionaryHelper::get(options, "maxRetransmits", value)) | 558 if (DictionaryHelper::get(options, "maxRetransmits", value)) |
| 559 init.maxRetransmits = value; | 559 init.maxRetransmits = value; |
| 560 if (DictionaryHelper::get(options, "maxRetransmitTime", value)) | 560 if (DictionaryHelper::get(options, "maxRetransmitTime", value)) |
| 561 init.maxRetransmitTime = value; | 561 init.maxRetransmitTime = value; |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 613 changeIceGatheringState(ICEGatheringStateComplete); | 613 changeIceGatheringState(ICEGatheringStateComplete); |
| 614 changeSignalingState(SignalingStateClosed); | 614 changeSignalingState(SignalingStateClosed); |
| 615 } | 615 } |
| 616 | 616 |
| 617 void RTCPeerConnection::negotiationNeeded() | 617 void RTCPeerConnection::negotiationNeeded() |
| 618 { | 618 { |
| 619 ASSERT(!m_closed); | 619 ASSERT(!m_closed); |
| 620 scheduleDispatchEvent(Event::create(EventTypeNames::negotiationneeded)); | 620 scheduleDispatchEvent(Event::create(EventTypeNames::negotiationneeded)); |
| 621 } | 621 } |
| 622 | 622 |
| 623 void RTCPeerConnection::didGenerateICECandidate(const blink::WebRTCICECandidate&
webCandidate) | 623 void RTCPeerConnection::didGenerateICECandidate(const WebRTCICECandidate& webCan
didate) |
| 624 { | 624 { |
| 625 ASSERT(!m_closed); | 625 ASSERT(!m_closed); |
| 626 ASSERT(executionContext()->isContextThread()); | 626 ASSERT(executionContext()->isContextThread()); |
| 627 if (webCandidate.isNull()) | 627 if (webCandidate.isNull()) |
| 628 scheduleDispatchEvent(RTCIceCandidateEvent::create(false, false, nullptr
)); | 628 scheduleDispatchEvent(RTCIceCandidateEvent::create(false, false, nullptr
)); |
| 629 else { | 629 else { |
| 630 RTCIceCandidate* iceCandidate = RTCIceCandidate::create(webCandidate); | 630 RTCIceCandidate* iceCandidate = RTCIceCandidate::create(webCandidate); |
| 631 scheduleDispatchEvent(RTCIceCandidateEvent::create(false, false, iceCand
idate)); | 631 scheduleDispatchEvent(RTCIceCandidateEvent::create(false, false, iceCand
idate)); |
| 632 } | 632 } |
| 633 } | 633 } |
| (...skipping 12 matching lines...) Expand all Loading... |
| 646 changeIceGatheringState(newState); | 646 changeIceGatheringState(newState); |
| 647 } | 647 } |
| 648 | 648 |
| 649 void RTCPeerConnection::didChangeICEConnectionState(ICEConnectionState newState) | 649 void RTCPeerConnection::didChangeICEConnectionState(ICEConnectionState newState) |
| 650 { | 650 { |
| 651 ASSERT(!m_closed); | 651 ASSERT(!m_closed); |
| 652 ASSERT(executionContext()->isContextThread()); | 652 ASSERT(executionContext()->isContextThread()); |
| 653 changeIceConnectionState(newState); | 653 changeIceConnectionState(newState); |
| 654 } | 654 } |
| 655 | 655 |
| 656 void RTCPeerConnection::didAddRemoteStream(const blink::WebMediaStream& remoteSt
ream) | 656 void RTCPeerConnection::didAddRemoteStream(const WebMediaStream& remoteStream) |
| 657 { | 657 { |
| 658 ASSERT(!m_closed); | 658 ASSERT(!m_closed); |
| 659 ASSERT(executionContext()->isContextThread()); | 659 ASSERT(executionContext()->isContextThread()); |
| 660 | 660 |
| 661 if (m_signalingState == SignalingStateClosed) | 661 if (m_signalingState == SignalingStateClosed) |
| 662 return; | 662 return; |
| 663 | 663 |
| 664 MediaStream* stream = MediaStream::create(executionContext(), remoteStream); | 664 MediaStream* stream = MediaStream::create(executionContext(), remoteStream); |
| 665 m_remoteStreams.append(stream); | 665 m_remoteStreams.append(stream); |
| 666 | 666 |
| 667 scheduleDispatchEvent(MediaStreamEvent::create(EventTypeNames::addstream, fa
lse, false, stream)); | 667 scheduleDispatchEvent(MediaStreamEvent::create(EventTypeNames::addstream, fa
lse, false, stream)); |
| 668 } | 668 } |
| 669 | 669 |
| 670 void RTCPeerConnection::didRemoveRemoteStream(const blink::WebMediaStream& remot
eStream) | 670 void RTCPeerConnection::didRemoveRemoteStream(const WebMediaStream& remoteStream
) |
| 671 { | 671 { |
| 672 ASSERT(!m_closed); | 672 ASSERT(!m_closed); |
| 673 ASSERT(executionContext()->isContextThread()); | 673 ASSERT(executionContext()->isContextThread()); |
| 674 | 674 |
| 675 MediaStreamDescriptor* streamDescriptor = remoteStream; | 675 MediaStreamDescriptor* streamDescriptor = remoteStream; |
| 676 ASSERT(streamDescriptor->client()); | 676 ASSERT(streamDescriptor->client()); |
| 677 | 677 |
| 678 MediaStream* stream = static_cast<MediaStream*>(streamDescriptor->client()); | 678 MediaStream* stream = static_cast<MediaStream*>(streamDescriptor->client()); |
| 679 stream->streamEnded(); | 679 stream->streamEnded(); |
| 680 | 680 |
| 681 if (m_signalingState == SignalingStateClosed) | 681 if (m_signalingState == SignalingStateClosed) |
| 682 return; | 682 return; |
| 683 | 683 |
| 684 size_t pos = m_remoteStreams.find(stream); | 684 size_t pos = m_remoteStreams.find(stream); |
| 685 ASSERT(pos != kNotFound); | 685 ASSERT(pos != kNotFound); |
| 686 m_remoteStreams.remove(pos); | 686 m_remoteStreams.remove(pos); |
| 687 | 687 |
| 688 scheduleDispatchEvent(MediaStreamEvent::create(EventTypeNames::removestream,
false, false, stream)); | 688 scheduleDispatchEvent(MediaStreamEvent::create(EventTypeNames::removestream,
false, false, stream)); |
| 689 } | 689 } |
| 690 | 690 |
| 691 void RTCPeerConnection::didAddRemoteDataChannel(blink::WebRTCDataChannelHandler*
handler) | 691 void RTCPeerConnection::didAddRemoteDataChannel(WebRTCDataChannelHandler* handle
r) |
| 692 { | 692 { |
| 693 ASSERT(!m_closed); | 693 ASSERT(!m_closed); |
| 694 ASSERT(executionContext()->isContextThread()); | 694 ASSERT(executionContext()->isContextThread()); |
| 695 | 695 |
| 696 if (m_signalingState == SignalingStateClosed) | 696 if (m_signalingState == SignalingStateClosed) |
| 697 return; | 697 return; |
| 698 | 698 |
| 699 RTCDataChannel* channel = RTCDataChannel::create(executionContext(), this, a
doptPtr(handler)); | 699 RTCDataChannel* channel = RTCDataChannel::create(executionContext(), this, a
doptPtr(handler)); |
| 700 m_dataChannels.append(channel); | 700 m_dataChannels.append(channel); |
| 701 | 701 |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 794 visitor->trace(m_localStreams); | 794 visitor->trace(m_localStreams); |
| 795 visitor->trace(m_remoteStreams); | 795 visitor->trace(m_remoteStreams); |
| 796 visitor->trace(m_dataChannels); | 796 visitor->trace(m_dataChannels); |
| 797 #if ENABLE(OILPAN) | 797 #if ENABLE(OILPAN) |
| 798 visitor->trace(m_scheduledEvents); | 798 visitor->trace(m_scheduledEvents); |
| 799 #endif | 799 #endif |
| 800 EventTargetWithInlineData::trace(visitor); | 800 EventTargetWithInlineData::trace(visitor); |
| 801 } | 801 } |
| 802 | 802 |
| 803 } // namespace blink | 803 } // namespace blink |
| OLD | NEW |