From cbe505ba54d0097ab060555ca8cf1984971ea1e8 Mon Sep 17 00:00:00 2001 From: Manish Goregaokar Date: Sat, 26 Jan 2019 08:28:37 -0800 Subject: [PATCH 01/26] Add webxr pref --- resources/prefs.json | 1 + 1 file changed, 1 insertion(+) diff --git a/resources/prefs.json b/resources/prefs.json index cc712caa5f1..7adcf75c0ea 100644 --- a/resources/prefs.json +++ b/resources/prefs.json @@ -18,6 +18,7 @@ "dom.testbinding.enabled": false, "dom.webgl.dom_to_texture.enabled": false, "dom.webgl2.enabled": false, + "dom.webrtc.enabled": false, "dom.webvr.enabled": false, "dom.webvr.event_polling_interval": 500, "gfx.subpixel-text-antialiasing.enabled": true, From 2dd69d0cb05b47f7035a287aba21f93d1cb164ed Mon Sep 17 00:00:00 2001 From: Manish Goregaokar Date: Sat, 26 Jan 2019 08:29:10 -0800 Subject: [PATCH 02/26] Add empty RTCPeerConnection interface --- components/script/dom/mod.rs | 1 + components/script/dom/rtcpeerconnection.rs | 42 ++++++++++ .../dom/webidls/RTCPeerConnection.webidl | 77 +++++++++++++++++++ 3 files changed, 120 insertions(+) create mode 100644 components/script/dom/rtcpeerconnection.rs create mode 100644 components/script/dom/webidls/RTCPeerConnection.webidl diff --git a/components/script/dom/mod.rs b/components/script/dom/mod.rs index 4d8e89d274f..f9a765ad457 100644 --- a/components/script/dom/mod.rs +++ b/components/script/dom/mod.rs @@ -439,6 +439,7 @@ pub mod radionodelist; pub mod range; pub mod request; pub mod response; +pub mod rtcpeerconnection; pub mod screen; pub mod serviceworker; pub mod serviceworkercontainer; diff --git a/components/script/dom/rtcpeerconnection.rs b/components/script/dom/rtcpeerconnection.rs new file mode 100644 index 00000000000..6af09b5c387 --- /dev/null +++ b/components/script/dom/rtcpeerconnection.rs @@ -0,0 +1,42 @@ +/* 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 https://mozilla.org/MPL/2.0/. */ + +use crate::dom::bindings::codegen::Bindings::RTCPeerConnectionBinding; +use crate::dom::bindings::codegen::Bindings::RTCPeerConnectionBinding::RTCConfiguration; +use crate::dom::bindings::error::Fallible; +use crate::dom::bindings::reflector::reflect_dom_object; +use crate::dom::bindings::reflector::DomObject; +use crate::dom::bindings::root::DomRoot; +use crate::dom::eventtarget::EventTarget; +use crate::dom::globalscope::GlobalScope; +use crate::dom::window::Window; +use dom_struct::dom_struct; + +#[dom_struct] +pub struct RTCPeerConnection { + eventtarget: EventTarget, +} + +impl RTCPeerConnection { + pub fn new_inherited() -> RTCPeerConnection { + RTCPeerConnection { + eventtarget: EventTarget::new_inherited(), + } + } + + pub fn new(global: &GlobalScope) -> DomRoot { + reflect_dom_object( + Box::new(RTCPeerConnection::new_inherited()), + global, + RTCPeerConnectionBinding::Wrap, + ) + } + + pub fn Constructor( + window: &Window, + _config: &RTCConfiguration, + ) -> Fallible> { + Ok(RTCPeerConnection::new(&window.global())) + } +} diff --git a/components/script/dom/webidls/RTCPeerConnection.webidl b/components/script/dom/webidls/RTCPeerConnection.webidl new file mode 100644 index 00000000000..ec4ec83028c --- /dev/null +++ b/components/script/dom/webidls/RTCPeerConnection.webidl @@ -0,0 +1,77 @@ +/* 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 https://mozilla.org/MPL/2.0/. */ + +// https://w3c.github.io/webrtc-pc/#interface-definition + +[Constructor(optional RTCConfiguration configuration), + Exposed=Window, Pref="dom.webrtc.enabled"] +interface RTCPeerConnection : EventTarget { + // Promise createOffer(optional RTCOfferOptions options); + // Promise createAnswer(optional RTCAnswerOptions options); + // Promise setLocalDescription(RTCSessionDescriptionInit description); + // readonly attribute RTCSessionDescription? localDescription; + // readonly attribute RTCSessionDescription? currentLocalDescription; + // readonly attribute RTCSessionDescription? pendingLocalDescription; + // Promise setRemoteDescription(RTCSessionDescriptionInit description); + // readonly attribute RTCSessionDescription? remoteDescription; + // readonly attribute RTCSessionDescription? currentRemoteDescription; + // readonly attribute RTCSessionDescription? pendingRemoteDescription; + // Promise addIceCandidate(RTCIceCandidateInit candidate); + // readonly attribute RTCSignalingState signalingState; + // readonly attribute RTCIceGatheringState iceGatheringState; + // readonly attribute RTCIceConnectionState iceConnectionState; + // readonly attribute RTCPeerConnectionState connectionState; + // readonly attribute boolean? canTrickleIceCandidates; + // static sequence getDefaultIceServers(); + // RTCConfiguration getConfiguration(); + // void setConfiguration(RTCConfiguration configuration); + // void close(); + // attribute EventHandler onnegotiationneeded; + // attribute EventHandler onicecandidate; + // attribute EventHandler onicecandidateerror; + // attribute EventHandler onsignalingstatechange; + // attribute EventHandler oniceconnectionstatechange; + // attribute EventHandler onicegatheringstatechange; + // attribute EventHandler onconnectionstatechange; +}; + +dictionary RTCConfiguration { + sequence iceServers; + RTCIceTransportPolicy iceTransportPolicy = "all"; + RTCBundlePolicy bundlePolicy = "balanced"; + RTCRtcpMuxPolicy rtcpMuxPolicy = "require"; + DOMString peerIdentity; + // sequence certificates; + [EnforceRange] + octet iceCandidatePoolSize = 0; +}; + +enum RTCIceTransportPolicy { + "relay", + "all" +}; + +enum RTCBundlePolicy { + "balanced", + "max-compat", + "max-bundle" +}; + +enum RTCRtcpMuxPolicy { + // At risk due to lack of implementers' interest. + "negotiate", + "require" +}; + +dictionary RTCIceServer { + required (DOMString or sequence) urls; + DOMString username; + DOMString /*(DOMString or RTCOAuthCredential)*/ credential; + RTCIceCredentialType credentialType = "password"; +}; + +enum RTCIceCredentialType { + "password", + "oauth" +}; From f8b3bac7570bb669bb2d1555cfc0bd3a7ab2175d Mon Sep 17 00:00:00 2001 From: Manish Goregaokar Date: Sat, 26 Jan 2019 09:22:11 -0800 Subject: [PATCH 03/26] Add empty RTCSessionDescription interface --- components/script/dom/mod.rs | 1 + .../script/dom/rtcsessiondescription.rs | 41 +++++++++++++++++++ .../dom/webidls/RTCSessionDescription.webidl | 25 +++++++++++ 3 files changed, 67 insertions(+) create mode 100644 components/script/dom/rtcsessiondescription.rs create mode 100644 components/script/dom/webidls/RTCSessionDescription.webidl diff --git a/components/script/dom/mod.rs b/components/script/dom/mod.rs index f9a765ad457..9a965aeb860 100644 --- a/components/script/dom/mod.rs +++ b/components/script/dom/mod.rs @@ -440,6 +440,7 @@ pub mod range; pub mod request; pub mod response; pub mod rtcpeerconnection; +pub mod rtcsessiondescription; pub mod screen; pub mod serviceworker; pub mod serviceworkercontainer; diff --git a/components/script/dom/rtcsessiondescription.rs b/components/script/dom/rtcsessiondescription.rs new file mode 100644 index 00000000000..284774db7a3 --- /dev/null +++ b/components/script/dom/rtcsessiondescription.rs @@ -0,0 +1,41 @@ +/* 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 https://mozilla.org/MPL/2.0/. */ + +use crate::dom::bindings::codegen::Bindings::RTCSessionDescriptionBinding; +use crate::dom::bindings::codegen::Bindings::RTCSessionDescriptionBinding::RTCSessionDescriptionInit; +use crate::dom::bindings::error::Fallible; +use crate::dom::bindings::reflector::reflect_dom_object; +use crate::dom::bindings::reflector::{DomObject, Reflector}; +use crate::dom::bindings::root::DomRoot; +use crate::dom::globalscope::GlobalScope; +use crate::dom::window::Window; +use dom_struct::dom_struct; + +#[dom_struct] +pub struct RTCSessionDescription { + reflector: Reflector, +} + +impl RTCSessionDescription { + pub fn new_inherited() -> RTCSessionDescription { + RTCSessionDescription { + reflector: Reflector::new(), + } + } + + pub fn new(global: &GlobalScope) -> DomRoot { + reflect_dom_object( + Box::new(RTCSessionDescription::new_inherited()), + global, + RTCSessionDescriptionBinding::Wrap, + ) + } + + pub fn Constructor( + window: &Window, + _config: &RTCSessionDescriptionInit, + ) -> Fallible> { + Ok(RTCSessionDescription::new(&window.global())) + } +} diff --git a/components/script/dom/webidls/RTCSessionDescription.webidl b/components/script/dom/webidls/RTCSessionDescription.webidl new file mode 100644 index 00000000000..4072a2fe90d --- /dev/null +++ b/components/script/dom/webidls/RTCSessionDescription.webidl @@ -0,0 +1,25 @@ +/* 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 https://mozilla.org/MPL/2.0/. */ + +// https://w3c.github.io/webrtc-pc/#rtcsessiondescription-class + +[Constructor(RTCSessionDescriptionInit descriptionInitDict), + Exposed=Window, Pref="dom.webrtc.enabled"] +interface RTCSessionDescription { + // readonly attribute RTCSdpType type; + // readonly attribute DOMString sdp; + // [Default] object toJSON(); +}; + +dictionary RTCSessionDescriptionInit { + required RTCSdpType type; + DOMString sdp = ""; +}; + +enum RTCSdpType { + "offer", + "pranswer", + "answer", + "rollback" +}; From 69931934ace93479bb4da422e346387779bbf847 Mon Sep 17 00:00:00 2001 From: Manish Goregaokar Date: Sat, 26 Jan 2019 09:28:07 -0800 Subject: [PATCH 04/26] Add empty RTCIceCandidate interface --- components/script/dom/mod.rs | 1 + components/script/dom/rtcicecandidate.rs | 41 +++++++++++++++++++ .../script/dom/webidls/RTCIceCandidate.webidl | 33 +++++++++++++++ 3 files changed, 75 insertions(+) create mode 100644 components/script/dom/rtcicecandidate.rs create mode 100644 components/script/dom/webidls/RTCIceCandidate.webidl diff --git a/components/script/dom/mod.rs b/components/script/dom/mod.rs index 9a965aeb860..2f54371f891 100644 --- a/components/script/dom/mod.rs +++ b/components/script/dom/mod.rs @@ -439,6 +439,7 @@ pub mod radionodelist; pub mod range; pub mod request; pub mod response; +pub mod rtcicecandidate; pub mod rtcpeerconnection; pub mod rtcsessiondescription; pub mod screen; diff --git a/components/script/dom/rtcicecandidate.rs b/components/script/dom/rtcicecandidate.rs new file mode 100644 index 00000000000..89a525294c2 --- /dev/null +++ b/components/script/dom/rtcicecandidate.rs @@ -0,0 +1,41 @@ +/* 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 https://mozilla.org/MPL/2.0/. */ + +use crate::dom::bindings::codegen::Bindings::RTCIceCandidateBinding; +use crate::dom::bindings::codegen::Bindings::RTCIceCandidateBinding::RTCIceCandidateInit; +use crate::dom::bindings::error::Fallible; +use crate::dom::bindings::reflector::reflect_dom_object; +use crate::dom::bindings::reflector::{DomObject, Reflector}; +use crate::dom::bindings::root::DomRoot; +use crate::dom::globalscope::GlobalScope; +use crate::dom::window::Window; +use dom_struct::dom_struct; + +#[dom_struct] +pub struct RTCIceCandidate { + reflector: Reflector, +} + +impl RTCIceCandidate { + pub fn new_inherited() -> RTCIceCandidate { + RTCIceCandidate { + reflector: Reflector::new(), + } + } + + pub fn new(global: &GlobalScope) -> DomRoot { + reflect_dom_object( + Box::new(RTCIceCandidate::new_inherited()), + global, + RTCIceCandidateBinding::Wrap, + ) + } + + pub fn Constructor( + window: &Window, + _config: &RTCIceCandidateInit, + ) -> Fallible> { + Ok(RTCIceCandidate::new(&window.global())) + } +} diff --git a/components/script/dom/webidls/RTCIceCandidate.webidl b/components/script/dom/webidls/RTCIceCandidate.webidl new file mode 100644 index 00000000000..1c5dc88dc09 --- /dev/null +++ b/components/script/dom/webidls/RTCIceCandidate.webidl @@ -0,0 +1,33 @@ +/* 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 https://mozilla.org/MPL/2.0/. */ + +// https://w3c.github.io/webrtc-pc/#rtcicecandidate-interface + + +[Constructor(optional RTCIceCandidateInit candidateInitDict), + Exposed=Window, Pref="dom.webrtc.enabled"] +interface RTCIceCandidate { + // readonly attribute DOMString candidate; + // readonly attribute DOMString? sdpMid; + // readonly attribute unsigned short? sdpMLineIndex; + // readonly attribute DOMString? foundation; + // readonly attribute RTCIceComponent? component; + // readonly attribute unsigned long? priority; + // readonly attribute DOMString? address; + // readonly attribute RTCIceProtocol? protocol; + // readonly attribute unsigned short? port; + // readonly attribute RTCIceCandidateType? type; + // readonly attribute RTCIceTcpCandidateType? tcpType; + // readonly attribute DOMString? relatedAddress; + // readonly attribute unsigned short? relatedPort; + // readonly attribute DOMString? usernameFragment; + // RTCIceCandidateInit toJSON(); +}; + +dictionary RTCIceCandidateInit { + DOMString candidate = ""; + DOMString? sdpMid = null; + unsigned short? sdpMLineIndex = null; + DOMString usernameFragment; +}; From be48cf23f931d92f9de3ccd1a2c21f5c6ee4cef9 Mon Sep 17 00:00:00 2001 From: Manish Goregaokar Date: Sat, 26 Jan 2019 09:41:31 -0800 Subject: [PATCH 05/26] Fill in RTCSessionDescription --- .../script/dom/rtcsessiondescription.rs | 40 ++++++++++++++++--- .../dom/webidls/RTCSessionDescription.webidl | 4 +- 2 files changed, 36 insertions(+), 8 deletions(-) diff --git a/components/script/dom/rtcsessiondescription.rs b/components/script/dom/rtcsessiondescription.rs index 284774db7a3..833074d3814 100644 --- a/components/script/dom/rtcsessiondescription.rs +++ b/components/script/dom/rtcsessiondescription.rs @@ -3,11 +3,15 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ use crate::dom::bindings::codegen::Bindings::RTCSessionDescriptionBinding; -use crate::dom::bindings::codegen::Bindings::RTCSessionDescriptionBinding::RTCSessionDescriptionInit; +use crate::dom::bindings::codegen::Bindings::RTCSessionDescriptionBinding::RTCSessionDescriptionMethods; +use crate::dom::bindings::codegen::Bindings::RTCSessionDescriptionBinding::{ + RTCSdpType, RTCSessionDescriptionInit, +}; use crate::dom::bindings::error::Fallible; use crate::dom::bindings::reflector::reflect_dom_object; use crate::dom::bindings::reflector::{DomObject, Reflector}; use crate::dom::bindings::root::DomRoot; +use crate::dom::bindings::str::DOMString; use crate::dom::globalscope::GlobalScope; use crate::dom::window::Window; use dom_struct::dom_struct; @@ -15,18 +19,26 @@ use dom_struct::dom_struct; #[dom_struct] pub struct RTCSessionDescription { reflector: Reflector, + ty: RTCSdpType, + sdp: DOMString, } impl RTCSessionDescription { - pub fn new_inherited() -> RTCSessionDescription { + pub fn new_inherited(ty: RTCSdpType, sdp: DOMString) -> RTCSessionDescription { RTCSessionDescription { reflector: Reflector::new(), + ty, + sdp, } } - pub fn new(global: &GlobalScope) -> DomRoot { + pub fn new( + global: &GlobalScope, + ty: RTCSdpType, + sdp: DOMString, + ) -> DomRoot { reflect_dom_object( - Box::new(RTCSessionDescription::new_inherited()), + Box::new(RTCSessionDescription::new_inherited(ty, sdp)), global, RTCSessionDescriptionBinding::Wrap, ) @@ -34,8 +46,24 @@ impl RTCSessionDescription { pub fn Constructor( window: &Window, - _config: &RTCSessionDescriptionInit, + config: &RTCSessionDescriptionInit, ) -> Fallible> { - Ok(RTCSessionDescription::new(&window.global())) + Ok(RTCSessionDescription::new( + &window.global(), + config.type_, + config.sdp.clone(), + )) + } +} + +impl RTCSessionDescriptionMethods for RTCSessionDescription { + /// https://www.w3.org/TR/webrtc/#dom-rtcsessiondescription-type + fn Type(&self) -> RTCSdpType { + self.ty + } + + /// https://www.w3.org/TR/webrtc/#dom-rtcsessiondescription-sdp + fn Sdp(&self) -> DOMString { + self.sdp.clone() } } diff --git a/components/script/dom/webidls/RTCSessionDescription.webidl b/components/script/dom/webidls/RTCSessionDescription.webidl index 4072a2fe90d..1cc271b16db 100644 --- a/components/script/dom/webidls/RTCSessionDescription.webidl +++ b/components/script/dom/webidls/RTCSessionDescription.webidl @@ -7,8 +7,8 @@ [Constructor(RTCSessionDescriptionInit descriptionInitDict), Exposed=Window, Pref="dom.webrtc.enabled"] interface RTCSessionDescription { - // readonly attribute RTCSdpType type; - // readonly attribute DOMString sdp; + readonly attribute RTCSdpType type; + readonly attribute DOMString sdp; // [Default] object toJSON(); }; From a43b9c0a8faf9647ea0bec24727424c13dbe525f Mon Sep 17 00:00:00 2001 From: Manish Goregaokar Date: Sat, 26 Jan 2019 10:37:52 -0800 Subject: [PATCH 06/26] Fill in RTCIceCandidate --- components/script/dom/rtcicecandidate.rs | 50 ++++++++++++++++--- .../script/dom/webidls/RTCIceCandidate.webidl | 8 +-- 2 files changed, 47 insertions(+), 11 deletions(-) diff --git a/components/script/dom/rtcicecandidate.rs b/components/script/dom/rtcicecandidate.rs index 89a525294c2..6c157844dbd 100644 --- a/components/script/dom/rtcicecandidate.rs +++ b/components/script/dom/rtcicecandidate.rs @@ -2,12 +2,13 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -use crate::dom::bindings::codegen::Bindings::RTCIceCandidateBinding; +use crate::dom::bindings::codegen::Bindings::RTCIceCandidateBinding::{self, RTCIceCandidateMethods}; use crate::dom::bindings::codegen::Bindings::RTCIceCandidateBinding::RTCIceCandidateInit; -use crate::dom::bindings::error::Fallible; +use crate::dom::bindings::error::{Error, Fallible}; use crate::dom::bindings::reflector::reflect_dom_object; use crate::dom::bindings::reflector::{DomObject, Reflector}; use crate::dom::bindings::root::DomRoot; +use crate::dom::bindings::str::DOMString; use crate::dom::globalscope::GlobalScope; use crate::dom::window::Window; use dom_struct::dom_struct; @@ -15,18 +16,25 @@ use dom_struct::dom_struct; #[dom_struct] pub struct RTCIceCandidate { reflector: Reflector, + candidate: DOMString, + sdp_m_id: Option, + sdp_m_line_index: Option, + username_fragment: Option, } impl RTCIceCandidate { - pub fn new_inherited() -> RTCIceCandidate { + pub fn new_inherited(candidate: DOMString, sdp_m_id: Option, + sdp_m_line_index: Option, username_fragment: Option) -> RTCIceCandidate { RTCIceCandidate { reflector: Reflector::new(), + candidate, sdp_m_id, sdp_m_line_index, username_fragment } } - pub fn new(global: &GlobalScope) -> DomRoot { + pub fn new(global: &GlobalScope, candidate: DOMString, sdp_m_id: Option, + sdp_m_line_index: Option, username_fragment: Option) -> DomRoot { reflect_dom_object( - Box::new(RTCIceCandidate::new_inherited()), + Box::new(RTCIceCandidate::new_inherited(candidate, sdp_m_id, sdp_m_line_index, username_fragment)), global, RTCIceCandidateBinding::Wrap, ) @@ -34,8 +42,36 @@ impl RTCIceCandidate { pub fn Constructor( window: &Window, - _config: &RTCIceCandidateInit, + config: &RTCIceCandidateInit, ) -> Fallible> { - Ok(RTCIceCandidate::new(&window.global())) + if config.sdpMid.is_none() && config.sdpMLineIndex.is_none() { + return Err(Error::Type(format!("one of sdpMid and sdpMLineIndex must be set"))); + } + Ok(RTCIceCandidate::new(&window.global(), config.candidate.clone(), + config.sdpMid.clone(), config.sdpMLineIndex, + config.usernameFragment.clone())) + } +} + + +impl RTCIceCandidateMethods for RTCIceCandidate { + /// https://www.w3.org/TR/webrtc/#dom-rtcicecandidate-candidate + fn Candidate(&self) -> DOMString { + self.candidate.clone() + } + + /// https://www.w3.org/TR/webrtc/#dom-rtcicecandidate-sdpmid + fn GetSdpMid(&self) -> Option { + self.sdp_m_id.clone() + } + + /// https://www.w3.org/TR/webrtc/#dom-rtcicecandidate-sdpmlineindex + fn GetSdpMLineIndex(&self) -> Option { + self.sdp_m_line_index.clone() + } + + /// https://www.w3.org/TR/webrtc/#dom-rtcicecandidate-usernamefragment + fn GetUsernameFragment(&self) -> Option { + self.username_fragment.clone() } } diff --git a/components/script/dom/webidls/RTCIceCandidate.webidl b/components/script/dom/webidls/RTCIceCandidate.webidl index 1c5dc88dc09..3d0fdb006c7 100644 --- a/components/script/dom/webidls/RTCIceCandidate.webidl +++ b/components/script/dom/webidls/RTCIceCandidate.webidl @@ -8,9 +8,9 @@ [Constructor(optional RTCIceCandidateInit candidateInitDict), Exposed=Window, Pref="dom.webrtc.enabled"] interface RTCIceCandidate { - // readonly attribute DOMString candidate; - // readonly attribute DOMString? sdpMid; - // readonly attribute unsigned short? sdpMLineIndex; + readonly attribute DOMString candidate; + readonly attribute DOMString? sdpMid; + readonly attribute unsigned short? sdpMLineIndex; // readonly attribute DOMString? foundation; // readonly attribute RTCIceComponent? component; // readonly attribute unsigned long? priority; @@ -21,7 +21,7 @@ interface RTCIceCandidate { // readonly attribute RTCIceTcpCandidateType? tcpType; // readonly attribute DOMString? relatedAddress; // readonly attribute unsigned short? relatedPort; - // readonly attribute DOMString? usernameFragment; + readonly attribute DOMString? usernameFragment; // RTCIceCandidateInit toJSON(); }; From cc4fb3918dd8fe3ea7265dfc8c0b1e3e3efe7b47 Mon Sep 17 00:00:00 2001 From: Manish Goregaokar Date: Sat, 26 Jan 2019 10:50:34 -0800 Subject: [PATCH 07/26] Update servo-media --- Cargo.lock | 164 ++++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 119 insertions(+), 45 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index a6d4544e957..2fdb66eb017 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -58,7 +58,7 @@ version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "android_log-sys 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -150,7 +150,7 @@ dependencies = [ "bitflags 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", "crossbeam-channel 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "ipc-channel 0.11.2 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.44 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", "mach 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", @@ -222,7 +222,7 @@ dependencies = [ "clap 2.28.0 (registry+https://github.com/rust-lang/crates.io-index)", "env_logger 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", "hashbrown 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", "peeking_take_while 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "proc-macro2 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", @@ -433,7 +433,7 @@ dependencies = [ "euclid 0.19.4 (registry+https://github.com/rust-lang/crates.io-index)", "gleam 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)", "ipc-channel 0.11.2 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "malloc_size_of 0.0.1", "malloc_size_of_derive 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "offscreen_gl_context 0.22.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -754,7 +754,7 @@ dependencies = [ "arrayvec 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "crossbeam-utils 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "memoffset 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "nodrop 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", "scopeguard 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -768,7 +768,7 @@ dependencies = [ "arrayvec 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "crossbeam-utils 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "memoffset 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "scopeguard 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -781,7 +781,7 @@ dependencies = [ "arrayvec 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "crossbeam-utils 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "memoffset 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "scopeguard 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1020,7 +1020,7 @@ name = "dwrote" version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "lazy_static 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.44 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1039,7 +1039,7 @@ dependencies = [ "crossbeam-channel 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "ipc-channel 0.11.2 (registry+https://github.com/rust-lang/crates.io-index)", "keyboard-types 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", "msg 0.0.1", "num-derive 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1323,7 +1323,7 @@ dependencies = [ "gfx_traits 0.0.1", "harfbuzz-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "ipc-channel 0.11.2 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.44 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", "malloc_size_of 0.0.1", @@ -1394,7 +1394,7 @@ dependencies = [ "bitflags 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", "glib-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", "gobject-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.44 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1423,7 +1423,7 @@ dependencies = [ "core-foundation 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", "core-graphics 0.17.3 (registry+https://github.com/rust-lang/crates.io-index)", "gl_generator 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.44 (registry+https://github.com/rust-lang/crates.io-index)", "objc 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", "osmesa-sys 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1478,7 +1478,7 @@ dependencies = [ "gstreamer-base 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", "gstreamer-base-sys 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", "gstreamer-sys 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.44 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1493,7 +1493,7 @@ dependencies = [ "glib-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", "gobject-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", "gstreamer-sys 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.44 (registry+https://github.com/rust-lang/crates.io-index)", "muldiv 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "num-rational 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1611,6 +1611,33 @@ dependencies = [ "pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "gstreamer-sdp" +version = "0.12.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bitflags 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", + "glib 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", + "glib-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gobject-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gstreamer 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gstreamer-sdp-sys 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", + "gstreamer-sys 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.44 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "gstreamer-sdp-sys" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "glib-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gobject-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gstreamer-sys 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.44 (registry+https://github.com/rust-lang/crates.io-index)", + "pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "gstreamer-sys" version = "0.6.2" @@ -1652,6 +1679,34 @@ dependencies = [ "pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "gstreamer-webrtc" +version = "0.12.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "glib 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", + "glib-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gobject-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gstreamer 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gstreamer-sdp 0.12.2 (registry+https://github.com/rust-lang/crates.io-index)", + "gstreamer-sys 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", + "gstreamer-webrtc-sys 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.44 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "gstreamer-webrtc-sys" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "glib-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gobject-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gstreamer-sdp-sys 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", + "gstreamer-sys 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.44 (registry+https://github.com/rust-lang/crates.io-index)", + "pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "gvr-sys" version = "0.7.0" @@ -1841,7 +1896,7 @@ dependencies = [ "bytes 0.4.9 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.23 (registry+https://github.com/rust-lang/crates.io-index)", "hyper 0.12.14 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "linked_hash_set 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "openssl 0.10.11 (registry+https://github.com/rust-lang/crates.io-index)", "openssl-sys 0.9.35 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1962,7 +2017,7 @@ dependencies = [ "bincode 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "crossbeam-channel 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.44 (registry+https://github.com/rust-lang/crates.io-index)", "mio 0.6.16 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2119,7 +2174,7 @@ dependencies = [ "ipc-channel 0.11.2 (registry+https://github.com/rust-lang/crates.io-index)", "layout 0.0.1", "layout_traits 0.0.1", - "lazy_static 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.44 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", "malloc_size_of 0.0.1", @@ -2165,7 +2220,7 @@ dependencies = [ [[package]] name = "lazy_static" -version = "1.0.0" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -2579,7 +2634,7 @@ version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cc 1.0.18 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2588,7 +2643,7 @@ version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cc 1.0.18 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.44 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", "mozjs_sys 0.61.6 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2652,7 +2707,7 @@ dependencies = [ "hyper_serde 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", "immeta 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "ipc-channel 0.11.2 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "libflate 0.1.19 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", "malloc_size_of 0.0.1", @@ -2706,7 +2761,7 @@ dependencies = [ "hyper_serde 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", "image 0.20.1 (registry+https://github.com/rust-lang/crates.io-index)", "ipc-channel 0.11.2 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", "malloc_size_of 0.0.1", "malloc_size_of_derive 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2844,7 +2899,7 @@ dependencies = [ "euclid 0.19.4 (registry+https://github.com/rust-lang/crates.io-index)", "gl_generator 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", "gleam 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "libloading 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", "objc 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2867,7 +2922,7 @@ dependencies = [ "bitflags 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "foreign-types 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.44 (registry+https://github.com/rust-lang/crates.io-index)", "openssl-sys 0.9.35 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -3176,7 +3231,7 @@ version = "1.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "crossbeam-deque 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.44 (registry+https://github.com/rust-lang/crates.io-index)", "num_cpus 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -3342,7 +3397,7 @@ dependencies = [ "itertools 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", "jstraceable_derive 0.0.1", "keyboard-types 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.44 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", "malloc_size_of 0.0.1", @@ -3549,7 +3604,7 @@ dependencies = [ "gleam 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)", "glutin 0.19.0 (registry+https://github.com/rust-lang/crates.io-index)", "keyboard-types 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "libservo 0.0.1", "log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", "osmesa-src 0.1.0 (git+https://github.com/servo/osmesa-src)", @@ -3601,17 +3656,18 @@ dependencies = [ [[package]] name = "servo-media" version = "0.1.0" -source = "git+https://github.com/servo/media#4bed1cdc9dc9cc825080ae2d8d1dfa776b042199" +source = "git+https://github.com/servo/media#1e6618da825500049a73e5a586e41428f317e724" dependencies = [ "servo-media-audio 0.1.0 (git+https://github.com/servo/media)", "servo-media-gstreamer 0.1.0 (git+https://github.com/servo/media)", "servo-media-player 0.1.0 (git+https://github.com/servo/media)", + "servo-media-webrtc 0.1.0 (git+https://github.com/servo/media)", ] [[package]] name = "servo-media-audio" version = "0.1.0" -source = "git+https://github.com/servo/media#4bed1cdc9dc9cc825080ae2d8d1dfa776b042199" +source = "git+https://github.com/servo/media#1e6618da825500049a73e5a586e41428f317e724" dependencies = [ "boxfnonce 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "byte-slice-cast 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -3628,8 +3684,9 @@ dependencies = [ [[package]] name = "servo-media-gstreamer" version = "0.1.0" -source = "git+https://github.com/servo/media#4bed1cdc9dc9cc825080ae2d8d1dfa776b042199" +source = "git+https://github.com/servo/media#1e6618da825500049a73e5a586e41428f317e724" dependencies = [ + "boxfnonce 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "byte-slice-cast 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "glib 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", "glib-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -3640,12 +3697,16 @@ dependencies = [ "gstreamer-app 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", "gstreamer-audio 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", "gstreamer-player 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gstreamer-sdp 0.12.2 (registry+https://github.com/rust-lang/crates.io-index)", "gstreamer-sys 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", "gstreamer-video 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gstreamer-webrtc 0.12.2 (registry+https://github.com/rust-lang/crates.io-index)", "ipc-channel 0.11.2 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "regex 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", "servo-media-audio 0.1.0 (git+https://github.com/servo/media)", "servo-media-player 0.1.0 (git+https://github.com/servo/media)", + "servo-media-webrtc 0.1.0 (git+https://github.com/servo/media)", "url 1.7.2 (registry+https://github.com/rust-lang/crates.io-index)", "zip 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -3653,13 +3714,21 @@ dependencies = [ [[package]] name = "servo-media-player" version = "0.1.0" -source = "git+https://github.com/servo/media#4bed1cdc9dc9cc825080ae2d8d1dfa776b042199" +source = "git+https://github.com/servo/media#1e6618da825500049a73e5a586e41428f317e724" dependencies = [ "ipc-channel 0.11.2 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "servo-media-webrtc" +version = "0.1.0" +source = "git+https://github.com/servo/media#1e6618da825500049a73e5a586e41428f317e724" +dependencies = [ + "boxfnonce 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "servo-skia" version = "0.30000020.1" @@ -3714,7 +3783,7 @@ dependencies = [ "env_logger 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", "euclid 0.19.4 (registry+https://github.com/rust-lang/crates.io-index)", "getopts 0.2.17 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", "num_cpus 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)", @@ -3740,7 +3809,7 @@ dependencies = [ [[package]] name = "servo_media_derive" version = "0.1.0" -source = "git+https://github.com/servo/media#4bed1cdc9dc9cc825080ae2d8d1dfa776b042199" +source = "git+https://github.com/servo/media#1e6618da825500049a73e5a586e41428f317e724" dependencies = [ "proc-macro2 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)", @@ -3751,7 +3820,7 @@ dependencies = [ name = "servo_rand" version = "0.0.1" dependencies = [ - "lazy_static 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", "uuid 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -3761,7 +3830,7 @@ dependencies = [ name = "servo_remutex" version = "0.0.1" dependencies = [ - "lazy_static 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -3810,7 +3879,7 @@ name = "shared_library" version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "lazy_static 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.44 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -3892,7 +3961,7 @@ dependencies = [ "andrew 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "bitflags 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", "dlib 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "memmap 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", "nix 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)", @@ -3931,7 +4000,7 @@ name = "string_cache" version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "lazy_static 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "new_debug_unreachable 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", "phf_shared 0.7.23 (registry+https://github.com/rust-lang/crates.io-index)", "precomputed-hash 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -3983,7 +4052,7 @@ dependencies = [ "indexmap 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", "itertools 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", "itoa 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", "malloc_size_of 0.0.1", "malloc_size_of_derive 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -4164,7 +4233,7 @@ name = "thread_local" version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "lazy_static 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -4598,7 +4667,7 @@ version = "0.21.4" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "dlib 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -4668,7 +4737,7 @@ dependencies = [ "fxhash 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "gleam 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)", "image 0.20.1 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.44 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", "num-traits 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", @@ -4805,7 +4874,7 @@ dependencies = [ "core-foundation 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", "core-graphics 0.17.3 (registry+https://github.com/rust-lang/crates.io-index)", "image 0.20.1 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.44 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", "objc 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", @@ -4874,7 +4943,7 @@ name = "x11-dl" version = "2.18.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "lazy_static 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.44 (registry+https://github.com/rust-lang/crates.io-index)", "pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -5073,9 +5142,13 @@ dependencies = [ "checksum gstreamer-base-sys 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1eb57a7d013604ab7af2b843b62b13b8fb30f22d066919f7e198f528c3296cd0" "checksum gstreamer-player 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1144c6c5c3af25dd1f89b4f9d2762f1c2d8789e65cdc79e2451dd24350d84dd2" "checksum gstreamer-player-sys 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f0e642cb58d3733e2724def7186101bb00144fc97d45b2c379eba6d0c0662dec" +"checksum gstreamer-sdp 0.12.2 (registry+https://github.com/rust-lang/crates.io-index)" = "047223a666099fd59b357e2db72638bf486d04cff206dc78902f05e9e6260202" +"checksum gstreamer-sdp-sys 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7e4db988cfb5a31c422964dcf5d458e878dbe446828c7ab38bf27e9ee47cc0bc" "checksum gstreamer-sys 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "548bbd6a222826340953d2c1d50c3695463719cfb6414499300de5909a6ba1ea" "checksum gstreamer-video 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)" = "0c1f04816d7e183714830da26274f97e7aeff09ae6641058538d21443b4ec07d" "checksum gstreamer-video-sys 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d0e2efb301a0b94fa4af503122faa04247085936dd888fd59fa4e21eab3cbd37" +"checksum gstreamer-webrtc 0.12.2 (registry+https://github.com/rust-lang/crates.io-index)" = "247eb5d55a42f1e15200c9e6ff7d854034219798713515c11bd875da0c7d144f" +"checksum gstreamer-webrtc-sys 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "c57e396dd61d0b8e55653e801bc906ef32409f3fcbf26b9614167712765c7c80" "checksum gvr-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b1334b94d8ce67319ddc44663daef53d8c1538629a11562530c981dbd9085b9a" "checksum h2 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)" = "a27e7ed946e8335bdf9a191bc1b9b14a03ba822d013d2f58437f4fabcbd7fc2c" "checksum half 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "63d68db75012a85555434ee079e7e6337931f87a087ab2988becbadf64673a7f" @@ -5114,7 +5187,7 @@ dependencies = [ "checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" "checksum keyboard-types 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)" = "53b536dc22c0dabb295e85dbd0c062023885b12b8db24e1d86833f4e50ea7959" "checksum khronos_api 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "62237e6d326bd5871cd21469323bf096de81f1618cd82cbaf5d87825335aeb49" -"checksum lazy_static 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c8f31047daa365f19be14b47c29df4f7c3b581832407daabe6ae77397619237d" +"checksum lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a374c89b9db55895453a74c1e38861d9deec0b01b405a82516e9d5de4820dea1" "checksum lazycell 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d33a48d0365c96081958cc663eef834975cb1e8d8bea3378513fc72bdbf11e50" "checksum leak 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "bd100e01f1154f2908dfa7d02219aeab25d0b9c7fa955164192e3245255a0c73" "checksum leaky-cow 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "40a8225d44241fd324a8af2806ba635fc7c8a7e9a7de4d5cf3ef54e71f5926fc" @@ -5229,6 +5302,7 @@ dependencies = [ "checksum servo-media-audio 0.1.0 (git+https://github.com/servo/media)" = "" "checksum servo-media-gstreamer 0.1.0 (git+https://github.com/servo/media)" = "" "checksum servo-media-player 0.1.0 (git+https://github.com/servo/media)" = "" +"checksum servo-media-webrtc 0.1.0 (git+https://github.com/servo/media)" = "" "checksum servo-skia 0.30000020.1 (registry+https://github.com/rust-lang/crates.io-index)" = "63abd6bed50aaf0e348d9fe8104088d61d5b67fd47cbbdc822278f5bed82b5f5" "checksum servo_media_derive 0.1.0 (git+https://github.com/servo/media)" = "" "checksum sha-1 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "51b9d1f3b5de8a167ab06834a7c883bd197f2191e1dda1a22d9ccfeedbf9aded" From e0d8de27142fb05e2e4322a32fe45fb91223f308 Mon Sep 17 00:00:00 2001 From: Manish Goregaokar Date: Sat, 26 Jan 2019 11:11:40 -0800 Subject: [PATCH 08/26] Fill in some of RTCPeerConnection, add signaller --- components/script/dom/bindings/trace.rs | 2 + components/script/dom/rtcicecandidate.rs | 48 ++++++++++---- components/script/dom/rtcpeerconnection.rs | 77 +++++++++++++++++++++- 3 files changed, 113 insertions(+), 14 deletions(-) diff --git a/components/script/dom/bindings/trace.rs b/components/script/dom/bindings/trace.rs index e92d1d5c452..c128b6d9154 100644 --- a/components/script/dom/bindings/trace.rs +++ b/components/script/dom/bindings/trace.rs @@ -101,6 +101,7 @@ use servo_media::audio::graph::NodeId; use servo_media::audio::panner_node::{DistanceModel, PanningModel}; use servo_media::audio::param::ParamType; use servo_media::player::Player; +use servo_media::webrtc::WebRtcController; use servo_media::Backend; use servo_url::{ImmutableOrigin, MutableOrigin, ServoUrl}; use smallvec::SmallVec; @@ -483,6 +484,7 @@ unsafe_no_jsmanaged_fields!(AudioContext); unsafe_no_jsmanaged_fields!(NodeId); unsafe_no_jsmanaged_fields!(AnalysisEngine, DistanceModel, PanningModel, ParamType); unsafe_no_jsmanaged_fields!(dyn Player); +unsafe_no_jsmanaged_fields!(WebRtcController); unsafe_no_jsmanaged_fields!(Mutex); unsafe_no_jsmanaged_fields!(RenderApiSender); unsafe_no_jsmanaged_fields!(ResourceFetchTiming); diff --git a/components/script/dom/rtcicecandidate.rs b/components/script/dom/rtcicecandidate.rs index 6c157844dbd..7ced25fc29c 100644 --- a/components/script/dom/rtcicecandidate.rs +++ b/components/script/dom/rtcicecandidate.rs @@ -2,8 +2,10 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -use crate::dom::bindings::codegen::Bindings::RTCIceCandidateBinding::{self, RTCIceCandidateMethods}; use crate::dom::bindings::codegen::Bindings::RTCIceCandidateBinding::RTCIceCandidateInit; +use crate::dom::bindings::codegen::Bindings::RTCIceCandidateBinding::{ + self, RTCIceCandidateMethods, +}; use crate::dom::bindings::error::{Error, Fallible}; use crate::dom::bindings::reflector::reflect_dom_object; use crate::dom::bindings::reflector::{DomObject, Reflector}; @@ -23,18 +25,35 @@ pub struct RTCIceCandidate { } impl RTCIceCandidate { - pub fn new_inherited(candidate: DOMString, sdp_m_id: Option, - sdp_m_line_index: Option, username_fragment: Option) -> RTCIceCandidate { + pub fn new_inherited( + candidate: DOMString, + sdp_m_id: Option, + sdp_m_line_index: Option, + username_fragment: Option, + ) -> RTCIceCandidate { RTCIceCandidate { reflector: Reflector::new(), - candidate, sdp_m_id, sdp_m_line_index, username_fragment + candidate, + sdp_m_id, + sdp_m_line_index, + username_fragment, } } - pub fn new(global: &GlobalScope, candidate: DOMString, sdp_m_id: Option, - sdp_m_line_index: Option, username_fragment: Option) -> DomRoot { + pub fn new( + global: &GlobalScope, + candidate: DOMString, + sdp_m_id: Option, + sdp_m_line_index: Option, + username_fragment: Option, + ) -> DomRoot { reflect_dom_object( - Box::new(RTCIceCandidate::new_inherited(candidate, sdp_m_id, sdp_m_line_index, username_fragment)), + Box::new(RTCIceCandidate::new_inherited( + candidate, + sdp_m_id, + sdp_m_line_index, + username_fragment, + )), global, RTCIceCandidateBinding::Wrap, ) @@ -45,15 +64,20 @@ impl RTCIceCandidate { config: &RTCIceCandidateInit, ) -> Fallible> { if config.sdpMid.is_none() && config.sdpMLineIndex.is_none() { - return Err(Error::Type(format!("one of sdpMid and sdpMLineIndex must be set"))); + return Err(Error::Type(format!( + "one of sdpMid and sdpMLineIndex must be set" + ))); } - Ok(RTCIceCandidate::new(&window.global(), config.candidate.clone(), - config.sdpMid.clone(), config.sdpMLineIndex, - config.usernameFragment.clone())) + Ok(RTCIceCandidate::new( + &window.global(), + config.candidate.clone(), + config.sdpMid.clone(), + config.sdpMLineIndex, + config.usernameFragment.clone(), + )) } } - impl RTCIceCandidateMethods for RTCIceCandidate { /// https://www.w3.org/TR/webrtc/#dom-rtcicecandidate-candidate fn Candidate(&self) -> DOMString { diff --git a/components/script/dom/rtcpeerconnection.rs b/components/script/dom/rtcpeerconnection.rs index 6af09b5c387..41381ba43eb 100644 --- a/components/script/dom/rtcpeerconnection.rs +++ b/components/script/dom/rtcpeerconnection.rs @@ -2,35 +2,86 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ +use crate::dom::bindings::cell::DomRefCell; use crate::dom::bindings::codegen::Bindings::RTCPeerConnectionBinding; use crate::dom::bindings::codegen::Bindings::RTCPeerConnectionBinding::RTCConfiguration; use crate::dom::bindings::error::Fallible; +use crate::dom::bindings::refcounted::Trusted; use crate::dom::bindings::reflector::reflect_dom_object; use crate::dom::bindings::reflector::DomObject; use crate::dom::bindings::root::DomRoot; use crate::dom::eventtarget::EventTarget; use crate::dom::globalscope::GlobalScope; use crate::dom::window::Window; +use crate::task::TaskCanceller; +use crate::task_source::networking::NetworkingTaskSource; +use crate::task_source::TaskSource; use dom_struct::dom_struct; +use servo_media::webrtc::MediaStream as BackendMediaStream; +use servo_media::webrtc::{IceCandidate, WebRtcController, WebRtcSignaller}; +use servo_media::ServoMedia; + #[dom_struct] pub struct RTCPeerConnection { eventtarget: EventTarget, + #[ignore_malloc_size_of = "defined in servo-media"] + controller: DomRefCell>, +} + +struct RTCSignaller { + trusted: Trusted, + task_source: NetworkingTaskSource, + canceller: TaskCanceller, +} + +impl WebRtcSignaller for RTCSignaller { + fn on_ice_candidate(&self, _: &WebRtcController, candidate: IceCandidate) { + let this = self.trusted.clone(); + let _ = self.task_source.queue_with_canceller( + task!(on_ice_candidate: move || { + let this = this.root(); + this.on_ice_candidate(candidate); + }), + &self.canceller, + ); + } + + fn on_negotiation_needed(&self, _: &WebRtcController) { + let this = self.trusted.clone(); + let _ = self.task_source.queue_with_canceller( + task!(on_negotiation_needed: move || { + let this = this.root(); + this.on_negotiation_needed(); + }), + &self.canceller, + ); + } + + fn on_add_stream(&self, _: Box) {} + + fn close(&self) { + // do nothing + } } impl RTCPeerConnection { pub fn new_inherited() -> RTCPeerConnection { RTCPeerConnection { eventtarget: EventTarget::new_inherited(), + controller: DomRefCell::new(None), } } pub fn new(global: &GlobalScope) -> DomRoot { - reflect_dom_object( + let this = reflect_dom_object( Box::new(RTCPeerConnection::new_inherited()), global, RTCPeerConnectionBinding::Wrap, - ) + ); + let signaller = this.make_signaller(); + *this.controller.borrow_mut() = Some(ServoMedia::get().unwrap().create_webrtc(signaller)); + this } pub fn Constructor( @@ -39,4 +90,26 @@ impl RTCPeerConnection { ) -> Fallible> { Ok(RTCPeerConnection::new(&window.global())) } + + fn make_signaller(&self) -> Box { + let trusted = Trusted::new(self); + let (task_source, canceller) = self + .global() + .as_window() + .task_manager() + .networking_task_source_with_canceller(); + Box::new(RTCSignaller { + trusted, + task_source, + canceller, + }) + } + + fn on_ice_candidate(&self, _candidate: IceCandidate) { + // todo + } + + fn on_negotiation_needed(&self) { + // todo + } } From 5bfa42094e96372fbabd0f8a074235b1799bf656 Mon Sep 17 00:00:00 2001 From: Manish Goregaokar Date: Sat, 26 Jan 2019 19:13:09 -0800 Subject: [PATCH 09/26] Add RTCPeerConnectionIceEvent --- components/script/dom/mod.rs | 1 + components/script/dom/rtcpeerconnection.rs | 4 + .../script/dom/rtcpeerconnectioniceevent.rs | 92 +++++++++++++++++++ .../webidls/RTCPeerConnectionIceEvent.webidl | 17 ++++ 4 files changed, 114 insertions(+) create mode 100644 components/script/dom/rtcpeerconnectioniceevent.rs create mode 100644 components/script/dom/webidls/RTCPeerConnectionIceEvent.webidl diff --git a/components/script/dom/mod.rs b/components/script/dom/mod.rs index 2f54371f891..3dc7f530933 100644 --- a/components/script/dom/mod.rs +++ b/components/script/dom/mod.rs @@ -441,6 +441,7 @@ pub mod request; pub mod response; pub mod rtcicecandidate; pub mod rtcpeerconnection; +pub mod rtcpeerconnectioniceevent; pub mod rtcsessiondescription; pub mod screen; pub mod serviceworker; diff --git a/components/script/dom/rtcpeerconnection.rs b/components/script/dom/rtcpeerconnection.rs index 41381ba43eb..8fa6b58023d 100644 --- a/components/script/dom/rtcpeerconnection.rs +++ b/components/script/dom/rtcpeerconnection.rs @@ -22,11 +22,14 @@ use servo_media::webrtc::MediaStream as BackendMediaStream; use servo_media::webrtc::{IceCandidate, WebRtcController, WebRtcSignaller}; use servo_media::ServoMedia; +use std::cell::Cell; + #[dom_struct] pub struct RTCPeerConnection { eventtarget: EventTarget, #[ignore_malloc_size_of = "defined in servo-media"] controller: DomRefCell>, + closed: Cell, } struct RTCSignaller { @@ -70,6 +73,7 @@ impl RTCPeerConnection { RTCPeerConnection { eventtarget: EventTarget::new_inherited(), controller: DomRefCell::new(None), + closed: Cell::new(false), } } diff --git a/components/script/dom/rtcpeerconnectioniceevent.rs b/components/script/dom/rtcpeerconnectioniceevent.rs new file mode 100644 index 00000000000..f77d0ec2ad9 --- /dev/null +++ b/components/script/dom/rtcpeerconnectioniceevent.rs @@ -0,0 +1,92 @@ +/* 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 https://mozilla.org/MPL/2.0/. */ + +use crate::dom::bindings::codegen::Bindings::EventBinding::EventMethods; +use crate::dom::bindings::codegen::Bindings::RTCPeerConnectionIceEventBinding; +use crate::dom::bindings::codegen::Bindings::RTCPeerConnectionIceEventBinding::RTCPeerConnectionIceEventInit; +use crate::dom::bindings::codegen::Bindings::RTCPeerConnectionIceEventBinding::RTCPeerConnectionIceEventMethods; +use crate::dom::bindings::error::Fallible; +use crate::dom::bindings::inheritance::Castable; +use crate::dom::bindings::reflector::reflect_dom_object; +use crate::dom::bindings::reflector::DomObject; +use crate::dom::bindings::root::{Dom, DomRoot}; +use crate::dom::bindings::str::DOMString; +use crate::dom::event::Event; +use crate::dom::globalscope::GlobalScope; +use crate::dom::rtcicecandidate::RTCIceCandidate; +use crate::dom::window::Window; +use dom_struct::dom_struct; +use servo_atoms::Atom; + +#[dom_struct] +pub struct RTCPeerConnectionIceEvent { + event: Event, + candidate: Option>, + url: Option, +} + +impl RTCPeerConnectionIceEvent { + pub fn new_inherited( + candidate: Option<&RTCIceCandidate>, + url: Option, + ) -> RTCPeerConnectionIceEvent { + RTCPeerConnectionIceEvent { + event: Event::new_inherited(), + candidate: candidate.map(Dom::from_ref), + url, + } + } + + pub fn new( + global: &GlobalScope, + ty: Atom, + candidate: Option<&RTCIceCandidate>, + url: Option, + trusted: bool, + ) -> DomRoot { + let e = reflect_dom_object( + Box::new(RTCPeerConnectionIceEvent::new_inherited(candidate, url)), + global, + RTCPeerConnectionIceEventBinding::Wrap, + ); + let evt = e.upcast::(); + evt.init_event(ty, false, false); // XXXManishearth bubbles/cancelable? + evt.set_trusted(trusted); + e + } + + pub fn Constructor( + window: &Window, + ty: DOMString, + init: &RTCPeerConnectionIceEventInit, + ) -> Fallible> { + Ok(RTCPeerConnectionIceEvent::new( + &window.global(), + ty.into(), + init.candidate + .as_ref() + .and_then(|x| x.as_ref()) + .map(|x| &**x), + init.url.as_ref().and_then(|x| x.clone()), + false, + )) + } +} + +impl RTCPeerConnectionIceEventMethods for RTCPeerConnectionIceEvent { + /// https://www.w3.org/TR/webrtc/#dom-rtcpeerconnectioniceevent-candidate + fn GetCandidate(&self) -> Option> { + self.candidate.as_ref().map(|x| DomRoot::from_ref(&**x)) + } + + /// https://www.w3.org/TR/webrtc/#dom-rtcpeerconnectioniceevent-url + fn GetUrl(&self) -> Option { + self.url.clone() + } + + /// https://dom.spec.whatwg.org/#dom-event-istrusted + fn IsTrusted(&self) -> bool { + self.event.IsTrusted() + } +} diff --git a/components/script/dom/webidls/RTCPeerConnectionIceEvent.webidl b/components/script/dom/webidls/RTCPeerConnectionIceEvent.webidl new file mode 100644 index 00000000000..26a3919b21f --- /dev/null +++ b/components/script/dom/webidls/RTCPeerConnectionIceEvent.webidl @@ -0,0 +1,17 @@ +/* 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 https://mozilla.org/MPL/2.0/. */ + +// https://w3c.github.io/webrtc-pc/#rtcpeerconnectioniceevent + +[Constructor(DOMString type, optional RTCPeerConnectionIceEventInit eventInitDict), + Exposed=Window, Pref="dom.webrtc.enabled"] +interface RTCPeerConnectionIceEvent : Event { + readonly attribute RTCIceCandidate? candidate; + readonly attribute DOMString? url; +}; + +dictionary RTCPeerConnectionIceEventInit : EventInit { + RTCIceCandidate? candidate; + DOMString? url; +}; From 841dd1eb4b73621e4bd29cabcdcc43eeb6ce549f Mon Sep 17 00:00:00 2001 From: Manish Goregaokar Date: Sat, 26 Jan 2019 20:02:08 -0800 Subject: [PATCH 10/26] Fire negotiationneeded and icecandidate events --- components/atoms/static_atoms.txt | 2 + components/script/dom/rtcpeerconnection.rs | 56 +++++++++++++++++-- .../dom/webidls/RTCPeerConnection.webidl | 4 +- 3 files changed, 56 insertions(+), 6 deletions(-) diff --git a/components/atoms/static_atoms.txt b/components/atoms/static_atoms.txt index db5680256f7..74f24a23e30 100644 --- a/components/atoms/static_atoms.txt +++ b/components/atoms/static_atoms.txt @@ -36,6 +36,7 @@ fullscreenerror gattserverdisconnected hashchange hidden +icecandidate image input invalid @@ -54,6 +55,7 @@ message monospace month mouseover +negotiationneeded none number onchange diff --git a/components/script/dom/rtcpeerconnection.rs b/components/script/dom/rtcpeerconnection.rs index 8fa6b58023d..6c3cd614364 100644 --- a/components/script/dom/rtcpeerconnection.rs +++ b/components/script/dom/rtcpeerconnection.rs @@ -3,15 +3,21 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ use crate::dom::bindings::cell::DomRefCell; -use crate::dom::bindings::codegen::Bindings::RTCPeerConnectionBinding; use crate::dom::bindings::codegen::Bindings::RTCPeerConnectionBinding::RTCConfiguration; +use crate::dom::bindings::codegen::Bindings::RTCPeerConnectionBinding::{ + self, RTCPeerConnectionMethods, +}; use crate::dom::bindings::error::Fallible; +use crate::dom::bindings::inheritance::Castable; use crate::dom::bindings::refcounted::Trusted; use crate::dom::bindings::reflector::reflect_dom_object; use crate::dom::bindings::reflector::DomObject; use crate::dom::bindings::root::DomRoot; +use crate::dom::event::{Event, EventBubbles, EventCancelable}; use crate::dom::eventtarget::EventTarget; use crate::dom::globalscope::GlobalScope; +use crate::dom::rtcicecandidate::RTCIceCandidate; +use crate::dom::rtcpeerconnectioniceevent::RTCPeerConnectionIceEvent; use crate::dom::window::Window; use crate::task::TaskCanceller; use crate::task_source::networking::NetworkingTaskSource; @@ -109,11 +115,53 @@ impl RTCPeerConnection { }) } - fn on_ice_candidate(&self, _candidate: IceCandidate) { - // todo + fn on_ice_candidate(&self, candidate: IceCandidate) { + if self.closed.get() { + return; + } + let candidate = RTCIceCandidate::new( + &self.global(), + candidate.candidate.into(), + None, + Some(candidate.sdp_mline_index as u16), + None, + ); + let event = RTCPeerConnectionIceEvent::new( + &self.global(), + atom!("icecandidate"), + Some(&candidate), + None, + true, + ); + event + .upcast::() + .fire(self.upcast()); } fn on_negotiation_needed(&self) { - // todo + if self.closed.get() { + return; + } + let event = Event::new( + &self.global(), + atom!("negotiationneeded"), + EventBubbles::DoesNotBubble, + EventCancelable::NotCancelable, + ); + event + .upcast::() + .fire(self.upcast()); } } + +impl RTCPeerConnectionMethods for RTCPeerConnection { + /// https://www.w3.org/TR/webrtc/#dom-rtcpeerconnection-icecandidate + event_handler!(icecandidate, GetOnicecandidate, SetOnicecandidate); + + /// https://www.w3.org/TR/webrtc/#dom-rtcpeerconnection-onnegotiationneeded + event_handler!( + negotiationneeded, + GetOnnegotiationneeded, + SetOnnegotiationneeded + ); +} diff --git a/components/script/dom/webidls/RTCPeerConnection.webidl b/components/script/dom/webidls/RTCPeerConnection.webidl index ec4ec83028c..6408382cc39 100644 --- a/components/script/dom/webidls/RTCPeerConnection.webidl +++ b/components/script/dom/webidls/RTCPeerConnection.webidl @@ -27,8 +27,8 @@ interface RTCPeerConnection : EventTarget { // RTCConfiguration getConfiguration(); // void setConfiguration(RTCConfiguration configuration); // void close(); - // attribute EventHandler onnegotiationneeded; - // attribute EventHandler onicecandidate; + attribute EventHandler onnegotiationneeded; + attribute EventHandler onicecandidate; // attribute EventHandler onicecandidateerror; // attribute EventHandler onsignalingstatechange; // attribute EventHandler oniceconnectionstatechange; From 9521c3d5a47e90abc06cf6e138f42bd2c99b0049 Mon Sep 17 00:00:00 2001 From: Manish Goregaokar Date: Sat, 26 Jan 2019 20:22:39 -0800 Subject: [PATCH 11/26] Add RTCPeerConnection::AddIceCandidate --- components/script/dom/rtcpeerconnection.rs | 35 +++++++++++++++++++ .../dom/webidls/RTCPeerConnection.webidl | 2 +- 2 files changed, 36 insertions(+), 1 deletion(-) diff --git a/components/script/dom/rtcpeerconnection.rs b/components/script/dom/rtcpeerconnection.rs index 6c3cd614364..fe6b87f741f 100644 --- a/components/script/dom/rtcpeerconnection.rs +++ b/components/script/dom/rtcpeerconnection.rs @@ -3,6 +3,7 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ use crate::dom::bindings::cell::DomRefCell; +use crate::dom::bindings::codegen::Bindings::RTCIceCandidateBinding::RTCIceCandidateInit; use crate::dom::bindings::codegen::Bindings::RTCPeerConnectionBinding::RTCConfiguration; use crate::dom::bindings::codegen::Bindings::RTCPeerConnectionBinding::{ self, RTCPeerConnectionMethods, @@ -13,9 +14,11 @@ use crate::dom::bindings::refcounted::Trusted; use crate::dom::bindings::reflector::reflect_dom_object; use crate::dom::bindings::reflector::DomObject; use crate::dom::bindings::root::DomRoot; +use crate::dom::bindings::error::Error; use crate::dom::event::{Event, EventBubbles, EventCancelable}; use crate::dom::eventtarget::EventTarget; use crate::dom::globalscope::GlobalScope; +use crate::dom::promise::Promise; use crate::dom::rtcicecandidate::RTCIceCandidate; use crate::dom::rtcpeerconnectioniceevent::RTCPeerConnectionIceEvent; use crate::dom::window::Window; @@ -29,6 +32,7 @@ use servo_media::webrtc::{IceCandidate, WebRtcController, WebRtcSignaller}; use servo_media::ServoMedia; use std::cell::Cell; +use std::rc::Rc; #[dom_struct] pub struct RTCPeerConnection { @@ -164,4 +168,35 @@ impl RTCPeerConnectionMethods for RTCPeerConnection { GetOnnegotiationneeded, SetOnnegotiationneeded ); + + /// https://www.w3.org/TR/webrtc/#dom-rtcpeerconnection-addicecandidate + fn AddIceCandidate(&self, candidate: &RTCIceCandidateInit) -> Rc { + let p = Promise::new(&self.global()); + if candidate.sdpMid.is_none() && candidate.sdpMLineIndex.is_none() { + p.reject_error(Error::Type(format!( + "one of sdpMid and sdpMLineIndex must be set" + ))); + return p; + } + + // XXXManishearth add support for sdpMid + if candidate.sdpMLineIndex.is_none() { + p.reject_error(Error::Type(format!( + "servo only supports sdpMLineIndex right now" + ))); + return p; + } + + // XXXManishearth this should be enqueued + // https://www.w3.org/TR/webrtc/#enqueue-an-operation + + self.controller.borrow_mut().as_ref().unwrap().add_ice_candidate(IceCandidate { + sdp_mline_index: candidate.sdpMLineIndex.unwrap() as u32, + candidate: candidate.candidate.to_string() + }); + + // XXXManishearth add_ice_candidate should have a callback + p.resolve_native(&()); + p + } } diff --git a/components/script/dom/webidls/RTCPeerConnection.webidl b/components/script/dom/webidls/RTCPeerConnection.webidl index 6408382cc39..300b76961fc 100644 --- a/components/script/dom/webidls/RTCPeerConnection.webidl +++ b/components/script/dom/webidls/RTCPeerConnection.webidl @@ -17,7 +17,7 @@ interface RTCPeerConnection : EventTarget { // readonly attribute RTCSessionDescription? remoteDescription; // readonly attribute RTCSessionDescription? currentRemoteDescription; // readonly attribute RTCSessionDescription? pendingRemoteDescription; - // Promise addIceCandidate(RTCIceCandidateInit candidate); + Promise addIceCandidate(optional RTCIceCandidateInit candidate); // readonly attribute RTCSignalingState signalingState; // readonly attribute RTCIceGatheringState iceGatheringState; // readonly attribute RTCIceConnectionState iceConnectionState; From c156289a0c759025c63ec4065b3f41fcc6db01d3 Mon Sep 17 00:00:00 2001 From: Manish Goregaokar Date: Sat, 26 Jan 2019 22:28:08 -0800 Subject: [PATCH 12/26] Add createOfer --- components/script/dom/rtcpeerconnection.rs | 91 +++++++++++++++++-- .../dom/webidls/RTCPeerConnection.webidl | 13 ++- 2 files changed, 95 insertions(+), 9 deletions(-) diff --git a/components/script/dom/rtcpeerconnection.rs b/components/script/dom/rtcpeerconnection.rs index fe6b87f741f..2225051e351 100644 --- a/components/script/dom/rtcpeerconnection.rs +++ b/components/script/dom/rtcpeerconnection.rs @@ -4,17 +4,21 @@ use crate::dom::bindings::cell::DomRefCell; use crate::dom::bindings::codegen::Bindings::RTCIceCandidateBinding::RTCIceCandidateInit; -use crate::dom::bindings::codegen::Bindings::RTCPeerConnectionBinding::RTCConfiguration; +use crate::dom::bindings::codegen::Bindings::RTCPeerConnectionBinding; +use crate::dom::bindings::codegen::Bindings::RTCPeerConnectionBinding::RTCPeerConnectionMethods; use crate::dom::bindings::codegen::Bindings::RTCPeerConnectionBinding::{ - self, RTCPeerConnectionMethods, + RTCConfiguration, RTCOfferOptions, }; +use crate::dom::bindings::codegen::Bindings::RTCSessionDescriptionBinding::{ + RTCSdpType, RTCSessionDescriptionInit, +}; +use crate::dom::bindings::error::Error; use crate::dom::bindings::error::Fallible; use crate::dom::bindings::inheritance::Castable; use crate::dom::bindings::refcounted::Trusted; use crate::dom::bindings::reflector::reflect_dom_object; use crate::dom::bindings::reflector::DomObject; use crate::dom::bindings::root::DomRoot; -use crate::dom::bindings::error::Error; use crate::dom::event::{Event, EventBubbles, EventCancelable}; use crate::dom::eventtarget::EventTarget; use crate::dom::globalscope::GlobalScope; @@ -28,7 +32,9 @@ use crate::task_source::TaskSource; use dom_struct::dom_struct; use servo_media::webrtc::MediaStream as BackendMediaStream; -use servo_media::webrtc::{IceCandidate, WebRtcController, WebRtcSignaller}; +use servo_media::webrtc::{ + IceCandidate, SdpType, SessionDescription, WebRtcController, WebRtcSignaller, +}; use servo_media::ServoMedia; use std::cell::Cell; @@ -40,6 +46,11 @@ pub struct RTCPeerConnection { #[ignore_malloc_size_of = "defined in servo-media"] controller: DomRefCell>, closed: Cell, + /// Helps track state changes between the time createOffer + /// is called and resolved + offer_generation: Cell, + #[ignore_malloc_size_of = "promises are hard"] + offer_promises: DomRefCell>>, } struct RTCSignaller { @@ -84,6 +95,8 @@ impl RTCPeerConnection { eventtarget: EventTarget::new_inherited(), controller: DomRefCell::new(None), closed: Cell::new(false), + offer_generation: Cell::new(0), + offer_promises: DomRefCell::new(vec![]), } } @@ -156,6 +169,37 @@ impl RTCPeerConnection { .upcast::() .fire(self.upcast()); } + + fn create_offer(&self) { + let generation = self.offer_generation.get(); + let (task_source, canceller) = self + .global() + .as_window() + .task_manager() + .networking_task_source_with_canceller(); + let this = Trusted::new(self); + self.controller.borrow_mut().as_ref().unwrap().create_offer( + (move |desc: SessionDescription| { + let _ = task_source.queue_with_canceller( + task!(offer_created: move || { + let this = this.root(); + if this.offer_generation.get() != generation { + // the state has changed since we last created the offer, + // create a fresh one + this.create_offer(); + } else { + let init: RTCSessionDescriptionInit = desc.into(); + for promise in this.offer_promises.borrow_mut().drain(..) { + promise.resolve_native(&init); + } + } + }), + &canceller, + ); + }) + .into(), + ); + } } impl RTCPeerConnectionMethods for RTCPeerConnection { @@ -190,13 +234,44 @@ impl RTCPeerConnectionMethods for RTCPeerConnection { // XXXManishearth this should be enqueued // https://www.w3.org/TR/webrtc/#enqueue-an-operation - self.controller.borrow_mut().as_ref().unwrap().add_ice_candidate(IceCandidate { - sdp_mline_index: candidate.sdpMLineIndex.unwrap() as u32, - candidate: candidate.candidate.to_string() - }); + self.controller + .borrow_mut() + .as_ref() + .unwrap() + .add_ice_candidate(IceCandidate { + sdp_mline_index: candidate.sdpMLineIndex.unwrap() as u32, + candidate: candidate.candidate.to_string(), + }); // XXXManishearth add_ice_candidate should have a callback p.resolve_native(&()); p } + + /// https://www.w3.org/TR/webrtc/#dom-rtcpeerconnection-createoffer + fn CreateOffer(&self, _options: &RTCOfferOptions) -> Rc { + let p = Promise::new(&self.global()); + if self.closed.get() { + p.reject_error(Error::InvalidState); + return p; + } + self.offer_promises.borrow_mut().push(p.clone()); + self.create_offer(); + p + } +} + +impl From for RTCSessionDescriptionInit { + fn from(desc: SessionDescription) -> Self { + let type_ = match desc.type_ { + SdpType::Answer => RTCSdpType::Answer, + SdpType::Offer => RTCSdpType::Offer, + SdpType::Pranswer => RTCSdpType::Pranswer, + SdpType::Rollback => RTCSdpType::Rollback, + }; + RTCSessionDescriptionInit { + type_, + sdp: desc.sdp.into(), + } + } } diff --git a/components/script/dom/webidls/RTCPeerConnection.webidl b/components/script/dom/webidls/RTCPeerConnection.webidl index 300b76961fc..b55957add14 100644 --- a/components/script/dom/webidls/RTCPeerConnection.webidl +++ b/components/script/dom/webidls/RTCPeerConnection.webidl @@ -7,7 +7,7 @@ [Constructor(optional RTCConfiguration configuration), Exposed=Window, Pref="dom.webrtc.enabled"] interface RTCPeerConnection : EventTarget { - // Promise createOffer(optional RTCOfferOptions options); + Promise createOffer(optional RTCOfferOptions options); // Promise createAnswer(optional RTCAnswerOptions options); // Promise setLocalDescription(RTCSessionDescriptionInit description); // readonly attribute RTCSessionDescription? localDescription; @@ -75,3 +75,14 @@ enum RTCIceCredentialType { "password", "oauth" }; + +dictionary RTCOfferAnswerOptions { + boolean voiceActivityDetection = true; +}; + +dictionary RTCOfferOptions : RTCOfferAnswerOptions { + boolean iceRestart = false; +}; + +dictionary RTCAnswerOptions : RTCOfferAnswerOptions { +}; \ No newline at end of file From cfc235bad284df0537e3eececb52a759f675b737 Mon Sep 17 00:00:00 2001 From: Manish Goregaokar Date: Sat, 26 Jan 2019 22:40:44 -0800 Subject: [PATCH 13/26] Add createAnswer --- components/script/dom/rtcpeerconnection.rs | 62 +++++++++++++++++-- .../dom/webidls/RTCPeerConnection.webidl | 4 +- 2 files changed, 58 insertions(+), 8 deletions(-) diff --git a/components/script/dom/rtcpeerconnection.rs b/components/script/dom/rtcpeerconnection.rs index 2225051e351..cffd2db01d8 100644 --- a/components/script/dom/rtcpeerconnection.rs +++ b/components/script/dom/rtcpeerconnection.rs @@ -7,7 +7,7 @@ use crate::dom::bindings::codegen::Bindings::RTCIceCandidateBinding::RTCIceCandi use crate::dom::bindings::codegen::Bindings::RTCPeerConnectionBinding; use crate::dom::bindings::codegen::Bindings::RTCPeerConnectionBinding::RTCPeerConnectionMethods; use crate::dom::bindings::codegen::Bindings::RTCPeerConnectionBinding::{ - RTCConfiguration, RTCOfferOptions, + RTCAnswerOptions, RTCConfiguration, RTCOfferOptions, }; use crate::dom::bindings::codegen::Bindings::RTCSessionDescriptionBinding::{ RTCSdpType, RTCSessionDescriptionInit, @@ -46,11 +46,13 @@ pub struct RTCPeerConnection { #[ignore_malloc_size_of = "defined in servo-media"] controller: DomRefCell>, closed: Cell, - /// Helps track state changes between the time createOffer + /// Helps track state changes between the time createOffer/createAnswer /// is called and resolved - offer_generation: Cell, + offer_answer_generation: Cell, #[ignore_malloc_size_of = "promises are hard"] offer_promises: DomRefCell>>, + #[ignore_malloc_size_of = "promises are hard"] + answer_promises: DomRefCell>>, } struct RTCSignaller { @@ -95,8 +97,9 @@ impl RTCPeerConnection { eventtarget: EventTarget::new_inherited(), controller: DomRefCell::new(None), closed: Cell::new(false), - offer_generation: Cell::new(0), + offer_answer_generation: Cell::new(0), offer_promises: DomRefCell::new(vec![]), + answer_promises: DomRefCell::new(vec![]), } } @@ -171,7 +174,7 @@ impl RTCPeerConnection { } fn create_offer(&self) { - let generation = self.offer_generation.get(); + let generation = self.offer_answer_generation.get(); let (task_source, canceller) = self .global() .as_window() @@ -183,7 +186,7 @@ impl RTCPeerConnection { let _ = task_source.queue_with_canceller( task!(offer_created: move || { let this = this.root(); - if this.offer_generation.get() != generation { + if this.offer_answer_generation.get() != generation { // the state has changed since we last created the offer, // create a fresh one this.create_offer(); @@ -200,6 +203,41 @@ impl RTCPeerConnection { .into(), ); } + + fn create_answer(&self) { + let generation = self.offer_answer_generation.get(); + let (task_source, canceller) = self + .global() + .as_window() + .task_manager() + .networking_task_source_with_canceller(); + let this = Trusted::new(self); + self.controller + .borrow_mut() + .as_ref() + .unwrap() + .create_answer( + (move |desc: SessionDescription| { + let _ = task_source.queue_with_canceller( + task!(answer_created: move || { + let this = this.root(); + if this.offer_answer_generation.get() != generation { + // the state has changed since we last created the offer, + // create a fresh one + this.create_answer(); + } else { + let init: RTCSessionDescriptionInit = desc.into(); + for promise in this.answer_promises.borrow_mut().drain(..) { + promise.resolve_native(&init); + } + } + }), + &canceller, + ); + }) + .into(), + ); + } } impl RTCPeerConnectionMethods for RTCPeerConnection { @@ -259,6 +297,18 @@ impl RTCPeerConnectionMethods for RTCPeerConnection { self.create_offer(); p } + + /// https://www.w3.org/TR/webrtc/#dom-rtcpeerconnection-createoffer + fn CreateAnswer(&self, _options: &RTCAnswerOptions) -> Rc { + let p = Promise::new(&self.global()); + if self.closed.get() { + p.reject_error(Error::InvalidState); + return p; + } + self.answer_promises.borrow_mut().push(p.clone()); + self.create_answer(); + p + } } impl From for RTCSessionDescriptionInit { diff --git a/components/script/dom/webidls/RTCPeerConnection.webidl b/components/script/dom/webidls/RTCPeerConnection.webidl index b55957add14..f076b306a53 100644 --- a/components/script/dom/webidls/RTCPeerConnection.webidl +++ b/components/script/dom/webidls/RTCPeerConnection.webidl @@ -8,7 +8,7 @@ Exposed=Window, Pref="dom.webrtc.enabled"] interface RTCPeerConnection : EventTarget { Promise createOffer(optional RTCOfferOptions options); - // Promise createAnswer(optional RTCAnswerOptions options); + Promise createAnswer(optional RTCAnswerOptions options); // Promise setLocalDescription(RTCSessionDescriptionInit description); // readonly attribute RTCSessionDescription? localDescription; // readonly attribute RTCSessionDescription? currentLocalDescription; @@ -85,4 +85,4 @@ dictionary RTCOfferOptions : RTCOfferAnswerOptions { }; dictionary RTCAnswerOptions : RTCOfferAnswerOptions { -}; \ No newline at end of file +}; From 95cd67cb6556920b846e222513414e7bded43d93 Mon Sep 17 00:00:00 2001 From: Manish Goregaokar Date: Sun, 27 Jan 2019 08:49:55 -0800 Subject: [PATCH 14/26] Add RTCPeerConnection::SetLocalDescription --- components/script/dom/rtcpeerconnection.rs | 59 ++++++++++++++++++- .../dom/webidls/RTCPeerConnection.webidl | 4 +- 2 files changed, 59 insertions(+), 4 deletions(-) diff --git a/components/script/dom/rtcpeerconnection.rs b/components/script/dom/rtcpeerconnection.rs index cffd2db01d8..75048b2dee8 100644 --- a/components/script/dom/rtcpeerconnection.rs +++ b/components/script/dom/rtcpeerconnection.rs @@ -15,16 +15,17 @@ use crate::dom::bindings::codegen::Bindings::RTCSessionDescriptionBinding::{ use crate::dom::bindings::error::Error; use crate::dom::bindings::error::Fallible; use crate::dom::bindings::inheritance::Castable; -use crate::dom::bindings::refcounted::Trusted; +use crate::dom::bindings::refcounted::{Trusted, TrustedPromise}; use crate::dom::bindings::reflector::reflect_dom_object; use crate::dom::bindings::reflector::DomObject; -use crate::dom::bindings::root::DomRoot; +use crate::dom::bindings::root::{DomRoot, MutNullableDom}; use crate::dom::event::{Event, EventBubbles, EventCancelable}; use crate::dom::eventtarget::EventTarget; use crate::dom::globalscope::GlobalScope; use crate::dom::promise::Promise; use crate::dom::rtcicecandidate::RTCIceCandidate; use crate::dom::rtcpeerconnectioniceevent::RTCPeerConnectionIceEvent; +use crate::dom::rtcsessiondescription::RTCSessionDescription; use crate::dom::window::Window; use crate::task::TaskCanceller; use crate::task_source::networking::NetworkingTaskSource; @@ -53,6 +54,7 @@ pub struct RTCPeerConnection { offer_promises: DomRefCell>>, #[ignore_malloc_size_of = "promises are hard"] answer_promises: DomRefCell>>, + local_description: MutNullableDom, } struct RTCSignaller { @@ -100,6 +102,7 @@ impl RTCPeerConnection { offer_answer_generation: Cell::new(0), offer_promises: DomRefCell::new(vec![]), answer_promises: DomRefCell::new(vec![]), + local_description: Default::default(), } } @@ -309,6 +312,43 @@ impl RTCPeerConnectionMethods for RTCPeerConnection { self.create_answer(); p } + + /// https://www.w3.org/TR/webrtc/#dom-rtcpeerconnection-localdescription + fn GetLocalDescription(&self) -> Option> { + self.local_description.get() + } + + /// https://www.w3.org/TR/webrtc/#dom-rtcpeerconnection-setlocaldescription + fn SetLocalDescription(&self, desc: &RTCSessionDescriptionInit) -> Rc { + let p = Promise::new(&self.global()); + let this = Trusted::new(self); + let desc: SessionDescription = desc.into(); + let trusted_promise = TrustedPromise::new(p.clone()); + let (task_source, canceller) = self + .global() + .as_window() + .task_manager() + .networking_task_source_with_canceller(); + self.controller + .borrow_mut() + .as_ref() + .unwrap() + .set_local_description(desc.clone(), (move || { + let _ = task_source.queue_with_canceller( + task!(local_description_set: move || { + // XXXManishearth spec actually asks for an intricate + // dance between pending/current local/remote descriptions + let this = this.root(); + let desc = desc.into(); + let desc = RTCSessionDescription::Constructor(&this.global().as_window(), &desc).unwrap(); + this.local_description.set(Some(&desc)); + trusted_promise.root().resolve_native(&()) + }), + &canceller, + ); + }).into()); + p + } } impl From for RTCSessionDescriptionInit { @@ -325,3 +365,18 @@ impl From for RTCSessionDescriptionInit { } } } + +impl<'a> From<&'a RTCSessionDescriptionInit> for SessionDescription { + fn from(desc: &'a RTCSessionDescriptionInit) -> Self { + let type_ = match desc.type_ { + RTCSdpType::Answer => SdpType::Answer, + RTCSdpType::Offer => SdpType::Offer, + RTCSdpType::Pranswer => SdpType::Pranswer, + RTCSdpType::Rollback => SdpType::Rollback, + }; + SessionDescription { + type_, + sdp: desc.sdp.to_string(), + } + } +} diff --git a/components/script/dom/webidls/RTCPeerConnection.webidl b/components/script/dom/webidls/RTCPeerConnection.webidl index f076b306a53..babe009e302 100644 --- a/components/script/dom/webidls/RTCPeerConnection.webidl +++ b/components/script/dom/webidls/RTCPeerConnection.webidl @@ -9,8 +9,8 @@ interface RTCPeerConnection : EventTarget { Promise createOffer(optional RTCOfferOptions options); Promise createAnswer(optional RTCAnswerOptions options); - // Promise setLocalDescription(RTCSessionDescriptionInit description); - // readonly attribute RTCSessionDescription? localDescription; + Promise setLocalDescription(RTCSessionDescriptionInit description); + readonly attribute RTCSessionDescription? localDescription; // readonly attribute RTCSessionDescription? currentLocalDescription; // readonly attribute RTCSessionDescription? pendingLocalDescription; // Promise setRemoteDescription(RTCSessionDescriptionInit description); From 93a359e528a3813feaa338fc6020614d3bd7b99b Mon Sep 17 00:00:00 2001 From: Manish Goregaokar Date: Sun, 27 Jan 2019 09:10:39 -0800 Subject: [PATCH 15/26] Add RTCPeerConnection::SetRemoteDescription --- components/script/dom/rtcpeerconnection.rs | 41 +++++++++++++++++++ .../dom/webidls/RTCPeerConnection.webidl | 4 +- 2 files changed, 43 insertions(+), 2 deletions(-) diff --git a/components/script/dom/rtcpeerconnection.rs b/components/script/dom/rtcpeerconnection.rs index 75048b2dee8..6105bdd81eb 100644 --- a/components/script/dom/rtcpeerconnection.rs +++ b/components/script/dom/rtcpeerconnection.rs @@ -55,6 +55,7 @@ pub struct RTCPeerConnection { #[ignore_malloc_size_of = "promises are hard"] answer_promises: DomRefCell>>, local_description: MutNullableDom, + remote_description: MutNullableDom, } struct RTCSignaller { @@ -103,6 +104,7 @@ impl RTCPeerConnection { offer_promises: DomRefCell::new(vec![]), answer_promises: DomRefCell::new(vec![]), local_description: Default::default(), + remote_description: Default::default(), } } @@ -318,8 +320,14 @@ impl RTCPeerConnectionMethods for RTCPeerConnection { self.local_description.get() } + /// https://www.w3.org/TR/webrtc/#dom-rtcpeerconnection-remotedescription + fn GetRemoteDescription(&self) -> Option> { + self.remote_description.get() + } + /// https://www.w3.org/TR/webrtc/#dom-rtcpeerconnection-setlocaldescription fn SetLocalDescription(&self, desc: &RTCSessionDescriptionInit) -> Rc { + // XXXManishearth validate the current state let p = Promise::new(&self.global()); let this = Trusted::new(self); let desc: SessionDescription = desc.into(); @@ -349,6 +357,39 @@ impl RTCPeerConnectionMethods for RTCPeerConnection { }).into()); p } + + /// https://www.w3.org/TR/webrtc/#dom-rtcpeerconnection-setremotedescription + fn SetRemoteDescription(&self, desc: &RTCSessionDescriptionInit) -> Rc { + // XXXManishearth validate the current state + let p = Promise::new(&self.global()); + let this = Trusted::new(self); + let desc: SessionDescription = desc.into(); + let trusted_promise = TrustedPromise::new(p.clone()); + let (task_source, canceller) = self + .global() + .as_window() + .task_manager() + .networking_task_source_with_canceller(); + self.controller + .borrow_mut() + .as_ref() + .unwrap() + .set_remote_description(desc.clone(), (move || { + let _ = task_source.queue_with_canceller( + task!(remote_description_set: move || { + // XXXManishearth spec actually asks for an intricate + // dance between pending/current local/remote descriptions + let this = this.root(); + let desc = desc.into(); + let desc = RTCSessionDescription::Constructor(&this.global().as_window(), &desc).unwrap(); + this.remote_description.set(Some(&desc)); + trusted_promise.root().resolve_native(&()) + }), + &canceller, + ); + }).into()); + p + } } impl From for RTCSessionDescriptionInit { diff --git a/components/script/dom/webidls/RTCPeerConnection.webidl b/components/script/dom/webidls/RTCPeerConnection.webidl index babe009e302..c68efd7e2b0 100644 --- a/components/script/dom/webidls/RTCPeerConnection.webidl +++ b/components/script/dom/webidls/RTCPeerConnection.webidl @@ -13,8 +13,8 @@ interface RTCPeerConnection : EventTarget { readonly attribute RTCSessionDescription? localDescription; // readonly attribute RTCSessionDescription? currentLocalDescription; // readonly attribute RTCSessionDescription? pendingLocalDescription; - // Promise setRemoteDescription(RTCSessionDescriptionInit description); - // readonly attribute RTCSessionDescription? remoteDescription; + Promise setRemoteDescription(RTCSessionDescriptionInit description); + readonly attribute RTCSessionDescription? remoteDescription; // readonly attribute RTCSessionDescription? currentRemoteDescription; // readonly attribute RTCSessionDescription? pendingRemoteDescription; Promise addIceCandidate(optional RTCIceCandidateInit candidate); From bafbc0e1c075ffad842984e2d23a1c68e94442b2 Mon Sep 17 00:00:00 2001 From: Manish Goregaokar Date: Mon, 28 Jan 2019 12:52:12 -0800 Subject: [PATCH 16/26] Add empty MediaDevices interface --- components/script/dom/mediadevices.rs | 34 +++++++ components/script/dom/mod.rs | 1 + .../script/dom/webidls/MediaDevices.webidl | 88 +++++++++++++++++++ 3 files changed, 123 insertions(+) create mode 100644 components/script/dom/mediadevices.rs create mode 100644 components/script/dom/webidls/MediaDevices.webidl diff --git a/components/script/dom/mediadevices.rs b/components/script/dom/mediadevices.rs new file mode 100644 index 00000000000..5897ad576eb --- /dev/null +++ b/components/script/dom/mediadevices.rs @@ -0,0 +1,34 @@ +/* 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 https://mozilla.org/MPL/2.0/. */ + +use crate::dom::bindings::codegen::Bindings::MediaDevicesBinding; +use crate::dom::bindings::error::Fallible; +use crate::dom::bindings::reflector::reflect_dom_object; +use crate::dom::bindings::reflector::DomObject; +use crate::dom::bindings::root::DomRoot; +use crate::dom::eventtarget::EventTarget; +use crate::dom::globalscope::GlobalScope; +use crate::dom::window::Window; +use dom_struct::dom_struct; + +#[dom_struct] +pub struct MediaDevices { + eventtarget: EventTarget, +} + +impl MediaDevices { + pub fn new_inherited() -> MediaDevices { + MediaDevices { + eventtarget: EventTarget::new_inherited(), + } + } + + pub fn new(global: &GlobalScope) -> DomRoot { + reflect_dom_object( + Box::new(MediaDevices::new_inherited()), + global, + MediaDevicesBinding::Wrap, + ) + } +} diff --git a/components/script/dom/mod.rs b/components/script/dom/mod.rs index 3dc7f530933..6d7dbcc92ab 100644 --- a/components/script/dom/mod.rs +++ b/components/script/dom/mod.rs @@ -389,6 +389,7 @@ pub mod imagedata; pub mod inputevent; pub mod keyboardevent; pub mod location; +pub mod mediadevices; pub mod mediaerror; pub mod medialist; pub mod mediaquerylist; diff --git a/components/script/dom/webidls/MediaDevices.webidl b/components/script/dom/webidls/MediaDevices.webidl new file mode 100644 index 00000000000..d22dbb2dff4 --- /dev/null +++ b/components/script/dom/webidls/MediaDevices.webidl @@ -0,0 +1,88 @@ +/* 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 https://mozilla.org/MPL/2.0/. */ + +// https://w3c.github.io/mediacapture-main/#dom-mediadevices + +[Exposed=Window, +SecureContext, Pref="dom.webrtc.enabled"] +interface MediaDevices : EventTarget { + // attribute EventHandler ondevicechange; + // Promise> enumerateDevices(); +}; + +partial interface Navigator { + // [SameObject, SecureContext] + // readonly attribute MediaDevices mediaDevices; +}; + +partial interface MediaDevices { + // MediaTrackSupportedConstraints getSupportedConstraints(); + // Promise getUserMedia(optional MediaStreamConstraints constraints); +}; + + +dictionary MediaStreamConstraints { + // (boolean or MediaTrackConstraints) video = false; + // (boolean or MediaTrackConstraints) audio = false; + boolean video = false; + boolean audio = false; +}; + +// dictionary DoubleRange { +// double max; +// double min; +// }; + +// dictionary ConstrainDoubleRange : DoubleRange { +// double exact; +// double ideal; +// }; + +// dictionary ULongRange { +// [Clamp] unsigned long max; +// [Clamp] unsigned long min; +// }; + +// dictionary ConstrainULongRange : ULongRange { +// [Clamp] unsigned long exact; +// [Clamp] unsigned long ideal; +// }; + +// dictionary ConstrainBooleanParameters { +// boolean exact; +// boolean ideal; +// }; + +// dictionary ConstrainDOMStringParameters { +// (DOMString or sequence) exact; +// (DOMString or sequence) ideal; +// }; + +// dictionary MediaTrackConstraints : MediaTrackConstraintSet { +// sequence advanced; +// }; + +// typedef ([Clamp] unsigned long or ConstrainULongRange) ConstrainULong; +// typedef (double or ConstrainDoubleRange) ConstrainDouble; +// typedef (boolean or ConstrainBooleanParameters) ConstrainBoolean; +// typedef (DOMString or sequence or ConstrainDOMStringParameters) ConstrainDOMString; + +// dictionary MediaTrackConstraintSet { +// ConstrainULong width; +// ConstrainULong height; +// ConstrainDouble aspectRatio; +// ConstrainDouble frameRate; +// ConstrainDOMString facingMode; +// ConstrainDOMString resizeMode; +// ConstrainDouble volume; +// ConstrainULong sampleRate; +// ConstrainULong sampleSize; +// ConstrainBoolean echoCancellation; +// ConstrainBoolean autoGainControl; +// ConstrainBoolean noiseSuppression; +// ConstrainDouble latency; +// ConstrainULong channelCount; +// ConstrainDOMString deviceId; +// ConstrainDOMString groupId; +// }; From 8b55d69fe14ac6fc2867e5a630f1891e56858e82 Mon Sep 17 00:00:00 2001 From: Manish Goregaokar Date: Mon, 28 Jan 2019 13:10:57 -0800 Subject: [PATCH 17/26] Add empty MediaStream interface --- components/script/dom/mediastream.rs | 34 +++++++++++++++++++ components/script/dom/mod.rs | 1 + .../script/dom/webidls/MediaStream.webidl | 24 +++++++++++++ 3 files changed, 59 insertions(+) create mode 100644 components/script/dom/mediastream.rs create mode 100644 components/script/dom/webidls/MediaStream.webidl diff --git a/components/script/dom/mediastream.rs b/components/script/dom/mediastream.rs new file mode 100644 index 00000000000..2641a9929bb --- /dev/null +++ b/components/script/dom/mediastream.rs @@ -0,0 +1,34 @@ +/* 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 https://mozilla.org/MPL/2.0/. */ + +use crate::dom::bindings::codegen::Bindings::MediaStreamBinding; +use crate::dom::bindings::error::Fallible; +use crate::dom::bindings::reflector::reflect_dom_object; +use crate::dom::bindings::reflector::DomObject; +use crate::dom::bindings::root::DomRoot; +use crate::dom::eventtarget::EventTarget; +use crate::dom::globalscope::GlobalScope; +use crate::dom::window::Window; +use dom_struct::dom_struct; + +#[dom_struct] +pub struct MediaStream { + eventtarget: EventTarget, +} + +impl MediaStream { + pub fn new_inherited() -> MediaStream { + MediaStream { + eventtarget: EventTarget::new_inherited(), + } + } + + pub fn new(global: &GlobalScope) -> DomRoot { + reflect_dom_object( + Box::new(MediaStream::new_inherited()), + global, + MediaStreamBinding::Wrap, + ) + } +} diff --git a/components/script/dom/mod.rs b/components/script/dom/mod.rs index 6d7dbcc92ab..a965b6893bc 100644 --- a/components/script/dom/mod.rs +++ b/components/script/dom/mod.rs @@ -394,6 +394,7 @@ pub mod mediaerror; pub mod medialist; pub mod mediaquerylist; pub mod mediaquerylistevent; +pub mod mediastream; pub mod messageevent; pub mod mimetype; pub mod mimetypearray; diff --git a/components/script/dom/webidls/MediaStream.webidl b/components/script/dom/webidls/MediaStream.webidl new file mode 100644 index 00000000000..0257e3c6061 --- /dev/null +++ b/components/script/dom/webidls/MediaStream.webidl @@ -0,0 +1,24 @@ +/* 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 https://mozilla.org/MPL/2.0/. */ + +// https://w3c.github.io/mediacapture-main/#dom-mediastream + +// [Exposed=Window, +// Constructor, +// Constructor(MediaStream stream), +// Constructor(sequence tracks)] +[Exposed=Window, Pref="dom.webrtc.enabled"] +interface MediaStream : EventTarget { + // readonly attribute DOMString id; + // sequence getAudioTracks(); + // sequence getVideoTracks(); + // sequence getTracks(); + // MediaStreamTrack? getTrackById(DOMString trackId); + // void addTrack(MediaStreamTrack track); + // void removeTrack(MediaStreamTrack track); + // MediaStream clone(); + // readonly attribute boolean active; + // attribute EventHandler onaddtrack; + // attribute EventHandler onremovetrack; +}; From eee183d7f4dc38194e77200d655a40c00a02e5c3 Mon Sep 17 00:00:00 2001 From: Manish Goregaokar Date: Mon, 28 Jan 2019 13:15:38 -0800 Subject: [PATCH 18/26] Add Navigator::MediaDevices --- components/script/dom/navigator.rs | 8 ++++++++ components/script/dom/webidls/MediaDevices.webidl | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/components/script/dom/navigator.rs b/components/script/dom/navigator.rs index 1d60759f1d7..49d7646b3c8 100644 --- a/components/script/dom/navigator.rs +++ b/components/script/dom/navigator.rs @@ -10,6 +10,7 @@ use crate::dom::bindings::root::{DomRoot, MutNullableDom}; use crate::dom::bindings::str::DOMString; use crate::dom::bluetooth::Bluetooth; use crate::dom::gamepadlist::GamepadList; +use crate::dom::mediadevices::MediaDevices; use crate::dom::mimetypearray::MimeTypeArray; use crate::dom::navigatorinfo; use crate::dom::permissions::Permissions; @@ -29,6 +30,7 @@ pub struct Navigator { mime_types: MutNullableDom, service_worker: MutNullableDom, xr: MutNullableDom, + mediadevices: MutNullableDom, gamepads: MutNullableDom, permissions: MutNullableDom, } @@ -42,6 +44,7 @@ impl Navigator { mime_types: Default::default(), service_worker: Default::default(), xr: Default::default(), + mediadevices: Default::default(), gamepads: Default::default(), permissions: Default::default(), } @@ -161,4 +164,9 @@ impl NavigatorMethods for Navigator { fn Xr(&self) -> DomRoot { self.xr.or_init(|| XR::new(&self.global())) } + + /// https://w3c.github.io/mediacapture-main/#dom-navigator-mediadevices + fn MediaDevices(&self) -> DomRoot { + self.mediadevices.or_init(|| MediaDevices::new(&self.global())) + } } diff --git a/components/script/dom/webidls/MediaDevices.webidl b/components/script/dom/webidls/MediaDevices.webidl index d22dbb2dff4..da877bde267 100644 --- a/components/script/dom/webidls/MediaDevices.webidl +++ b/components/script/dom/webidls/MediaDevices.webidl @@ -13,7 +13,7 @@ interface MediaDevices : EventTarget { partial interface Navigator { // [SameObject, SecureContext] - // readonly attribute MediaDevices mediaDevices; + [Pref="dom.webrtc.enabled"] readonly attribute MediaDevices mediaDevices; }; partial interface MediaDevices { From 8b0719a6f2dd9cfefa33ddd10800399cd59f36e5 Mon Sep 17 00:00:00 2001 From: Manish Goregaokar Date: Mon, 28 Jan 2019 13:23:25 -0800 Subject: [PATCH 19/26] Add MediaDevices::GetUserMedia --- components/script/dom/bindings/trace.rs | 3 +- components/script/dom/mediadevices.rs | 31 +++++++++++++++++-- components/script/dom/mediastream.rs | 13 ++++---- components/script/dom/navigator.rs | 3 +- .../script/dom/webidls/MediaDevices.webidl | 2 +- 5 files changed, 40 insertions(+), 12 deletions(-) diff --git a/components/script/dom/bindings/trace.rs b/components/script/dom/bindings/trace.rs index c128b6d9154..3e20fab1dcf 100644 --- a/components/script/dom/bindings/trace.rs +++ b/components/script/dom/bindings/trace.rs @@ -101,7 +101,7 @@ use servo_media::audio::graph::NodeId; use servo_media::audio::panner_node::{DistanceModel, PanningModel}; use servo_media::audio::param::ParamType; use servo_media::player::Player; -use servo_media::webrtc::WebRtcController; +use servo_media::webrtc::{MediaStream as BackendMediaStream, WebRtcController}; use servo_media::Backend; use servo_url::{ImmutableOrigin, MutableOrigin, ServoUrl}; use smallvec::SmallVec; @@ -485,6 +485,7 @@ unsafe_no_jsmanaged_fields!(NodeId); unsafe_no_jsmanaged_fields!(AnalysisEngine, DistanceModel, PanningModel, ParamType); unsafe_no_jsmanaged_fields!(dyn Player); unsafe_no_jsmanaged_fields!(WebRtcController); +unsafe_no_jsmanaged_fields!(dyn BackendMediaStream); unsafe_no_jsmanaged_fields!(Mutex); unsafe_no_jsmanaged_fields!(RenderApiSender); unsafe_no_jsmanaged_fields!(ResourceFetchTiming); diff --git a/components/script/dom/mediadevices.rs b/components/script/dom/mediadevices.rs index 5897ad576eb..e018087a86c 100644 --- a/components/script/dom/mediadevices.rs +++ b/components/script/dom/mediadevices.rs @@ -2,15 +2,18 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -use crate::dom::bindings::codegen::Bindings::MediaDevicesBinding; -use crate::dom::bindings::error::Fallible; +use crate::dom::bindings::codegen::Bindings::MediaDevicesBinding::MediaStreamConstraints; +use crate::dom::bindings::codegen::Bindings::MediaDevicesBinding::{self, MediaDevicesMethods}; use crate::dom::bindings::reflector::reflect_dom_object; use crate::dom::bindings::reflector::DomObject; use crate::dom::bindings::root::DomRoot; use crate::dom::eventtarget::EventTarget; use crate::dom::globalscope::GlobalScope; -use crate::dom::window::Window; +use crate::dom::mediastream::MediaStream; +use crate::dom::promise::Promise; use dom_struct::dom_struct; +use servo_media::ServoMedia; +use std::rc::Rc; #[dom_struct] pub struct MediaDevices { @@ -32,3 +35,25 @@ impl MediaDevices { ) } } + +impl MediaDevicesMethods for MediaDevices { + /// https://w3c.github.io/mediacapture-main/#dom-mediadevices-getusermedia + fn GetUserMedia(&self, constraints: &MediaStreamConstraints) -> Rc { + let p = Promise::new(&self.global()); + let media = ServoMedia::get().unwrap(); + let mut tracks = vec![]; + if constraints.audio { + if let Some(audio) = media.create_audioinput_stream() { + tracks.push(audio) + } + } + if constraints.video { + if let Some(video) = media.create_videoinput_stream() { + tracks.push(video) + } + } + let stream = MediaStream::new(&self.global(), tracks); + p.resolve_native(&stream); + p + } +} diff --git a/components/script/dom/mediastream.rs b/components/script/dom/mediastream.rs index 2641a9929bb..a5bfb0c183d 100644 --- a/components/script/dom/mediastream.rs +++ b/components/script/dom/mediastream.rs @@ -3,30 +3,31 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ use crate::dom::bindings::codegen::Bindings::MediaStreamBinding; -use crate::dom::bindings::error::Fallible; use crate::dom::bindings::reflector::reflect_dom_object; -use crate::dom::bindings::reflector::DomObject; use crate::dom::bindings::root::DomRoot; use crate::dom::eventtarget::EventTarget; use crate::dom::globalscope::GlobalScope; -use crate::dom::window::Window; use dom_struct::dom_struct; +use servo_media::webrtc::MediaStream as BackendMediaStream; #[dom_struct] pub struct MediaStream { eventtarget: EventTarget, + #[ignore_malloc_size_of = "defined in servo-media"] + tracks: Vec>, } impl MediaStream { - pub fn new_inherited() -> MediaStream { + pub fn new_inherited(tracks: Vec>) -> MediaStream { MediaStream { eventtarget: EventTarget::new_inherited(), + tracks, } } - pub fn new(global: &GlobalScope) -> DomRoot { + pub fn new(global: &GlobalScope, tracks: Vec>) -> DomRoot { reflect_dom_object( - Box::new(MediaStream::new_inherited()), + Box::new(MediaStream::new_inherited(tracks)), global, MediaStreamBinding::Wrap, ) diff --git a/components/script/dom/navigator.rs b/components/script/dom/navigator.rs index 49d7646b3c8..03899baf97e 100644 --- a/components/script/dom/navigator.rs +++ b/components/script/dom/navigator.rs @@ -167,6 +167,7 @@ impl NavigatorMethods for Navigator { /// https://w3c.github.io/mediacapture-main/#dom-navigator-mediadevices fn MediaDevices(&self) -> DomRoot { - self.mediadevices.or_init(|| MediaDevices::new(&self.global())) + self.mediadevices + .or_init(|| MediaDevices::new(&self.global())) } } diff --git a/components/script/dom/webidls/MediaDevices.webidl b/components/script/dom/webidls/MediaDevices.webidl index da877bde267..7fa30e0b916 100644 --- a/components/script/dom/webidls/MediaDevices.webidl +++ b/components/script/dom/webidls/MediaDevices.webidl @@ -18,7 +18,7 @@ partial interface Navigator { partial interface MediaDevices { // MediaTrackSupportedConstraints getSupportedConstraints(); - // Promise getUserMedia(optional MediaStreamConstraints constraints); + Promise getUserMedia(optional MediaStreamConstraints constraints); }; From 2d8ac7825c9d984f52db6dbc0632c3cee5ed33cd Mon Sep 17 00:00:00 2001 From: Manish Goregaokar Date: Mon, 28 Jan 2019 13:48:04 -0800 Subject: [PATCH 20/26] Add RTCPeerConnection::AddStream --- components/script/dom/mediastream.rs | 14 ++++++++++++-- components/script/dom/rtcpeerconnection.rs | 10 ++++++++++ .../script/dom/webidls/RTCPeerConnection.webidl | 3 +++ 3 files changed, 25 insertions(+), 2 deletions(-) diff --git a/components/script/dom/mediastream.rs b/components/script/dom/mediastream.rs index a5bfb0c183d..49550c97521 100644 --- a/components/script/dom/mediastream.rs +++ b/components/script/dom/mediastream.rs @@ -2,6 +2,7 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ +use crate::dom::bindings::cell::DomRefCell; use crate::dom::bindings::codegen::Bindings::MediaStreamBinding; use crate::dom::bindings::reflector::reflect_dom_object; use crate::dom::bindings::root::DomRoot; @@ -9,19 +10,20 @@ use crate::dom::eventtarget::EventTarget; use crate::dom::globalscope::GlobalScope; use dom_struct::dom_struct; use servo_media::webrtc::MediaStream as BackendMediaStream; +use std::mem; #[dom_struct] pub struct MediaStream { eventtarget: EventTarget, #[ignore_malloc_size_of = "defined in servo-media"] - tracks: Vec>, + tracks: DomRefCell>>, } impl MediaStream { pub fn new_inherited(tracks: Vec>) -> MediaStream { MediaStream { eventtarget: EventTarget::new_inherited(), - tracks, + tracks: DomRefCell::new(tracks), } } @@ -32,4 +34,12 @@ impl MediaStream { MediaStreamBinding::Wrap, ) } + + pub fn get_tracks(&self) -> Vec> { + // XXXManishearth we have hard ownership constraints here so we actually empty the vec, + // ideally we should only have a media stream id here, or servo-media hands + // out Arcs + let mut tracks = self.tracks.borrow_mut(); + mem::replace(&mut *tracks, vec![]) + } } diff --git a/components/script/dom/rtcpeerconnection.rs b/components/script/dom/rtcpeerconnection.rs index 6105bdd81eb..2ef603594a7 100644 --- a/components/script/dom/rtcpeerconnection.rs +++ b/components/script/dom/rtcpeerconnection.rs @@ -22,6 +22,7 @@ use crate::dom::bindings::root::{DomRoot, MutNullableDom}; use crate::dom::event::{Event, EventBubbles, EventCancelable}; use crate::dom::eventtarget::EventTarget; use crate::dom::globalscope::GlobalScope; +use crate::dom::mediastream::MediaStream; use crate::dom::promise::Promise; use crate::dom::rtcicecandidate::RTCIceCandidate; use crate::dom::rtcpeerconnectioniceevent::RTCPeerConnectionIceEvent; @@ -390,6 +391,15 @@ impl RTCPeerConnectionMethods for RTCPeerConnection { }).into()); p } + + // https://w3c.github.io/webrtc-pc/#legacy-interface-extensions + fn AddStream(&self, stream: &MediaStream) { + let mut tracks = stream.get_tracks(); + + for track in tracks.drain(..) { + self.controller.borrow().as_ref().unwrap().add_stream(track); + } + } } impl From for RTCSessionDescriptionInit { diff --git a/components/script/dom/webidls/RTCPeerConnection.webidl b/components/script/dom/webidls/RTCPeerConnection.webidl index c68efd7e2b0..c79dba097bf 100644 --- a/components/script/dom/webidls/RTCPeerConnection.webidl +++ b/components/script/dom/webidls/RTCPeerConnection.webidl @@ -34,6 +34,9 @@ interface RTCPeerConnection : EventTarget { // attribute EventHandler oniceconnectionstatechange; // attribute EventHandler onicegatheringstatechange; // attribute EventHandler onconnectionstatechange; + + // removed from spec, but still shipped by browsers + void addStream (MediaStream stream); }; dictionary RTCConfiguration { From 7761243100367e3d19891bb3ae04e9ad32e0006d Mon Sep 17 00:00:00 2001 From: Manish Goregaokar Date: Mon, 28 Jan 2019 19:35:50 -0800 Subject: [PATCH 21/26] Configure STUN servers --- components/script/dom/rtcpeerconnection.rs | 39 ++++++++++++++++------ 1 file changed, 28 insertions(+), 11 deletions(-) diff --git a/components/script/dom/rtcpeerconnection.rs b/components/script/dom/rtcpeerconnection.rs index 2ef603594a7..62bbe83c4ac 100644 --- a/components/script/dom/rtcpeerconnection.rs +++ b/components/script/dom/rtcpeerconnection.rs @@ -7,11 +7,12 @@ use crate::dom::bindings::codegen::Bindings::RTCIceCandidateBinding::RTCIceCandi use crate::dom::bindings::codegen::Bindings::RTCPeerConnectionBinding; use crate::dom::bindings::codegen::Bindings::RTCPeerConnectionBinding::RTCPeerConnectionMethods; use crate::dom::bindings::codegen::Bindings::RTCPeerConnectionBinding::{ - RTCAnswerOptions, RTCConfiguration, RTCOfferOptions, + RTCAnswerOptions, RTCBundlePolicy, RTCConfiguration, RTCOfferOptions, }; use crate::dom::bindings::codegen::Bindings::RTCSessionDescriptionBinding::{ RTCSdpType, RTCSessionDescriptionInit, }; +use crate::dom::bindings::codegen::UnionTypes::StringOrStringSequence; use crate::dom::bindings::error::Error; use crate::dom::bindings::error::Fallible; use crate::dom::bindings::inheritance::Castable; @@ -35,7 +36,7 @@ use dom_struct::dom_struct; use servo_media::webrtc::MediaStream as BackendMediaStream; use servo_media::webrtc::{ - IceCandidate, SdpType, SessionDescription, WebRtcController, WebRtcSignaller, + BundlePolicy, IceCandidate, SdpType, SessionDescription, WebRtcController, WebRtcSignaller, }; use servo_media::ServoMedia; @@ -109,7 +110,7 @@ impl RTCPeerConnection { } } - pub fn new(global: &GlobalScope) -> DomRoot { + pub fn new(global: &GlobalScope, config: &RTCConfiguration) -> DomRoot { let this = reflect_dom_object( Box::new(RTCPeerConnection::new_inherited()), global, @@ -117,14 +118,34 @@ impl RTCPeerConnection { ); let signaller = this.make_signaller(); *this.controller.borrow_mut() = Some(ServoMedia::get().unwrap().create_webrtc(signaller)); + if let Some(ref servers) = config.iceServers { + if let Some(ref server) = servers.get(0) { + let server = match server.urls { + StringOrStringSequence::String(ref s) => Some(s.clone()), + StringOrStringSequence::StringSequence(ref s) => s.get(0).cloned(), + }; + if let Some(server) = server { + let policy = match config.bundlePolicy { + RTCBundlePolicy::Balanced => BundlePolicy::Balanced, + RTCBundlePolicy::Max_compat => BundlePolicy::MaxCompat, + RTCBundlePolicy::Max_bundle => BundlePolicy::MaxBundle, + }; + this.controller + .borrow() + .as_ref() + .unwrap() + .configure(server.to_string(), policy); + } + } + } this } pub fn Constructor( window: &Window, - _config: &RTCConfiguration, + config: &RTCConfiguration, ) -> Fallible> { - Ok(RTCPeerConnection::new(&window.global())) + Ok(RTCPeerConnection::new(&window.global(), config)) } fn make_signaller(&self) -> Box { @@ -159,9 +180,7 @@ impl RTCPeerConnection { None, true, ); - event - .upcast::() - .fire(self.upcast()); + event.upcast::().fire(self.upcast()); } fn on_negotiation_needed(&self) { @@ -174,9 +193,7 @@ impl RTCPeerConnection { EventBubbles::DoesNotBubble, EventCancelable::NotCancelable, ); - event - .upcast::() - .fire(self.upcast()); + event.upcast::().fire(self.upcast()); } fn create_offer(&self) { From b7e2e79e53d329e5e38c3a7e1f245a1832a47b06 Mon Sep 17 00:00:00 2001 From: Manish Goregaokar Date: Mon, 28 Jan 2019 22:24:16 -0800 Subject: [PATCH 22/26] Use draft spec links --- components/script/dom/rtcicecandidate.rs | 8 ++++---- components/script/dom/rtcpeerconnection.rs | 20 +++++++++---------- .../script/dom/rtcpeerconnectioniceevent.rs | 4 ++-- .../script/dom/rtcsessiondescription.rs | 4 ++-- 4 files changed, 18 insertions(+), 18 deletions(-) diff --git a/components/script/dom/rtcicecandidate.rs b/components/script/dom/rtcicecandidate.rs index 7ced25fc29c..144ac9f7413 100644 --- a/components/script/dom/rtcicecandidate.rs +++ b/components/script/dom/rtcicecandidate.rs @@ -79,22 +79,22 @@ impl RTCIceCandidate { } impl RTCIceCandidateMethods for RTCIceCandidate { - /// https://www.w3.org/TR/webrtc/#dom-rtcicecandidate-candidate + /// https://w3c.github.io/webrtc-pc/#dom-rtcicecandidate-candidate fn Candidate(&self) -> DOMString { self.candidate.clone() } - /// https://www.w3.org/TR/webrtc/#dom-rtcicecandidate-sdpmid + /// https://w3c.github.io/webrtc-pc/#dom-rtcicecandidate-sdpmid fn GetSdpMid(&self) -> Option { self.sdp_m_id.clone() } - /// https://www.w3.org/TR/webrtc/#dom-rtcicecandidate-sdpmlineindex + /// https://w3c.github.io/webrtc-pc/#dom-rtcicecandidate-sdpmlineindex fn GetSdpMLineIndex(&self) -> Option { self.sdp_m_line_index.clone() } - /// https://www.w3.org/TR/webrtc/#dom-rtcicecandidate-usernamefragment + /// https://w3c.github.io/webrtc-pc/#dom-rtcicecandidate-usernamefragment fn GetUsernameFragment(&self) -> Option { self.username_fragment.clone() } diff --git a/components/script/dom/rtcpeerconnection.rs b/components/script/dom/rtcpeerconnection.rs index 62bbe83c4ac..619721ca307 100644 --- a/components/script/dom/rtcpeerconnection.rs +++ b/components/script/dom/rtcpeerconnection.rs @@ -264,17 +264,17 @@ impl RTCPeerConnection { } impl RTCPeerConnectionMethods for RTCPeerConnection { - /// https://www.w3.org/TR/webrtc/#dom-rtcpeerconnection-icecandidate + /// https://w3c.github.io/webrtc-pc/#dom-rtcpeerconnection-icecandidate event_handler!(icecandidate, GetOnicecandidate, SetOnicecandidate); - /// https://www.w3.org/TR/webrtc/#dom-rtcpeerconnection-onnegotiationneeded + /// https://w3c.github.io/webrtc-pc/#dom-rtcpeerconnection-onnegotiationneeded event_handler!( negotiationneeded, GetOnnegotiationneeded, SetOnnegotiationneeded ); - /// https://www.w3.org/TR/webrtc/#dom-rtcpeerconnection-addicecandidate + /// https://w3c.github.io/webrtc-pc/#dom-rtcpeerconnection-addicecandidate fn AddIceCandidate(&self, candidate: &RTCIceCandidateInit) -> Rc { let p = Promise::new(&self.global()); if candidate.sdpMid.is_none() && candidate.sdpMLineIndex.is_none() { @@ -293,7 +293,7 @@ impl RTCPeerConnectionMethods for RTCPeerConnection { } // XXXManishearth this should be enqueued - // https://www.w3.org/TR/webrtc/#enqueue-an-operation + // https://w3c.github.io/webrtc-pc/#enqueue-an-operation self.controller .borrow_mut() @@ -309,7 +309,7 @@ impl RTCPeerConnectionMethods for RTCPeerConnection { p } - /// https://www.w3.org/TR/webrtc/#dom-rtcpeerconnection-createoffer + /// https://w3c.github.io/webrtc-pc/#dom-rtcpeerconnection-createoffer fn CreateOffer(&self, _options: &RTCOfferOptions) -> Rc { let p = Promise::new(&self.global()); if self.closed.get() { @@ -321,7 +321,7 @@ impl RTCPeerConnectionMethods for RTCPeerConnection { p } - /// https://www.w3.org/TR/webrtc/#dom-rtcpeerconnection-createoffer + /// https://w3c.github.io/webrtc-pc/#dom-rtcpeerconnection-createoffer fn CreateAnswer(&self, _options: &RTCAnswerOptions) -> Rc { let p = Promise::new(&self.global()); if self.closed.get() { @@ -333,17 +333,17 @@ impl RTCPeerConnectionMethods for RTCPeerConnection { p } - /// https://www.w3.org/TR/webrtc/#dom-rtcpeerconnection-localdescription + /// https://w3c.github.io/webrtc-pc/#dom-rtcpeerconnection-localdescription fn GetLocalDescription(&self) -> Option> { self.local_description.get() } - /// https://www.w3.org/TR/webrtc/#dom-rtcpeerconnection-remotedescription + /// https://w3c.github.io/webrtc-pc/#dom-rtcpeerconnection-remotedescription fn GetRemoteDescription(&self) -> Option> { self.remote_description.get() } - /// https://www.w3.org/TR/webrtc/#dom-rtcpeerconnection-setlocaldescription + /// https://w3c.github.io/webrtc-pc/#dom-rtcpeerconnection-setlocaldescription fn SetLocalDescription(&self, desc: &RTCSessionDescriptionInit) -> Rc { // XXXManishearth validate the current state let p = Promise::new(&self.global()); @@ -376,7 +376,7 @@ impl RTCPeerConnectionMethods for RTCPeerConnection { p } - /// https://www.w3.org/TR/webrtc/#dom-rtcpeerconnection-setremotedescription + /// https://w3c.github.io/webrtc-pc/#dom-rtcpeerconnection-setremotedescription fn SetRemoteDescription(&self, desc: &RTCSessionDescriptionInit) -> Rc { // XXXManishearth validate the current state let p = Promise::new(&self.global()); diff --git a/components/script/dom/rtcpeerconnectioniceevent.rs b/components/script/dom/rtcpeerconnectioniceevent.rs index f77d0ec2ad9..8293ed48696 100644 --- a/components/script/dom/rtcpeerconnectioniceevent.rs +++ b/components/script/dom/rtcpeerconnectioniceevent.rs @@ -75,12 +75,12 @@ impl RTCPeerConnectionIceEvent { } impl RTCPeerConnectionIceEventMethods for RTCPeerConnectionIceEvent { - /// https://www.w3.org/TR/webrtc/#dom-rtcpeerconnectioniceevent-candidate + /// https://w3c.github.io/webrtc-pc/#dom-rtcpeerconnectioniceevent-candidate fn GetCandidate(&self) -> Option> { self.candidate.as_ref().map(|x| DomRoot::from_ref(&**x)) } - /// https://www.w3.org/TR/webrtc/#dom-rtcpeerconnectioniceevent-url + /// https://w3c.github.io/webrtc-pc/#dom-rtcpeerconnectioniceevent-url fn GetUrl(&self) -> Option { self.url.clone() } diff --git a/components/script/dom/rtcsessiondescription.rs b/components/script/dom/rtcsessiondescription.rs index 833074d3814..0ef79a321c6 100644 --- a/components/script/dom/rtcsessiondescription.rs +++ b/components/script/dom/rtcsessiondescription.rs @@ -57,12 +57,12 @@ impl RTCSessionDescription { } impl RTCSessionDescriptionMethods for RTCSessionDescription { - /// https://www.w3.org/TR/webrtc/#dom-rtcsessiondescription-type + /// https://w3c.github.io/webrtc-pc/#dom-rtcsessiondescription-type fn Type(&self) -> RTCSdpType { self.ty } - /// https://www.w3.org/TR/webrtc/#dom-rtcsessiondescription-sdp + /// https://w3c.github.io/webrtc-pc/#dom-rtcsessiondescription-sdp fn Sdp(&self) -> DOMString { self.sdp.clone() } From 0d9f5385610cb694f03a932f1a3152bfbdfd952b Mon Sep 17 00:00:00 2001 From: Manish Goregaokar Date: Tue, 29 Jan 2019 10:29:05 -0800 Subject: [PATCH 23/26] Add RTCIceCandidate::ToJSON --- components/script/dom/rtcicecandidate.rs | 10 ++++++++++ components/script/dom/webidls/RTCIceCandidate.webidl | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/components/script/dom/rtcicecandidate.rs b/components/script/dom/rtcicecandidate.rs index 144ac9f7413..9eefcd35134 100644 --- a/components/script/dom/rtcicecandidate.rs +++ b/components/script/dom/rtcicecandidate.rs @@ -98,4 +98,14 @@ impl RTCIceCandidateMethods for RTCIceCandidate { fn GetUsernameFragment(&self) -> Option { self.username_fragment.clone() } + + /// https://w3c.github.io/webrtc-pc/#dom-rtcicecandidate-tojson + fn ToJSON(&self) -> RTCIceCandidateInit { + RTCIceCandidateInit { + candidate: self.candidate.clone(), + sdpMid: self.sdp_m_id.clone(), + sdpMLineIndex: self.sdp_m_line_index.clone(), + usernameFragment: self.username_fragment.clone(), + } + } } diff --git a/components/script/dom/webidls/RTCIceCandidate.webidl b/components/script/dom/webidls/RTCIceCandidate.webidl index 3d0fdb006c7..538805c88db 100644 --- a/components/script/dom/webidls/RTCIceCandidate.webidl +++ b/components/script/dom/webidls/RTCIceCandidate.webidl @@ -22,7 +22,7 @@ interface RTCIceCandidate { // readonly attribute DOMString? relatedAddress; // readonly attribute unsigned short? relatedPort; readonly attribute DOMString? usernameFragment; - // RTCIceCandidateInit toJSON(); + RTCIceCandidateInit toJSON(); }; dictionary RTCIceCandidateInit { From ab04f0429bef3c2613c6a249d5a04a8cc9ca64de Mon Sep 17 00:00:00 2001 From: Manish Goregaokar Date: Tue, 29 Jan 2019 11:07:51 -0800 Subject: [PATCH 24/26] Add RTCSessionDescription::ToJSON --- components/script/dom/rtcsessiondescription.rs | 16 ++++++++++++++++ .../dom/webidls/RTCSessionDescription.webidl | 2 +- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/components/script/dom/rtcsessiondescription.rs b/components/script/dom/rtcsessiondescription.rs index 0ef79a321c6..27ab4ca3b41 100644 --- a/components/script/dom/rtcsessiondescription.rs +++ b/components/script/dom/rtcsessiondescription.rs @@ -15,6 +15,10 @@ use crate::dom::bindings::str::DOMString; use crate::dom::globalscope::GlobalScope; use crate::dom::window::Window; use dom_struct::dom_struct; +use js::conversions::ToJSValConvertible; +use js::jsapi::{JSContext, JSObject}; +use js::jsval::UndefinedValue; +use std::ptr::NonNull; #[dom_struct] pub struct RTCSessionDescription { @@ -66,4 +70,16 @@ impl RTCSessionDescriptionMethods for RTCSessionDescription { fn Sdp(&self) -> DOMString { self.sdp.clone() } + + #[allow(unsafe_code)] + /// https://w3c.github.io/webrtc-pc/#dom-rtcsessiondescription-tojson + unsafe fn ToJSON(&self, cx: *mut JSContext) -> NonNull { + let init = RTCSessionDescriptionInit { + type_: self.ty, + sdp: self.sdp.clone(), + }; + rooted!(in(cx) let mut jsval = UndefinedValue()); + init.to_jsval(cx, jsval.handle_mut()); + NonNull::new(jsval.to_object()).unwrap() + } } diff --git a/components/script/dom/webidls/RTCSessionDescription.webidl b/components/script/dom/webidls/RTCSessionDescription.webidl index 1cc271b16db..90ba45f1c44 100644 --- a/components/script/dom/webidls/RTCSessionDescription.webidl +++ b/components/script/dom/webidls/RTCSessionDescription.webidl @@ -9,7 +9,7 @@ interface RTCSessionDescription { readonly attribute RTCSdpType type; readonly attribute DOMString sdp; - // [Default] object toJSON(); + [Default] object toJSON(); }; dictionary RTCSessionDescriptionInit { From 028082929b8c0943645da5b7cdb65100df287295 Mon Sep 17 00:00:00 2001 From: Manish Goregaokar Date: Wed, 30 Jan 2019 10:41:42 -0800 Subject: [PATCH 25/26] Update servo-media --- Cargo.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 2fdb66eb017..a31bfeeeea2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3656,7 +3656,7 @@ dependencies = [ [[package]] name = "servo-media" version = "0.1.0" -source = "git+https://github.com/servo/media#1e6618da825500049a73e5a586e41428f317e724" +source = "git+https://github.com/servo/media#593fcabd749e693de51d609688d29497c668c667" dependencies = [ "servo-media-audio 0.1.0 (git+https://github.com/servo/media)", "servo-media-gstreamer 0.1.0 (git+https://github.com/servo/media)", @@ -3667,7 +3667,7 @@ dependencies = [ [[package]] name = "servo-media-audio" version = "0.1.0" -source = "git+https://github.com/servo/media#1e6618da825500049a73e5a586e41428f317e724" +source = "git+https://github.com/servo/media#593fcabd749e693de51d609688d29497c668c667" dependencies = [ "boxfnonce 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "byte-slice-cast 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -3684,7 +3684,7 @@ dependencies = [ [[package]] name = "servo-media-gstreamer" version = "0.1.0" -source = "git+https://github.com/servo/media#1e6618da825500049a73e5a586e41428f317e724" +source = "git+https://github.com/servo/media#593fcabd749e693de51d609688d29497c668c667" dependencies = [ "boxfnonce 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "byte-slice-cast 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -3714,7 +3714,7 @@ dependencies = [ [[package]] name = "servo-media-player" version = "0.1.0" -source = "git+https://github.com/servo/media#1e6618da825500049a73e5a586e41428f317e724" +source = "git+https://github.com/servo/media#593fcabd749e693de51d609688d29497c668c667" dependencies = [ "ipc-channel 0.11.2 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)", @@ -3724,7 +3724,7 @@ dependencies = [ [[package]] name = "servo-media-webrtc" version = "0.1.0" -source = "git+https://github.com/servo/media#1e6618da825500049a73e5a586e41428f317e724" +source = "git+https://github.com/servo/media#593fcabd749e693de51d609688d29497c668c667" dependencies = [ "boxfnonce 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -3809,7 +3809,7 @@ dependencies = [ [[package]] name = "servo_media_derive" version = "0.1.0" -source = "git+https://github.com/servo/media#1e6618da825500049a73e5a586e41428f317e724" +source = "git+https://github.com/servo/media#593fcabd749e693de51d609688d29497c668c667" dependencies = [ "proc-macro2 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)", From 351723e6dab1d12eaaa2c7174e727b79795b2b46 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fernando=20Jim=C3=A9nez=20Moreno?= Date: Thu, 31 Jan 2019 18:01:03 +0100 Subject: [PATCH 26/26] Update gstreamer binaries for Android with webrtc related plugins --- python/servo/build_commands.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/servo/build_commands.py b/python/servo/build_commands.py index 2e6979d0fca..d8324f22cb8 100644 --- a/python/servo/build_commands.py +++ b/python/servo/build_commands.py @@ -441,7 +441,7 @@ class MachCommands(CommandBase): # Build the name of the package containing all GStreamer dependencies # according to the build target. gst_lib = "gst-build-{}".format(self.config["android"]["lib"]) - gst_lib_zip = "gstreamer-{}-1.14.3-20181105-103937.zip".format(self.config["android"]["lib"]) + gst_lib_zip = "gstreamer-{}-1.14.3-20190131-153818.zip".format(self.config["android"]["lib"]) gst_dir = os.path.join(target_path, "gstreamer") gst_lib_path = os.path.join(gst_dir, gst_lib) pkg_config_path = os.path.join(gst_lib_path, "pkgconfig")