Bug 1654399 - pt1 - webidl changes for RTCDtlsTransport. r=webidl,smaug

Partial implementation of RTCDtlsTransport (state and onstatechange)
for wfh.  Stubbed out methods so everything builds.

Differential Revision: https://phabricator.services.mozilla.com/D84459
This commit is contained in:
Michael Froman 2020-08-31 22:54:29 +00:00
Родитель b53dc3619e
Коммит ab2c4d061c
10 изменённых файлов: 83 добавлений и 0 удалений

Просмотреть файл

@ -667,6 +667,10 @@ DOMInterfaces = {
'nativeType': 'nsDOMDataChannel',
},
'RTCDtlsTransport': {
'headerFile': 'RTCDtlsTransport.h'
},
'RTCDTMFSender': {
'headerFile': 'RTCDTMFSender.h'
},

Просмотреть файл

@ -979,6 +979,8 @@ var interfaceNamesInGlobalScope = [
// IMPORTANT: Do not change this list without review from a DOM peer!
{ name: "RTCDataChannelEvent", insecureContext: true },
// IMPORTANT: Do not change this list without review from a DOM peer!
{ name: "RTCDtlsTransport", insecureContext: true },
// IMPORTANT: Do not change this list without review from a DOM peer!
{ name: "RTCDTMFSender", insecureContext: true },
// IMPORTANT: Do not change this list without review from a DOM peer!
{ name: "RTCDTMFToneChangeEvent", insecureContext: true },

Просмотреть файл

@ -0,0 +1,23 @@
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/.
*
* The origin of this IDL file is
* https://w3c.github.io/webrtc-pc/#rtcdtlstransport-interface
*/
enum RTCDtlsTransportState {
"new",
"connecting",
"connected",
"closed",
"failed"
};
[Pref="media.peerconnection.enabled",
Exposed=Window]
interface RTCDtlsTransport : EventTarget {
readonly attribute RTCDtlsTransportState state;
attribute EventHandler onstatechange;
};

Просмотреть файл

@ -11,6 +11,7 @@
Exposed=Window]
interface RTCRtpReceiver {
readonly attribute MediaStreamTrack track;
readonly attribute RTCDtlsTransport? transport;
Promise<RTCStatsReport> getStats();
[Pref="media.peerconnection.rtpsourcesapi.enabled"]
sequence<RTCRtpContributingSource> getContributingSources();

Просмотреть файл

@ -71,6 +71,7 @@ dictionary RTCRtpParameters {
Exposed=Window]
interface RTCRtpSender {
readonly attribute MediaStreamTrack? track;
readonly attribute RTCDtlsTransport? transport;
Promise<void> setParameters (optional RTCRtpParameters parameters = {});
RTCRtpParameters getParameters();
Promise<void> replaceTrack(MediaStreamTrack? withTrack);

Просмотреть файл

@ -23,5 +23,7 @@ interface TransceiverImpl {
// TODO(bug 1616937): We won't need this once we implement RTCRtpSender in c++
[ChromeOnly]
readonly attribute RTCDTMFSender? dtmf;
[ChromeOnly]
readonly attribute RTCDtlsTransport? dtlsTransport;
};

Просмотреть файл

@ -997,6 +997,7 @@ if CONFIG['MOZ_WEBRTC']:
'RTCCertificate.webidl',
'RTCConfiguration.webidl',
'RTCDataChannel.webidl',
'RTCDtlsTransport.webidl',
'RTCDTMFSender.webidl',
'RTCIceCandidate.webidl',
'RTCIdentityAssertion.webidl',

Просмотреть файл

@ -0,0 +1,45 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef _RTCDtlsTransport_h_
#define _RTCDtlsTransport_h_
#include "mozilla/DOMEventTargetHelper.h"
#include "mozilla/RefPtr.h"
#include "js/RootingAPI.h"
#include "transportlayer.h"
class nsPIDOMWindowInner;
namespace mozilla {
namespace dom {
enum class RTCDtlsTransportState : uint8_t;
class RTCDtlsTransport : public DOMEventTargetHelper {
public:
explicit RTCDtlsTransport(nsPIDOMWindowInner* aWindow);
// nsISupports
NS_DECL_ISUPPORTS_INHERITED
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(RTCDtlsTransport,
DOMEventTargetHelper)
// webidl
JSObject* WrapObject(JSContext* aCx,
JS::Handle<JSObject*> aGivenProto) override;
IMPL_EVENT_HANDLER(statechange)
RTCDtlsTransportState State() const { return mState; }
void UpdateState(TransportLayer::State aState);
private:
virtual ~RTCDtlsTransport() = default;
RTCDtlsTransportState mState;
};
} // namespace dom
} // namespace mozilla
#endif // _RTCDtlsTransport_h_

Просмотреть файл

@ -27,6 +27,7 @@ class JsepTransceiver;
namespace dom {
class MediaStreamTrack;
class Promise;
class RTCDtlsTransport;
struct RTCRtpContributingSource;
struct RTCRtpSynchronizationSource;
@ -51,6 +52,7 @@ class RTCRtpReceiver : public nsISupports,
// webidl
MediaStreamTrack* Track() const { return mTrack; }
RTCDtlsTransport* GetTransport() const { return nullptr; }
already_AddRefed<Promise> GetStats();
void GetContributingSources(
nsTArray<dom::RTCRtpContributingSource>& aSources);

Просмотреть файл

@ -32,6 +32,7 @@ class WebRtcCallWrapper;
class JsepTrackNegotiatedDetails;
namespace dom {
class RTCDtlsTransport;
class RTCDTMFSender;
class RTCRtpTransceiver;
struct RTCRtpSourceEntry;
@ -95,6 +96,7 @@ class TransceiverImpl : public nsISupports, public nsWrapperCache {
void SyncWithJS(dom::RTCRtpTransceiver& aJsTransceiver, ErrorResult& aRv);
dom::RTCRtpReceiver* Receiver() const { return mReceiver; }
dom::RTCDTMFSender* GetDtmf() const { return mDtmf; }
dom::RTCDtlsTransport* GetDtlsTransport() const { return nullptr; }
bool CanSendDTMF() const;