diff --git a/Cargo.lock b/Cargo.lock index 75466042275..d5c41b0d23f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -60,7 +60,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)", ] @@ -152,7 +152,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)", @@ -224,7 +224,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.26 (registry+https://github.com/rust-lang/crates.io-index)", @@ -435,7 +435,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)", @@ -756,7 +756,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)", @@ -770,7 +770,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)", ] @@ -783,7 +783,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)", ] @@ -1033,7 +1033,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)", @@ -1052,7 +1052,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)", @@ -1336,7 +1336,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", @@ -1407,7 +1407,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)", ] @@ -1436,7 +1436,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)", @@ -1491,7 +1491,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)", ] @@ -1506,7 +1506,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)", @@ -1624,6 +1624,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" @@ -1665,6 +1692,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" @@ -1854,7 +1909,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)", @@ -1975,7 +2030,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)", @@ -2132,7 +2187,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", @@ -2178,7 +2233,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]] @@ -2592,7 +2647,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]] @@ -2601,7 +2656,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)", @@ -2665,7 +2720,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", @@ -2719,7 +2774,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)", @@ -2857,7 +2912,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)", @@ -2880,7 +2935,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)", ] @@ -3189,7 +3244,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)", ] @@ -3363,7 +3418,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", @@ -3584,7 +3639,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)", @@ -3636,17 +3691,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#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)", "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#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)", @@ -3663,8 +3719,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#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)", "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)", @@ -3675,12 +3732,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)", ] @@ -3688,13 +3749,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#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)", "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#593fcabd749e693de51d609688d29497c668c667" +dependencies = [ + "boxfnonce 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "servo-skia" version = "0.30000020.1" @@ -3749,7 +3818,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)", @@ -3775,7 +3844,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#593fcabd749e693de51d609688d29497c668c667" dependencies = [ "proc-macro2 0.4.26 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)", @@ -3786,7 +3855,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)", @@ -3796,7 +3865,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)", ] @@ -3845,7 +3914,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)", ] @@ -3927,7 +3996,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)", @@ -3966,7 +4035,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)", @@ -4019,7 +4088,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)", @@ -4200,7 +4269,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]] @@ -4634,7 +4703,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]] @@ -4704,7 +4773,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)", @@ -4841,7 +4910,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)", @@ -4910,7 +4979,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)", ] @@ -5110,9 +5179,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" @@ -5151,7 +5224,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" @@ -5269,6 +5342,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" 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/bindings/trace.rs b/components/script/dom/bindings/trace.rs index e92d1d5c452..3e20fab1dcf 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::{MediaStream as BackendMediaStream, WebRtcController}; use servo_media::Backend; use servo_url::{ImmutableOrigin, MutableOrigin, ServoUrl}; use smallvec::SmallVec; @@ -483,6 +484,8 @@ 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!(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 new file mode 100644 index 00000000000..e018087a86c --- /dev/null +++ b/components/script/dom/mediadevices.rs @@ -0,0 +1,59 @@ +/* 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::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::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 { + 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, + ) + } +} + +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 new file mode 100644 index 00000000000..49550c97521 --- /dev/null +++ b/components/script/dom/mediastream.rs @@ -0,0 +1,45 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at 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; +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: DomRefCell>>, +} + +impl MediaStream { + pub fn new_inherited(tracks: Vec>) -> MediaStream { + MediaStream { + eventtarget: EventTarget::new_inherited(), + tracks: DomRefCell::new(tracks), + } + } + + pub fn new(global: &GlobalScope, tracks: Vec>) -> DomRoot { + reflect_dom_object( + Box::new(MediaStream::new_inherited(tracks)), + global, + 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/mod.rs b/components/script/dom/mod.rs index 4d8e89d274f..a965b6893bc 100644 --- a/components/script/dom/mod.rs +++ b/components/script/dom/mod.rs @@ -389,10 +389,12 @@ pub mod imagedata; pub mod inputevent; pub mod keyboardevent; pub mod location; +pub mod mediadevices; pub mod mediaerror; pub mod medialist; pub mod mediaquerylist; pub mod mediaquerylistevent; +pub mod mediastream; pub mod messageevent; pub mod mimetype; pub mod mimetypearray; @@ -439,6 +441,10 @@ pub mod radionodelist; pub mod range; pub mod request; pub mod response; +pub mod rtcicecandidate; +pub mod rtcpeerconnection; +pub mod rtcpeerconnectioniceevent; +pub mod rtcsessiondescription; pub mod screen; pub mod serviceworker; pub mod serviceworkercontainer; diff --git a/components/script/dom/navigator.rs b/components/script/dom/navigator.rs index 1d60759f1d7..03899baf97e 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,10 @@ 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/rtcicecandidate.rs b/components/script/dom/rtcicecandidate.rs new file mode 100644 index 00000000000..9eefcd35134 --- /dev/null +++ b/components/script/dom/rtcicecandidate.rs @@ -0,0 +1,111 @@ +/* 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::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}; +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; + +#[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( + 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, + 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, + )), + global, + RTCIceCandidateBinding::Wrap, + ) + } + + pub fn Constructor( + window: &Window, + 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" + ))); + } + Ok(RTCIceCandidate::new( + &window.global(), + config.candidate.clone(), + config.sdpMid.clone(), + config.sdpMLineIndex, + config.usernameFragment.clone(), + )) + } +} + +impl RTCIceCandidateMethods for RTCIceCandidate { + /// https://w3c.github.io/webrtc-pc/#dom-rtcicecandidate-candidate + fn Candidate(&self) -> DOMString { + self.candidate.clone() + } + + /// https://w3c.github.io/webrtc-pc/#dom-rtcicecandidate-sdpmid + fn GetSdpMid(&self) -> Option { + self.sdp_m_id.clone() + } + + /// https://w3c.github.io/webrtc-pc/#dom-rtcicecandidate-sdpmlineindex + fn GetSdpMLineIndex(&self) -> Option { + self.sdp_m_line_index.clone() + } + + /// https://w3c.github.io/webrtc-pc/#dom-rtcicecandidate-usernamefragment + 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/rtcpeerconnection.rs b/components/script/dom/rtcpeerconnection.rs new file mode 100644 index 00000000000..619721ca307 --- /dev/null +++ b/components/script/dom/rtcpeerconnection.rs @@ -0,0 +1,450 @@ +/* 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::cell::DomRefCell; +use crate::dom::bindings::codegen::Bindings::RTCIceCandidateBinding::RTCIceCandidateInit; +use crate::dom::bindings::codegen::Bindings::RTCPeerConnectionBinding; +use crate::dom::bindings::codegen::Bindings::RTCPeerConnectionBinding::RTCPeerConnectionMethods; +use crate::dom::bindings::codegen::Bindings::RTCPeerConnectionBinding::{ + 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; +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, 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; +use crate::dom::rtcsessiondescription::RTCSessionDescription; +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::{ + BundlePolicy, IceCandidate, SdpType, SessionDescription, WebRtcController, WebRtcSignaller, +}; +use servo_media::ServoMedia; + +use std::cell::Cell; +use std::rc::Rc; + +#[dom_struct] +pub struct RTCPeerConnection { + eventtarget: EventTarget, + #[ignore_malloc_size_of = "defined in servo-media"] + controller: DomRefCell>, + closed: Cell, + /// Helps track state changes between the time createOffer/createAnswer + /// is called and resolved + offer_answer_generation: Cell, + #[ignore_malloc_size_of = "promises are hard"] + offer_promises: DomRefCell>>, + #[ignore_malloc_size_of = "promises are hard"] + answer_promises: DomRefCell>>, + local_description: MutNullableDom, + remote_description: MutNullableDom, +} + +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), + closed: Cell::new(false), + offer_answer_generation: Cell::new(0), + offer_promises: DomRefCell::new(vec![]), + answer_promises: DomRefCell::new(vec![]), + local_description: Default::default(), + remote_description: Default::default(), + } + } + + pub fn new(global: &GlobalScope, config: &RTCConfiguration) -> DomRoot { + 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)); + 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, + ) -> Fallible> { + Ok(RTCPeerConnection::new(&window.global(), config)) + } + + 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) { + 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) { + if self.closed.get() { + return; + } + let event = Event::new( + &self.global(), + atom!("negotiationneeded"), + EventBubbles::DoesNotBubble, + EventCancelable::NotCancelable, + ); + event.upcast::().fire(self.upcast()); + } + + fn create_offer(&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_offer( + (move |desc: SessionDescription| { + let _ = task_source.queue_with_canceller( + task!(offer_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_offer(); + } else { + let init: RTCSessionDescriptionInit = desc.into(); + for promise in this.offer_promises.borrow_mut().drain(..) { + promise.resolve_native(&init); + } + } + }), + &canceller, + ); + }) + .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 { + /// https://w3c.github.io/webrtc-pc/#dom-rtcpeerconnection-icecandidate + event_handler!(icecandidate, GetOnicecandidate, SetOnicecandidate); + + /// https://w3c.github.io/webrtc-pc/#dom-rtcpeerconnection-onnegotiationneeded + event_handler!( + negotiationneeded, + GetOnnegotiationneeded, + SetOnnegotiationneeded + ); + + /// 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() { + 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://w3c.github.io/webrtc-pc/#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 + } + + /// 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() { + p.reject_error(Error::InvalidState); + return p; + } + self.offer_promises.borrow_mut().push(p.clone()); + self.create_offer(); + p + } + + /// 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() { + p.reject_error(Error::InvalidState); + return p; + } + self.answer_promises.borrow_mut().push(p.clone()); + self.create_answer(); + p + } + + /// https://w3c.github.io/webrtc-pc/#dom-rtcpeerconnection-localdescription + fn GetLocalDescription(&self) -> Option> { + self.local_description.get() + } + + /// https://w3c.github.io/webrtc-pc/#dom-rtcpeerconnection-remotedescription + fn GetRemoteDescription(&self) -> Option> { + self.remote_description.get() + } + + /// 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()); + 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 + } + + /// 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()); + 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 + } + + // 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 { + 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(), + } + } +} + +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/rtcpeerconnectioniceevent.rs b/components/script/dom/rtcpeerconnectioniceevent.rs new file mode 100644 index 00000000000..8293ed48696 --- /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://w3c.github.io/webrtc-pc/#dom-rtcpeerconnectioniceevent-candidate + fn GetCandidate(&self) -> Option> { + self.candidate.as_ref().map(|x| DomRoot::from_ref(&**x)) + } + + /// https://w3c.github.io/webrtc-pc/#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/rtcsessiondescription.rs b/components/script/dom/rtcsessiondescription.rs new file mode 100644 index 00000000000..27ab4ca3b41 --- /dev/null +++ b/components/script/dom/rtcsessiondescription.rs @@ -0,0 +1,85 @@ +/* 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::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; +use js::conversions::ToJSValConvertible; +use js::jsapi::{JSContext, JSObject}; +use js::jsval::UndefinedValue; +use std::ptr::NonNull; + +#[dom_struct] +pub struct RTCSessionDescription { + reflector: Reflector, + ty: RTCSdpType, + sdp: DOMString, +} + +impl RTCSessionDescription { + pub fn new_inherited(ty: RTCSdpType, sdp: DOMString) -> RTCSessionDescription { + RTCSessionDescription { + reflector: Reflector::new(), + ty, + sdp, + } + } + + pub fn new( + global: &GlobalScope, + ty: RTCSdpType, + sdp: DOMString, + ) -> DomRoot { + reflect_dom_object( + Box::new(RTCSessionDescription::new_inherited(ty, sdp)), + global, + RTCSessionDescriptionBinding::Wrap, + ) + } + + pub fn Constructor( + window: &Window, + config: &RTCSessionDescriptionInit, + ) -> Fallible> { + Ok(RTCSessionDescription::new( + &window.global(), + config.type_, + config.sdp.clone(), + )) + } +} + +impl RTCSessionDescriptionMethods for RTCSessionDescription { + /// https://w3c.github.io/webrtc-pc/#dom-rtcsessiondescription-type + fn Type(&self) -> RTCSdpType { + self.ty + } + + /// https://w3c.github.io/webrtc-pc/#dom-rtcsessiondescription-sdp + 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/MediaDevices.webidl b/components/script/dom/webidls/MediaDevices.webidl new file mode 100644 index 00000000000..7fa30e0b916 --- /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] + [Pref="dom.webrtc.enabled"] 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; +// }; 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; +}; diff --git a/components/script/dom/webidls/RTCIceCandidate.webidl b/components/script/dom/webidls/RTCIceCandidate.webidl new file mode 100644 index 00000000000..538805c88db --- /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; +}; diff --git a/components/script/dom/webidls/RTCPeerConnection.webidl b/components/script/dom/webidls/RTCPeerConnection.webidl new file mode 100644 index 00000000000..c79dba097bf --- /dev/null +++ b/components/script/dom/webidls/RTCPeerConnection.webidl @@ -0,0 +1,91 @@ +/* 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(optional 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; + + // removed from spec, but still shipped by browsers + void addStream (MediaStream stream); +}; + +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" +}; + +dictionary RTCOfferAnswerOptions { + boolean voiceActivityDetection = true; +}; + +dictionary RTCOfferOptions : RTCOfferAnswerOptions { + boolean iceRestart = false; +}; + +dictionary RTCAnswerOptions : RTCOfferAnswerOptions { +}; 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; +}; diff --git a/components/script/dom/webidls/RTCSessionDescription.webidl b/components/script/dom/webidls/RTCSessionDescription.webidl new file mode 100644 index 00000000000..90ba45f1c44 --- /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" +}; diff --git a/python/servo/build_commands.py b/python/servo/build_commands.py index a3a463d5931..0fea67f9a70 100644 --- a/python/servo/build_commands.py +++ b/python/servo/build_commands.py @@ -446,7 +446,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") 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,