Ignore:
Timestamp:
Nov 15, 2015, 2:00:32 PM (10 years ago)
Author:
[email protected]
Message:

WebRTC: Update RTCPeerConnection API and introduce PeerConnectionBackend
https://bugs.webkit.org/show_bug.cgi?id=150166

Reviewed by Eric Carlson and Youenn Fablet

Source/JavaScriptCore:

Added generic isDictionary() function to GlobalObject.js that tests if a
value can be interpreted as a dictionary.

  • builtins/GlobalObject.js:

(isDictionary):

  • runtime/JSGlobalObject.cpp:

(JSC::JSGlobalObject::init):

Source/WebCore:

This change introduces PeerConnectionBackend which is a WebCore interface
that allows RTCPeerConnection to have platform abstractions at different
levels. For example, the MediaEndpoint interface [1] is a lower level
WebRTC backend abstraction where a big part of the WebRTC specification
is implemented in WebCore to be reusable. RTCPeerConnectionHandler (in
the repo today) is on the other hand a higher level WebRTC backend
abstraction where the calls are mostly forwarded directly to the
backend. The PeerConnectionBackend interface facilitates both approaches.

RTCPeerConnection

| (has)
|

PeerConnectionBackend

| |
| | (realizes)
| MediaEndpointPeerConnection
| | (has)
| |
| MediaEndpoint (platform interface)
|
| (realizes)

RTCPeerHandlerPeerConnection

| (has)
|

RCPeerConnectionHandler (existing platform interface)

Notable changes:

# Overloaded methods on RTCPeerConnection (Promise + legacy callback
signatures) are implemented with JSBuiltins.

# "Queued operations" ([1] Section 4.3.1) is implemented in JS bindings
with Promises.

# New RTCPeerConnection features

  • add/removeTrack()
  • pending/currentLocal/RemoteDescription attributes
  • RTCRtpSender/Receiver

# Information carrying objects like RTCSessionDescription and
RTCCandidate don't encapsulate a "mirrored" platform object anymore.

# Remove RTCPeerConnection specific callback implementations (not used
with JS bindings)

[1] http://webkit.org/b/150165
[2] https://w3c.github.io/webrtc-pc/archives/20151006/webrtc.html

Tests: Mock should be added to test future WebRTC backend abstractions.

  • CMakeLists.txt:
  • DerivedSources.make:
  • Modules/mediastream/PeerConnectionBackend.cpp: Added.

(WebCore::createPeerConnectionBackend):

  • Modules/mediastream/PeerConnectionBackend.h: Added.

(WebCore::PeerConnectionBackendClient::~PeerConnectionBackendClient):
(WebCore::PeerConnectionBackend::~PeerConnectionBackend):

  • Modules/mediastream/PeerConnectionStates.h: Added.
  • Modules/mediastream/RTCConfiguration.cpp: Added.

(WebCore::validateIceServerURL):
(WebCore::parseIceServer):
(WebCore::RTCConfiguration::create):
(WebCore::RTCConfiguration::RTCConfiguration):
(WebCore::RTCConfiguration::initialize):

  • Modules/mediastream/RTCConfiguration.h:

(WebCore::RTCConfiguration::iceTransportPolicy):
(WebCore::RTCConfiguration::bundlePolicy):
(WebCore::RTCConfiguration::iceServers):
(WebCore::RTCConfiguration::create): Deleted.
(WebCore::RTCConfiguration::appendServer): Deleted.
(WebCore::RTCConfiguration::numberOfServers): Deleted.
(WebCore::RTCConfiguration::server): Deleted.
(WebCore::RTCConfiguration::iceTransports): Deleted.
(WebCore::RTCConfiguration::setIceTransports): Deleted.
(WebCore::RTCConfiguration::requestIdentity): Deleted.
(WebCore::RTCConfiguration::setRequestIdentity): Deleted.
(WebCore::RTCConfiguration::privateConfiguration): Deleted.
(WebCore::RTCConfiguration::RTCConfiguration): Deleted.

  • Modules/mediastream/RTCConfiguration.idl:
  • Modules/mediastream/RTCIceCandidate.cpp:

(WebCore::RTCIceCandidate::create):
(WebCore::RTCIceCandidate::RTCIceCandidate):
(WebCore::RTCIceCandidate::~RTCIceCandidate): Deleted.
(WebCore::RTCIceCandidate::candidate): Deleted.
(WebCore::RTCIceCandidate::sdpMid): Deleted.
(WebCore::RTCIceCandidate::sdpMLineIndex): Deleted.
(WebCore::RTCIceCandidate::descriptor): Deleted.

  • Modules/mediastream/RTCIceCandidate.h:

(WebCore::RTCIceCandidate::~RTCIceCandidate):
(WebCore::RTCIceCandidate::candidate):
(WebCore::RTCIceCandidate::setCandidate):
(WebCore::RTCIceCandidate::sdpMid):
(WebCore::RTCIceCandidate::setSdpMid):
(WebCore::RTCIceCandidate::sdpMLineIndex):
(WebCore::RTCIceCandidate::setSdpMLineIndex):

  • Modules/mediastream/RTCIceCandidate.idl:
  • Modules/mediastream/RTCIceCandidateEvent.cpp:

(WebCore::RTCIceCandidateEvent::create):
(WebCore::RTCIceCandidateEvent::RTCIceCandidateEvent):

  • Modules/mediastream/RTCIceCandidateEvent.h:
  • Modules/mediastream/RTCIceServer.h:

(WebCore::RTCIceServer::urls):
(WebCore::RTCIceServer::credential):
(WebCore::RTCIceServer::username):
(WebCore::RTCIceServer::RTCIceServer):
(WebCore::RTCIceServer::create): Deleted.
(WebCore::RTCIceServer::privateServer): Deleted.

  • Modules/mediastream/RTCOfferAnswerOptions.cpp:

(WebCore::RTCOfferAnswerOptions::RTCOfferAnswerOptions):
(WebCore::RTCOfferAnswerOptions::initialize):
(WebCore::RTCOfferOptions::RTCOfferOptions):
(WebCore::RTCOfferOptions::initialize):
(WebCore::RTCAnswerOptions::create):
(WebCore::RTCAnswerOptions::initialize):
(WebCore::RTCOfferAnswerOptions::create): Deleted.

  • Modules/mediastream/RTCOfferAnswerOptions.h:

(WebCore::RTCOfferAnswerOptions::voiceActivityDetection):
(WebCore::RTCOfferOptions::offerToReceiveVideo):
(WebCore::RTCOfferOptions::offerToReceiveAudio):
(WebCore::RTCOfferOptions::iceRestart):
(WebCore::RTCAnswerOptions::RTCAnswerOptions):
(WebCore::RTCOfferAnswerOptions::requestIdentity): Deleted.
(WebCore::RTCOfferAnswerOptions::privateOfferAnswerOptions): Deleted.
(WebCore::RTCOfferAnswerOptions::RTCOfferAnswerOptions): Deleted.
(WebCore::RTCOfferOptions::voiceActivityDetection): Deleted.
(WebCore::RTCOfferOptions::privateOfferOptions): Deleted.
(WebCore::RTCOfferOptions::~RTCOfferOptions): Deleted.
(WebCore::RTCOfferOptions::RTCOfferOptions): Deleted.

  • Modules/mediastream/RTCPeerConnection.cpp:

(WebCore::RTCPeerConnection::create):
(WebCore::RTCPeerConnection::RTCPeerConnection):
(WebCore::RTCPeerConnection::getSenders):
(WebCore::RTCPeerConnection::getReceivers):
(WebCore::RTCPeerConnection::addTrack):
(WebCore::RTCPeerConnection::removeTrack):
(WebCore::RTCPeerConnection::queuedCreateOffer):
(WebCore::RTCPeerConnection::queuedCreateAnswer):
(WebCore::RTCPeerConnection::queuedSetLocalDescription):
(WebCore::RTCPeerConnection::localDescription):
(WebCore::RTCPeerConnection::currentLocalDescription):
(WebCore::RTCPeerConnection::pendingLocalDescription):
(WebCore::RTCPeerConnection::queuedSetRemoteDescription):
(WebCore::RTCPeerConnection::remoteDescription):
(WebCore::RTCPeerConnection::currentRemoteDescription):
(WebCore::RTCPeerConnection::pendingRemoteDescription):
(WebCore::RTCPeerConnection::queuedAddIceCandidate):
(WebCore::RTCPeerConnection::signalingState):
(WebCore::RTCPeerConnection::iceGatheringState):
(WebCore::RTCPeerConnection::iceConnectionState):
(WebCore::RTCPeerConnection::setConfiguration):
(WebCore::RTCPeerConnection::privateGetStats):
(WebCore::RTCPeerConnection::createDataChannel):
(WebCore::RTCPeerConnection::close):
(WebCore::RTCPeerConnection::stop):
(WebCore::RTCPeerConnection::setSignalingState):
(WebCore::RTCPeerConnection::updateIceGatheringState):
(WebCore::RTCPeerConnection::updateIceConnectionState):
(WebCore::RTCPeerConnection::scheduleNegotiationNeededEvent):
(WebCore::RTCPeerConnection::fireEvent):
(WebCore::validateIceServerURL): Deleted.
(WebCore::processIceServer): Deleted.
(WebCore::RTCPeerConnection::parseConfiguration): Deleted.
(WebCore::RTCPeerConnection::~RTCPeerConnection): Deleted.
(WebCore::RTCPeerConnection::createOffer): Deleted.
(WebCore::RTCPeerConnection::createAnswer): Deleted.
(WebCore::RTCPeerConnection::checkStateForLocalDescription): Deleted.
(WebCore::RTCPeerConnection::checkStateForRemoteDescription): Deleted.
(WebCore::RTCPeerConnection::setLocalDescription): Deleted.
(WebCore::RTCPeerConnection::setRemoteDescription): Deleted.
(WebCore::RTCPeerConnection::updateIce): Deleted.
(WebCore::RTCPeerConnection::addIceCandidate): Deleted.
(WebCore::RTCPeerConnection::addStream): Deleted.
(WebCore::RTCPeerConnection::removeStream): Deleted.
(WebCore::RTCPeerConnection::getLocalStreams): Deleted.
(WebCore::RTCPeerConnection::getRemoteStreams): Deleted.
(WebCore::RTCPeerConnection::getStreamById): Deleted.
(WebCore::RTCPeerConnection::getStats): Deleted.
(WebCore::RTCPeerConnection::hasLocalStreamWithTrackId): Deleted.
(WebCore::RTCPeerConnection::createDTMFSender): Deleted.
(WebCore::RTCPeerConnection::negotiationNeeded): Deleted.
(WebCore::RTCPeerConnection::didGenerateIceCandidate): Deleted.
(WebCore::RTCPeerConnection::didChangeSignalingState): Deleted.
(WebCore::RTCPeerConnection::didChangeIceGatheringState): Deleted.
(WebCore::RTCPeerConnection::didChangeIceConnectionState): Deleted.
(WebCore::RTCPeerConnection::didAddRemoteStream): Deleted.
(WebCore::RTCPeerConnection::didRemoveRemoteStream): Deleted.
(WebCore::RTCPeerConnection::didAddRemoteDataChannel): Deleted.
(WebCore::RTCPeerConnection::didAddOrRemoveTrack): Deleted.
(WebCore::RTCPeerConnection::changeSignalingState): Deleted.
(WebCore::RTCPeerConnection::changeIceGatheringState): Deleted.
(WebCore::RTCPeerConnection::changeIceConnectionState): Deleted.
(WebCore::RTCPeerConnection::scheduleDispatchEvent): Deleted.
(WebCore::RTCPeerConnection::scheduledEventTimerFired): Deleted.

  • Modules/mediastream/RTCPeerConnection.h:
  • Modules/mediastream/RTCPeerConnection.idl:
  • Modules/mediastream/RTCPeerConnection.js: Added.

(createOffer):
(createAnswer):
(setLocalDescription):
(setRemoteDescription):
(addIceCandidate):
(getStats):

  • Modules/mediastream/RTCPeerConnectionErrorCallback.h:

(WebCore::RTCPeerConnectionErrorCallback::~RTCPeerConnectionErrorCallback): Deleted.

  • Modules/mediastream/RTCPeerConnectionInternals.js: Added.

(runNext):
(enqueueOperation):
(setLocalOrRemoteDescription):
(extractCallbackArg):

  • Modules/mediastream/RTCRtpReceiver.cpp: Added.

(WebCore::RTCRtpReceiver::RTCRtpReceiver):

  • Modules/mediastream/RTCRtpReceiver.h: Added.

(WebCore::RTCRtpReceiver::create):

  • Modules/mediastream/RTCRtpReceiver.idl: Added.
  • Modules/mediastream/RTCRtpSender.cpp: Added.

(WebCore::RTCRtpSender::RTCRtpSender):

  • Modules/mediastream/RTCRtpSender.h: Added.

(WebCore::RTCRtpSender::create):
(WebCore::RTCRtpSender::mediaStreamId):

  • Modules/mediastream/RTCRtpSender.idl: Added.
  • Modules/mediastream/RTCRtpSenderReceiverBase.h: Added.

(WebCore::RTCRtpSenderReceiverBase::~RTCRtpSenderReceiverBase):
(WebCore::RTCRtpSenderReceiverBase::track):
(WebCore::RTCRtpSenderReceiverBase::RTCRtpSenderReceiverBase):

  • Modules/mediastream/RTCSessionDescription.cpp:

(WebCore::RTCSessionDescription::create):
(WebCore::RTCSessionDescription::RTCSessionDescription):
(WebCore::RTCSessionDescription::setType):
(WebCore::RTCSessionDescription::~RTCSessionDescription): Deleted.
(WebCore::RTCSessionDescription::type): Deleted.
(WebCore::RTCSessionDescription::sdp): Deleted.
(WebCore::RTCSessionDescription::setSdp): Deleted.
(WebCore::RTCSessionDescription::descriptor): Deleted.

  • Modules/mediastream/RTCSessionDescription.h:

(WebCore::RTCSessionDescription::~RTCSessionDescription):
(WebCore::RTCSessionDescription::type):
(WebCore::RTCSessionDescription::sdp):
(WebCore::RTCSessionDescription::setSdp):

  • Modules/mediastream/RTCSessionDescriptionCallback.h:

(WebCore::RTCSessionDescriptionCallback::~RTCSessionDescriptionCallback): Deleted.

  • Modules/mediastream/RTCSessionDescriptionRequestImpl.cpp: Removed.

(WebCore::RTCSessionDescriptionRequestImpl::create): Deleted.
(WebCore::RTCSessionDescriptionRequestImpl::RTCSessionDescriptionRequestImpl): Deleted.
(WebCore::RTCSessionDescriptionRequestImpl::~RTCSessionDescriptionRequestImpl): Deleted.
(WebCore::RTCSessionDescriptionRequestImpl::requestSucceeded): Deleted.
(WebCore::RTCSessionDescriptionRequestImpl::requestFailed): Deleted.
(WebCore::RTCSessionDescriptionRequestImpl::stop): Deleted.
(WebCore::RTCSessionDescriptionRequestImpl::activeDOMObjectName): Deleted.
(WebCore::RTCSessionDescriptionRequestImpl::canSuspendForPageCache): Deleted.
(WebCore::RTCSessionDescriptionRequestImpl::clear): Deleted.

  • Modules/mediastream/RTCSessionDescriptionRequestImpl.h: Removed.
  • Modules/mediastream/RTCStatsCallback.h: Removed.

(WebCore::RTCStatsCallback::~RTCStatsCallback): Deleted.

  • Modules/mediastream/RTCStatsCallback.idl: Removed.
  • Modules/mediastream/RTCStatsRequestImpl.cpp: Removed.

(WebCore::RTCStatsRequestImpl::create): Deleted.
(WebCore::RTCStatsRequestImpl::RTCStatsRequestImpl): Deleted.
(WebCore::RTCStatsRequestImpl::~RTCStatsRequestImpl): Deleted.
(WebCore::RTCStatsRequestImpl::createResponse): Deleted.
(WebCore::RTCStatsRequestImpl::hasSelector): Deleted.
(WebCore::RTCStatsRequestImpl::track): Deleted.
(WebCore::RTCStatsRequestImpl::requestSucceeded): Deleted.
(WebCore::RTCStatsRequestImpl::requestFailed): Deleted.
(WebCore::RTCStatsRequestImpl::stop): Deleted.
(WebCore::RTCStatsRequestImpl::activeDOMObjectName): Deleted.
(WebCore::RTCStatsRequestImpl::canSuspendForPageCache): Deleted.
(WebCore::RTCStatsRequestImpl::clear): Deleted.

  • Modules/mediastream/RTCStatsRequestImpl.h: Removed.
  • Modules/mediastream/RTCTrackEvent.cpp: Added.

(WebCore::RTCTrackEventInit::RTCTrackEventInit):
(WebCore::RTCTrackEvent::create):
(WebCore::RTCTrackEvent::RTCTrackEvent):

  • Modules/mediastream/RTCTrackEvent.h: Added.

(WebCore::RTCTrackEvent::receiver):
(WebCore::RTCTrackEvent::track):
(WebCore::RTCTrackEvent::eventInterface):

  • Modules/mediastream/RTCTrackEvent.idl: Added.
  • Modules/mediastream/RTCVoidRequestImpl.cpp: Removed.

(WebCore::RTCVoidRequestImpl::create): Deleted.
(WebCore::RTCVoidRequestImpl::RTCVoidRequestImpl): Deleted.
(WebCore::RTCVoidRequestImpl::~RTCVoidRequestImpl): Deleted.
(WebCore::RTCVoidRequestImpl::requestSucceeded): Deleted.
(WebCore::RTCVoidRequestImpl::requestFailed): Deleted.
(WebCore::RTCVoidRequestImpl::stop): Deleted.
(WebCore::RTCVoidRequestImpl::activeDOMObjectName): Deleted.
(WebCore::RTCVoidRequestImpl::canSuspendForPageCache): Deleted.
(WebCore::RTCVoidRequestImpl::clear): Deleted.

  • WebCore.xcodeproj/project.pbxproj:
  • bindings/js/JSDictionary.cpp:

(WebCore::JSDictionary::convertValue):

  • bindings/js/JSDictionary.h:
  • bindings/js/WebCoreBuiltinNames.h:
  • bindings/js/WebCoreJSBuiltinInternals.h:

(WebCore::JSBuiltinInternalFunctions::JSBuiltinInternalFunctions):
(WebCore::JSBuiltinInternalFunctions::rTCPeerConnectionInternals):
(WebCore::JSBuiltinInternalFunctions::visit):
(WebCore::JSBuiltinInternalFunctions::init):

  • bindings/js/WebCoreJSBuiltins.cpp:
  • bindings/js/WebCoreJSBuiltins.h:

(WebCore::JSBuiltinFunctions::JSBuiltinFunctions):
(WebCore::JSBuiltinFunctions::rTCPeerConnectionBuiltins):
(WebCore::JSBuiltinFunctions::rTCPeerConnectionInternalsBuiltins):

  • dom/EventNames.in:

LayoutTests:

Updated expected results (listed below) with the new types added by
this change (RTCRtpSender, RTCRtpReceiver and RTCTrackEvent).

  • platform/efl/js/dom/global-constructors-attributes-expected.txt:
  • platform/gtk/js/dom/global-constructors-attributes-expected.txt:
  • platform/mac-mavericks/js/dom/global-constructors-attributes-expected.txt:
  • platform/mac-yosemite/js/dom/global-constructors-attributes-expected.txt:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/builtins/GlobalObject.js

    r192202 r192464  
    5858    return (object !== null && typeof object === "object") || typeof object === "function";
    5959}
     60
     61function isDictionary(object)
     62{
     63    "use strict";
     64
     65    return typeof object === "undefined" || object == null || typeof object === "object";
     66}
Note: See TracChangeset for help on using the changeset viewer.