Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support WebAudio on Windows #23712

Merged
merged 2 commits into from Jul 8, 2019
Merged
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

@@ -122,21 +122,67 @@ 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(
all(target_os = "android", target_arch = "arm"),
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
@@ -204,7 +250,7 @@ where
let opts = opts::get();

if !opts.multiprocess {
ServoMedia::init::<MediaBackend>();
media_platform::init();
}

// Make sure the gl context is made current.
@@ -810,7 +856,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,
@@ -28,7 +28,6 @@ def main(task_for):
all_tests = [
linux_tidy_unit_docs,
windows_unit,
windows_x86,
windows_arm64,
macos_unit,
magicleap_dev,
@@ -55,7 +54,7 @@ def main(task_for):

"try-mac": [macos_unit],
"try-linux": [linux_tidy_unit_docs, linux_release],
"try-windows": [windows_unit, windows_x86, windows_arm64],
"try-windows": [windows_unit, windows_arm64],
"try-magicleap": [magicleap_dev],
"try-arm": [windows_arm64],
"try-wpt": [linux_wpt],
@@ -125,10 +124,6 @@ def mocked_only():
}
macos_build_env = {}
windows_build_env = {
"x86": {
"LIB": "%HOMEDRIVE%%HOMEPATH%\\gst\\gstreamer\\1.0\\x86\\lib;%LIB%",
"GSTREAMER_1_0_ROOT_X86": "%HOMEDRIVE%%HOMEPATH%\\gst\\gstreamer\\1.0\\x86\\",
},
"x86_64": {
"LIB": "%HOMEDRIVE%%HOMEPATH%\\gst\\gstreamer\\1.0\\x86_64\\lib;%LIB%",
"GSTREAMER_1_0_ROOT_X86_64": "%HOMEDRIVE%%HOMEPATH%\\gst\\gstreamer\\1.0\\x86_64\\",
@@ -379,20 +374,6 @@ def android_x86_wpt():
)


def windows_x86():
return (
windows_cross_build_task("Dev build", arch="x86", package=True)
.with_treeherder("Windows x86")
.with_script(
"python mach build --dev --target i686-pc-windows-msvc",
"python mach package --dev --target i686-pc-windows-msvc",
)
.with_artifacts("repo/target/i686-pc-windows-msvc/debug/msi/Servo.exe",
"repo/target/i686-pc-windows-msvc/debug/msi/Servo.zip")
.find_or_create("build.windows_x86_dev." + CONFIG.task_id())
)


def windows_arm64():
return (
windows_cross_build_task("Dev build", arch="arm64", package=False)
@@ -774,16 +755,13 @@ def windows_build_task(name, package=True, arch="x86_64"):
hashes = {
"devel": {
"x86_64": "c136cbfb0330041d52fe6ec4e3e468563176333c857f6ed71191ebc37fc9d605",
"x86": "fed862659360b4fbc77920bdc28f1a7da56bb953b88044834db5161c0ee05eb3",
},
"non-devel": {
"x86_64": "0744a8ef2a4ba393dacb7927d741df871400a85bab5aecf7905f63bf52c405e4",
"x86": "f36df8ba7a3858c2299162312cb939e3fe8ff65c704f988c497405ba8d9cb275",
},
}
prefix = {
"x86_64": "msvc",
"x86": "mingw",
}
version = "1.16.0"
task = (
@@ -664,50 +664,122 @@ def package_gstreamer_dlls(servo_exe_dir, target):
gst_root = ""
gst_default_path = path.join("C:\\gstreamer\\1.0", gst_x64)
gst_env = "GSTREAMER_1_0_ROOT_" + gst_x64
if os.path.exists(path.join(gst_default_path, "bin", "libffi-7.dll")) or \
os.path.exists(path.join(gst_default_path, "bin", "ffi-7.dll")):
gst_root = gst_default_path
elif os.environ.get(gst_env) is not None:
if os.environ.get(gst_env) is not None:
gst_root = os.environ.get(gst_env)
elif os.path.exists(path.join(gst_default_path, "bin", "ffi-7.dll")):
gst_root = gst_default_path
else:
print("Could not found GStreamer installation directory.")
print("Could not find GStreamer installation directory.")
return False

# All the shared libraries required for starting up and loading plugins.
gst_dlls = [
["libffi-7.dll", "ffi-7.dll"],
["libgio-2.0-0.dll", "gio-2.0-0.dll"],
["libglib-2.0-0.dll", "glib-2.0-0.dll"],
["libgmodule-2.0-0.dll", "gmodule-2.0-0.dll"],
["libgobject-2.0-0.dll", "gobject-2.0-0.dll"],
["libgstapp-1.0-0.dll", "gstapp-1.0-0.dll"],
["libgstaudio-1.0-0.dll", "gstaudio-1.0-0.dll"],
["libgstbase-1.0-0.dll", "gstbase-1.0-0.dll"],
["libgstgl-1.0-0.dll", "gstgl-1.0-0.dll"],
["libgstpbutils-1.0-0.dll", "gstpbutils-1.0-0.dll"],
["libgstplayer-1.0-0.dll", "gstplayer-1.0-0.dll"],
["libgstreamer-1.0-0.dll", "gstreamer-1.0-0.dll"],
["libgstrtp-1.0-0.dll", "gstrtp-1.0-0.dll"],
["libgstsdp-1.0-0.dll", "gstsdp-1.0-0.dll"],
["libgsttag-1.0-0.dll", "gsttag-1.0-0.dll"],
["libgstvideo-1.0-0.dll", "gstvideo-1.0-0.dll"],
["libgstwebrtc-1.0-0.dll", "gstwebrtc-1.0-0.dll"],
["libintl-8.dll", "intl-8.dll"],
["liborc-0.4-0.dll", "orc-0.4-0.dll"],
["libwinpthread-1.dll", "winpthread-1.dll"],
["libz.dll", "libz-1.dll", "z-1.dll"]
"avfilter-7.dll",
"avformat-58.dll",
"avcodec-58.dll",
"avutil-56.dll",
"bz2.dll",
"ffi-7.dll",
"gio-2.0-0.dll",
"glib-2.0-0.dll",
"gmodule-2.0-0.dll",
"gobject-2.0-0.dll",
"graphene-1.0-0.dll",
"gstapp-1.0-0.dll",
"gstaudio-1.0-0.dll",
"gstbase-1.0-0.dll",
"gstcodecparsers-1.0-0.dll",
"gstcontroller-1.0-0.dll",
"gstfft-1.0-0.dll",
"gstgl-1.0-0.dll",
"gstpbutils-1.0-0.dll",
"gstplayer-1.0-0.dll",
"gstreamer-1.0-0.dll",
"gstriff-1.0-0.dll",
"gstrtp-1.0-0.dll",
"gstsctp-1.0-0.dll",
"gstsdp-1.0-0.dll",
"gsttag-1.0-0.dll",
"gstvideo-1.0-0.dll",
"gstwebrtc-1.0-0.dll",
"intl-8.dll",
"libgmp-10.dll",
"libgnutls-30.dll",
"libhogweed-4.dll",
"libjpeg-8.dll",
"libnettle-6.dll.",
"libpng16-16.dll",
"libogg-0.dll",
"libopus-0.dll",
"libtasn1-6.dll",
"libtheora-0.dll",
"libtheoradec-1.dll",
"libtheoraenc-1.dll",
"libvorbis-0.dll",
"libvorbisenc-2.dll",
"libwinpthread-1.dll",
"nice-10.dll",
"orc-0.4-0.dll",
"swresample-3.dll",
"z-1.dll",
]

missing = []
for gst_lib in gst_dlls:
if isinstance(gst_lib, str):
gst_lib = [gst_lib]
for lib in gst_lib:
try:
shutil.copy(path.join(gst_root, "bin", lib), servo_exe_dir)
break
except:
pass
else:
try:
shutil.copy(path.join(gst_root, "bin", gst_lib), servo_exe_dir)
except:
missing += [str(gst_lib)]

for gst_lib in missing:
print("ERROR: could not find required GStreamer DLL: " + gst_lib)
if missing:
return False

# Only copy a subset of the available plugins.
gst_dlls = [
"gstapp.dll",
"gstaudioconvert.dll",
"gstaudiofx.dll",
"gstaudioparsers.dll",
"gstaudioresample.dll",
"gstautodetect.dll",
"gstcoreelements.dll",
"gstdeinterlace.dll",
"gstplayback.dll",
"gstinterleave.dll",
"gstisomp4.dll",
"gstnice.dll",
"gstogg.dll",
"gstopengl.dll",
"gstopus.dll",
"gstproxy.dll",
"gstrtp.dll",
"gsttheora.dll",
"gsttypefindfunctions.dll",
"gstvideoconvert.dll",
"gstvideofilter.dll",
"gstvideoparsersbad.dll",
"gstvideoscale.dll",
"gstvolume.dll",
"gstvorbis.dll",
"gstvpx.dll",
"gstwebrtc.dll",
"gstwasapi.dll",
"gstlibav.dll",
]

gst_plugin_path_root = os.environ.get("GSTREAMER_PACKAGE_PLUGIN_PATH") or gst_root
gst_plugin_path = path.join(gst_plugin_path_root, "lib", "gstreamer-1.0")
if not os.path.exists(gst_plugin_path):
print("ERROR: couldn't find gstreamer plugins at " + gst_plugin_path)
return False

missing = []
for gst_lib in gst_dlls:
try:
shutil.copy(path.join(gst_plugin_path, gst_lib), servo_exe_dir)
except:
missing += [str(gst_lib)]

for gst_lib in missing:
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.