Skip to content

Commit

Permalink
Auto merge of #21158 - ferjm:webaudio, r=manishearth,nox,ferjm
Browse files Browse the repository at this point in the history
WebAudio API

- [X] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] These changes fix #6710
- [X] There are tests for these changes

This PR adds basic support for the WebAudio API using [servo-media](https://github.com/servo/media) with GStreamer as the audio backend.

There are still some major stuff to fix like:

- [x] Detach ArrayBuffer during the [AudioBuffer "acquire the content" operation](https://webaudio.github.io/web-audio-api/#acquire-the-content). I am naively using `JS_StealArrayBufferContents()` directly, because it is what Gecko uses, but this should probably be part of the [rust-mozjs](https://github.com/servo/rust-mozjs) [TypedArray](https://github.com/servo/rust-mozjs/blob/master/src/typedarray.rs) API. And, in any case, I am not even sure if that's the proper way to do it. According to the results of the WPTs it may not even be right since [this assertion](https://github.com/servo/rust-mozjs/blob/master/src/typedarray.rs#L285) is failing in some cases. I need to dig more about this.
- [x] Disable the GStreamer dependency on Android. Unfortunately gstreamer-rs requires an NDK version upgrade, so we need to disable this for Android until then. I tried adding [different features to servo-media](servo/media#79), but I am currently hitting [this issue](rust-lang/cargo#1197)

I still need to run servo-tidy, change the servo-media dependency to use the git repo and add/fix some comments and TODOs.

The remaining feature work should be done in future PRs.

Note that most of the failing WPTs are failing because we don't implement the tested features yet (we only implement a few AudioNodes) and we have no OfflineAudioContext support, which most WPTs rely on.

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/21158)
<!-- Reviewable:end -->
  • Loading branch information
bors-servo committed Jul 31, 2018
2 parents 6e7f7fc + 2daf9ff commit 0051597
Show file tree
Hide file tree
Showing 199 changed files with 5,178 additions and 25 deletions.
8 changes: 8 additions & 0 deletions .travis.yml
Expand Up @@ -17,6 +17,13 @@ matrix:
- sudo add-apt-repository 'deb http://apt.llvm.org/precise/ llvm-toolchain-precise-3.9 main' -y
- sudo apt-get update -q
- sudo apt-get install clang-3.9 llvm-3.9 llvm-3.9-runtime -y
- curl -L https://github.com/ferjm/gstreamer-1.14.1-ubuntu-trusty/raw/master/gstreamer.tar.gz | tar xz
- sed -i "s;prefix=/root/gstreamer;prefix=$PWD/gstreamer;g" $PWD/gstreamer/lib/x86_64-linux-gnu/pkgconfig/*.pc
- export PKG_CONFIG_PATH=$PWD/gstreamer/lib/x86_64-linux-gnu/pkgconfig
- export GST_PLUGIN_SYSTEM_PATH=$PWD/gstreamer/lib/x86_64-linux-gnu/gstreamer-1.0
- export GST_PLUGIN_SCANNER=$PWD/gstreamer/libexec/gstreamer-1.0/gst-plugin-scanner
- export PATH=$PATH:$PWD/gstreamer/bin
- export LD_LIBRARY_PATH=$PWD/gstreamer/lib/x86_64-linux-gnu:$LD_LIBRARY_PATH
- export LLVM_CONFIG=/usr/lib/llvm-3.9/bin/llvm-config
- curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain none -y
- source ~/.profile
Expand Down Expand Up @@ -52,6 +59,7 @@ matrix:
- ccache
- libdbus-glib-1-dev
- libedit-dev
- libglib2.0-dev

branches:
only:
Expand Down
446 changes: 429 additions & 17 deletions Cargo.lock

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion README.md
Expand Up @@ -83,7 +83,8 @@ sudo apt install git curl autoconf libx11-dev \
gperf g++ build-essential cmake virtualenv python-pip \
libssl1.0-dev libbz2-dev libosmesa6-dev libxmu6 libxmu-dev \
libglu1-mesa-dev libgles2-mesa-dev libegl1-mesa-dev libdbus-1-dev \
libharfbuzz-dev ccache clang
libharfbuzz-dev ccache clang \
libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev
```

If you using a version prior to **Ubuntu 17.04** or **Debian Sid**, replace `libssl1.0-dev` with `libssl-dev`.
Expand Down
8 changes: 8 additions & 0 deletions appveyor.yml
Expand Up @@ -43,9 +43,17 @@ cache:
- .ccache

install:
- choco install pkgconfiglite
- appveyor-retry appveyor DownloadFile https://gstreamer.freedesktop.org/data/pkg/windows/1.14.1/gstreamer-1.0-devel-x86_64-1.14.1.msi
- appveyor-retry appveyor DownloadFile https://gstreamer.freedesktop.org/data/pkg/windows/1.14.1/gstreamer-1.0-x86_64-1.14.1.msi
- msiexec /i gstreamer-1.0-devel-x86_64-1.14.1.msi /quiet /qn /norestart /log install-devel.log
- msiexec /i gstreamer-1.0-x86_64-1.14.1.msi /quiet /qn /norestart /log install.log
- appveyor-retry appveyor DownloadFile https://win.rustup.rs/ -FileName rustup-init.exe
- rustup-init.exe -y --default-host x86_64-pc-windows-msvc --default-toolchain none
- set PATH=%PATH%;C:\Users\appveyor\.cargo\bin
- set PKG_CONFIG_PATH=%PKG_CONFIG_PATH%;C:\gstreamer\1.0\x86_64\lib\pkgconfig
- set LIB=C:\gstreamer\1.0\x86_64\lib
- set LIBPATH=C:\gstreamer\1.0\x86_64\lib
- rustup -V
- mach rustc --version
- mach cargo --version
Expand Down
2 changes: 2 additions & 0 deletions components/atoms/static_atoms.txt
Expand Up @@ -12,13 +12,15 @@ checkbox
click
close
color
complete
controllerchange
cursive
date
datetime-local
dir
email
emptied
ended
error
fantasy
fetch
Expand Down
2 changes: 1 addition & 1 deletion components/fallible/Cargo.toml
Expand Up @@ -10,7 +10,7 @@ name = "fallible"
path = "lib.rs"

[dependencies]
smallvec = "0.6"
smallvec = "0.6.2"
hashglobe = { path = "../hashglobe" }

# This crate effectively does nothing except if the `known_system_malloc`
Expand Down
2 changes: 1 addition & 1 deletion components/gfx/Cargo.toml
Expand Up @@ -36,7 +36,7 @@ serde = "1.0"
servo_arc = {path = "../servo_arc"}
servo_atoms = {path = "../atoms"}
servo_url = {path = "../url"}
smallvec = "0.6"
smallvec = "0.6.2"
style = {path = "../style"}
time = "0.1.12"
unicode-bidi = {version = "0.3", features = ["with_serde"]}
Expand Down
2 changes: 1 addition & 1 deletion components/layout/Cargo.toml
Expand Up @@ -42,7 +42,7 @@ servo_geometry = {path = "../geometry"}
serde_json = "1.0"
servo_config = {path = "../config"}
servo_url = {path = "../url"}
smallvec = "0.6"
smallvec = "0.6.2"
style = {path = "../style", features = ["servo"]}
style_traits = {path = "../style_traits"}
unicode-bidi = {version = "0.3", features = ["with_serde"]}
Expand Down
3 changes: 2 additions & 1 deletion components/script/Cargo.toml
Expand Up @@ -87,9 +87,10 @@ servo_arc = {path = "../servo_arc"}
servo_atoms = {path = "../atoms"}
servo_config = {path = "../config"}
servo_geometry = {path = "../geometry" }
servo-media = {git = "https://github.com/servo/media"}
servo_rand = {path = "../rand"}
servo_url = {path = "../url"}
smallvec = "0.6"
smallvec = "0.6.2"
style = {path = "../style", features = ["servo"]}
style_traits = {path = "../style_traits"}
swapper = "0.1"
Expand Down

0 comments on commit 0051597

Please sign in to comment.