Auto merge of #23712 - servo:gstreamer-windows, r=ferjm

Support WebAudio on Windows

These changes improve the GStreamer experience on Windows in several ways:
* we package the set of plugins and their dependencies that Servo requires for media support
* we explicitly load those plugins when starting the media engine rather than relying on an existing gstreamer installation

These changes do not affect the experience on non-Windows platforms, but the path is clear to do so in order to fix problems like #23519. With these changes I can successfully hear a tone when loading https://joshmatthews.net/osc.html in both a desktop build and a UWP build.

---
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] These changes fix #23631 and fix #23698
- [x] These changes do not require tests because no tests on windows ;_;

<!-- 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/23712)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2019-07-08 12:40:05 -04:00 committed by GitHub
commit 988e38fe0a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 1178 additions and 185 deletions

View file

@ -127,8 +127,54 @@ pub use servo_url as url;
target_arch = "x86_64"
))]
mod media_platform {
pub use self::servo_media_gstreamer::GStreamerBackend as MediaBackend;
use servo_media_gstreamer;
use super::ServoMedia;
use servo_media_gstreamer::GStreamerBackend;
#[cfg(windows)]
pub fn init() {
let mut plugin_dir = std::env::current_exe().unwrap();
plugin_dir.pop();
let plugins = &[
"gstapp.dll",
"gstaudioconvert.dll",
"gstaudiofx.dll",
"gstaudioparsers.dll",
"gstaudioresample.dll",
"gstautodetect.dll",
"gstcoreelements.dll",
"gstdeinterlace.dll",
"gstplayback.dll",
"gstinterleave.dll",
"gstisomp4.dll",
"gstlibav.dll",
"gstnice.dll",
"gstogg.dll",
"gstopengl.dll",
"gstopus.dll",
"gstproxy.dll",
"gstrtp.dll",
"gsttheora.dll",
"gsttypefindfunctions.dll",
"gstvideoconvert.dll",
"gstvideoparsersbad.dll",
"gstvideoscale.dll",
"gstvolume.dll",
"gstvorbis.dll",
"gstvpx.dll",
"gstwasapi.dll",
"gstwebrtc.dll",
];
let backend = GStreamerBackend::init_with_plugins(plugin_dir, plugins)
.expect("Error initializing GStreamer");
ServoMedia::init_with_backend(backend);
}
#[cfg(not(windows))]
pub fn init() {
ServoMedia::init::<GStreamerBackend>();
}
}
#[cfg(not(any(
@ -136,12 +182,12 @@ mod media_platform {
target_arch = "x86_64"
)))]
mod media_platform {
pub use self::servo_media_dummy::DummyBackend as MediaBackend;
use servo_media_dummy;
use super::ServoMedia;
pub fn init() {
ServoMedia::init::<servo_media_dummy::DummyBackend>();
}
}
type MediaBackend = media_platform::MediaBackend;
/// The in-process interface to Servo.
///
/// It does everything necessary to render the web, primarily
@ -209,7 +255,7 @@ where
let opts = opts::get();
if !opts.multiprocess {
ServoMedia::init::<MediaBackend>();
media_platform::init();
}
// Make sure the gl context is made current.
@ -847,7 +893,7 @@ pub fn run_content_process(token: String) {
script::init();
script::init_service_workers(sw_senders);
ServoMedia::init::<MediaBackend>();
media_platform::init();
unprivileged_content.start_all::<script_layout_interface::message::Msg,
layout_thread::LayoutThread,