| 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 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 324 if (mediaConstraints.isObject()) | 324 if (mediaConstraints.isObject()) |
| 325 UseCounter::count(context, UseCounter::RTCPeerConnectionConstructorConst
raints); | 325 UseCounter::count(context, UseCounter::RTCPeerConnectionConstructorConst
raints); |
| 326 else | 326 else |
| 327 UseCounter::count(context, UseCounter::RTCPeerConnectionConstructorCompl
iant); | 327 UseCounter::count(context, UseCounter::RTCPeerConnectionConstructorCompl
iant); |
| 328 | 328 |
| 329 RTCConfiguration* configuration = parseConfiguration(rtcConfiguration, excep
tionState); | 329 RTCConfiguration* configuration = parseConfiguration(rtcConfiguration, excep
tionState); |
| 330 if (exceptionState.hadException()) | 330 if (exceptionState.hadException()) |
| 331 return 0; | 331 return 0; |
| 332 | 332 |
| 333 MediaErrorState mediaErrorState; | 333 MediaErrorState mediaErrorState; |
| 334 WebMediaConstraints constraints = MediaConstraintsImpl::create(mediaConstrai
nts, mediaErrorState); | 334 WebMediaConstraints constraints = MediaConstraintsImpl::create(context, medi
aConstraints, mediaErrorState); |
| 335 if (mediaErrorState.hadException()) { | 335 if (mediaErrorState.hadException()) { |
| 336 mediaErrorState.raiseException(exceptionState); | 336 mediaErrorState.raiseException(exceptionState); |
| 337 return 0; | 337 return 0; |
| 338 } | 338 } |
| 339 | 339 |
| 340 RTCPeerConnection* peerConnection = new RTCPeerConnection(context, configura
tion, constraints, exceptionState); | 340 RTCPeerConnection* peerConnection = new RTCPeerConnection(context, configura
tion, constraints, exceptionState); |
| 341 peerConnection->suspendIfNeeded(); | 341 peerConnection->suspendIfNeeded(); |
| 342 if (exceptionState.hadException()) | 342 if (exceptionState.hadException()) |
| 343 return 0; | 343 return 0; |
| 344 | 344 |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 410 | 410 |
| 411 if (offerOptions) { | 411 if (offerOptions) { |
| 412 if (offerOptions->offerToReceiveAudio() != -1 || offerOptions->offerToRe
ceiveVideo() != -1) | 412 if (offerOptions->offerToReceiveAudio() != -1 || offerOptions->offerToRe
ceiveVideo() != -1) |
| 413 UseCounter::count(context, UseCounter::RTCPeerConnectionCreateOfferL
egacyOfferOptions); | 413 UseCounter::count(context, UseCounter::RTCPeerConnectionCreateOfferL
egacyOfferOptions); |
| 414 else if (errorCallback) | 414 else if (errorCallback) |
| 415 UseCounter::count(context, UseCounter::RTCPeerConnectionCreateOfferL
egacyCompliant); | 415 UseCounter::count(context, UseCounter::RTCPeerConnectionCreateOfferL
egacyCompliant); |
| 416 | 416 |
| 417 m_peerHandler->createOffer(request, offerOptions); | 417 m_peerHandler->createOffer(request, offerOptions); |
| 418 } else { | 418 } else { |
| 419 MediaErrorState mediaErrorState; | 419 MediaErrorState mediaErrorState; |
| 420 WebMediaConstraints constraints = MediaConstraintsImpl::create(rtcOfferO
ptions, mediaErrorState); | 420 WebMediaConstraints constraints = MediaConstraintsImpl::create(context,
rtcOfferOptions, mediaErrorState); |
| 421 if (mediaErrorState.hadException()) { | 421 if (mediaErrorState.hadException()) { |
| 422 mediaErrorState.raiseException(exceptionState); | 422 mediaErrorState.raiseException(exceptionState); |
| 423 return; | 423 return; |
| 424 } | 424 } |
| 425 | 425 |
| 426 if (!constraints.isEmpty()) | 426 if (!constraints.isEmpty()) |
| 427 UseCounter::count(context, UseCounter::RTCPeerConnectionCreateOfferL
egacyConstraints); | 427 UseCounter::count(context, UseCounter::RTCPeerConnectionCreateOfferL
egacyConstraints); |
| 428 else if (errorCallback) | 428 else if (errorCallback) |
| 429 UseCounter::count(context, UseCounter::RTCPeerConnectionCreateOfferL
egacyCompliant); | 429 UseCounter::count(context, UseCounter::RTCPeerConnectionCreateOfferL
egacyCompliant); |
| 430 | 430 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 443 UseCounter::count(context, UseCounter::RTCPeerConnectionCreateAnswerLega
cyConstraints); | 443 UseCounter::count(context, UseCounter::RTCPeerConnectionCreateAnswerLega
cyConstraints); |
| 444 else if (errorCallback) | 444 else if (errorCallback) |
| 445 UseCounter::count(context, UseCounter::RTCPeerConnectionCreateAnswerLega
cyCompliant); | 445 UseCounter::count(context, UseCounter::RTCPeerConnectionCreateAnswerLega
cyCompliant); |
| 446 | 446 |
| 447 if (throwExceptionIfSignalingStateClosed(m_signalingState, exceptionState)) | 447 if (throwExceptionIfSignalingStateClosed(m_signalingState, exceptionState)) |
| 448 return; | 448 return; |
| 449 | 449 |
| 450 ASSERT(successCallback); | 450 ASSERT(successCallback); |
| 451 | 451 |
| 452 MediaErrorState mediaErrorState; | 452 MediaErrorState mediaErrorState; |
| 453 WebMediaConstraints constraints = MediaConstraintsImpl::create(mediaConstrai
nts, mediaErrorState); | 453 WebMediaConstraints constraints = MediaConstraintsImpl::create(context, medi
aConstraints, mediaErrorState); |
| 454 if (mediaErrorState.hadException()) { | 454 if (mediaErrorState.hadException()) { |
| 455 mediaErrorState.raiseException(exceptionState); | 455 mediaErrorState.raiseException(exceptionState); |
| 456 return; | 456 return; |
| 457 } | 457 } |
| 458 | 458 |
| 459 RTCSessionDescriptionRequest* request = RTCSessionDescriptionRequestImpl::cr
eate(executionContext(), this, successCallback, errorCallback); | 459 RTCSessionDescriptionRequest* request = RTCSessionDescriptionRequestImpl::cr
eate(executionContext(), this, successCallback, errorCallback); |
| 460 m_peerHandler->createAnswer(request, constraints); | 460 m_peerHandler->createAnswer(request, constraints); |
| 461 } | 461 } |
| 462 | 462 |
| 463 void RTCPeerConnection::setLocalDescription(ExecutionContext* context, RTCSessio
nDescription* sessionDescription, VoidCallback* successCallback, RTCErrorCallbac
k* errorCallback, ExceptionState& exceptionState) | 463 void RTCPeerConnection::setLocalDescription(ExecutionContext* context, RTCSessio
nDescription* sessionDescription, VoidCallback* successCallback, RTCErrorCallbac
k* errorCallback, ExceptionState& exceptionState) |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 511 | 511 |
| 512 RTCSessionDescription* RTCPeerConnection::remoteDescription() | 512 RTCSessionDescription* RTCPeerConnection::remoteDescription() |
| 513 { | 513 { |
| 514 WebRTCSessionDescription webSessionDescription = m_peerHandler->remoteDescri
ption(); | 514 WebRTCSessionDescription webSessionDescription = m_peerHandler->remoteDescri
ption(); |
| 515 if (webSessionDescription.isNull()) | 515 if (webSessionDescription.isNull()) |
| 516 return nullptr; | 516 return nullptr; |
| 517 | 517 |
| 518 return RTCSessionDescription::create(webSessionDescription); | 518 return RTCSessionDescription::create(webSessionDescription); |
| 519 } | 519 } |
| 520 | 520 |
| 521 void RTCPeerConnection::updateIce(const Dictionary& rtcConfiguration, const Dict
ionary& mediaConstraints, ExceptionState& exceptionState) | 521 void RTCPeerConnection::updateIce(ExecutionContext* context, const Dictionary& r
tcConfiguration, const Dictionary& mediaConstraints, ExceptionState& exceptionSt
ate) |
| 522 { | 522 { |
| 523 if (throwExceptionIfSignalingStateClosed(m_signalingState, exceptionState)) | 523 if (throwExceptionIfSignalingStateClosed(m_signalingState, exceptionState)) |
| 524 return; | 524 return; |
| 525 | 525 |
| 526 RTCConfiguration* configuration = parseConfiguration(rtcConfiguration, excep
tionState); | 526 RTCConfiguration* configuration = parseConfiguration(rtcConfiguration, excep
tionState); |
| 527 if (exceptionState.hadException()) | 527 if (exceptionState.hadException()) |
| 528 return; | 528 return; |
| 529 | 529 |
| 530 MediaErrorState mediaErrorState; | 530 MediaErrorState mediaErrorState; |
| 531 WebMediaConstraints constraints = MediaConstraintsImpl::create(mediaConstrai
nts, mediaErrorState); | 531 WebMediaConstraints constraints = MediaConstraintsImpl::create(context, medi
aConstraints, mediaErrorState); |
| 532 if (mediaErrorState.hadException()) { | 532 if (mediaErrorState.hadException()) { |
| 533 mediaErrorState.raiseException(exceptionState); | 533 mediaErrorState.raiseException(exceptionState); |
| 534 return; | 534 return; |
| 535 } | 535 } |
| 536 | 536 |
| 537 bool valid = m_peerHandler->updateICE(configuration, constraints); | 537 bool valid = m_peerHandler->updateICE(configuration, constraints); |
| 538 if (!valid) | 538 if (!valid) |
| 539 exceptionState.throwDOMException(SyntaxError, "Could not update the ICE
Agent with the given configuration."); | 539 exceptionState.throwDOMException(SyntaxError, "Could not update the ICE
Agent with the given configuration."); |
| 540 } | 540 } |
| 541 | 541 |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 689 case ICEConnectionStateDisconnected: | 689 case ICEConnectionStateDisconnected: |
| 690 return "disconnected"; | 690 return "disconnected"; |
| 691 case ICEConnectionStateClosed: | 691 case ICEConnectionStateClosed: |
| 692 return "closed"; | 692 return "closed"; |
| 693 } | 693 } |
| 694 | 694 |
| 695 ASSERT_NOT_REACHED(); | 695 ASSERT_NOT_REACHED(); |
| 696 return String(); | 696 return String(); |
| 697 } | 697 } |
| 698 | 698 |
| 699 void RTCPeerConnection::addStream(MediaStream* stream, const Dictionary& mediaCo
nstraints, ExceptionState& exceptionState) | 699 void RTCPeerConnection::addStream(ExecutionContext* context, MediaStream* stream
, const Dictionary& mediaConstraints, ExceptionState& exceptionState) |
| 700 { | 700 { |
| 701 if (throwExceptionIfSignalingStateClosed(m_signalingState, exceptionState)) | 701 if (throwExceptionIfSignalingStateClosed(m_signalingState, exceptionState)) |
| 702 return; | 702 return; |
| 703 | 703 |
| 704 if (!stream) { | 704 if (!stream) { |
| 705 exceptionState.throwDOMException(TypeMismatchError, ExceptionMessages::a
rgumentNullOrIncorrectType(1, "MediaStream")); | 705 exceptionState.throwDOMException(TypeMismatchError, ExceptionMessages::a
rgumentNullOrIncorrectType(1, "MediaStream")); |
| 706 return; | 706 return; |
| 707 } | 707 } |
| 708 | 708 |
| 709 if (m_localStreams.contains(stream)) | 709 if (m_localStreams.contains(stream)) |
| 710 return; | 710 return; |
| 711 | 711 |
| 712 MediaErrorState mediaErrorState; | 712 MediaErrorState mediaErrorState; |
| 713 WebMediaConstraints constraints = MediaConstraintsImpl::create(mediaConstrai
nts, mediaErrorState); | 713 WebMediaConstraints constraints = MediaConstraintsImpl::create(context, medi
aConstraints, mediaErrorState); |
| 714 if (mediaErrorState.hadException()) { | 714 if (mediaErrorState.hadException()) { |
| 715 mediaErrorState.raiseException(exceptionState); | 715 mediaErrorState.raiseException(exceptionState); |
| 716 return; | 716 return; |
| 717 } | 717 } |
| 718 | 718 |
| 719 m_localStreams.append(stream); | 719 m_localStreams.append(stream); |
| 720 | 720 |
| 721 bool valid = m_peerHandler->addStream(stream->descriptor(), constraints); | 721 bool valid = m_peerHandler->addStream(stream->descriptor(), constraints); |
| 722 if (!valid) | 722 if (!valid) |
| 723 exceptionState.throwDOMException(SyntaxError, "Unable to add the provide
d stream."); | 723 exceptionState.throwDOMException(SyntaxError, "Unable to add the provide
d stream."); |
| (...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1049 { | 1049 { |
| 1050 visitor->trace(m_localStreams); | 1050 visitor->trace(m_localStreams); |
| 1051 visitor->trace(m_remoteStreams); | 1051 visitor->trace(m_remoteStreams); |
| 1052 visitor->trace(m_dispatchScheduledEventRunner); | 1052 visitor->trace(m_dispatchScheduledEventRunner); |
| 1053 visitor->trace(m_scheduledEvents); | 1053 visitor->trace(m_scheduledEvents); |
| 1054 RefCountedGarbageCollectedEventTargetWithInlineData<RTCPeerConnection>::trac
e(visitor); | 1054 RefCountedGarbageCollectedEventTargetWithInlineData<RTCPeerConnection>::trac
e(visitor); |
| 1055 ActiveDOMObject::trace(visitor); | 1055 ActiveDOMObject::trace(visitor); |
| 1056 } | 1056 } |
| 1057 | 1057 |
| 1058 } // namespace blink | 1058 } // namespace blink |
| OLD | NEW |