Upgrade media / GStreamer / GLib (#30750)

- Upgrade the version of GStreamer for Windows

This upgrades the Windows build to use the most recent version of
GStreamer. This is necessary to upgrade our GStreamer dependency.

- Stop shipping GStreamer binaries on Linux

The binary bundle of GStreamer that we package is not used to compile --
only to run layout tests. It's too old for the APIs that we are using
(as evidenced by needed 1.18 for WebRTC) and nowadays Linux
distributions carry a new version so it's unecessary for our build
machines. No longer using this binary bundle will allow us to upgrade
our GStreamer dependency -- which now has stricter checks that we
are using at least version 1.18.

- Upgrade media to use newer versions of GStreamer / GLib dependencies
This commit is contained in:
Martin Robinson 2024-01-05 09:01:58 +01:00 committed by GitHub
parent c219204084
commit 7fa4ea9740
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
36 changed files with 517 additions and 338 deletions

View file

@ -21,6 +21,7 @@ env:
RUST_BACKTRACE: 1
SHELL: /bin/bash
WPT_COMMAND_LINE_ARG: "${{ inputs.wpt-layout == 'layout-2013' && '--legacy-layout' || '' }}"
GST_PLUGIN_FEATURE_RANK: pulsesink:NONE,alsasink:NONE,jacksink:NONE,fakesink:MAX
jobs:
linux-wpt:
@ -48,25 +49,14 @@ jobs:
with:
name: release-binary
path: release-binary
- name: Cache libffi
id: cache
uses: actions/cache@v3
with:
path: ./libffi6_3.2.1-8_amd64.deb
key: cache-libffi
- name: Download libffi
if: steps.cache.outputs.cache-hit != 'true'
run: |
wget http://mirrors.kernel.org/ubuntu/pool/main/libf/libffi/libffi6_3.2.1-8_amd64.deb
- name: unPackage binary
run: tar -xzf release-binary/target.tar.gz
- name: Prep test environment
- name: Bootstrap dependencies
run: |
python3 -m pip install --upgrade pip
sudo apt update
sudo apt install -qy --no-install-recommends libgl1 libssl1.1 libdbus-1-3 libxcb-xfixes0-dev libxcb-shape0-dev libunwind8 libgl1-mesa-dri mesa-vulkan-drivers libegl1-mesa
sudo apt install ./libffi6_3.2.1-8_amd64.deb
python3 ./mach bootstrap-gstreamer
sudo apt install -qy --no-install-recommends mesa-vulkan-drivers
python3 ./mach bootstrap
- name: Sync from upstream WPT
if: ${{ inputs.wpt-sync-from-upstream }}
run: |

View file

@ -96,7 +96,9 @@ jobs:
- name: Bootstrap Python
run: python3 -m pip install --upgrade pip
- name: Bootstrap dependencies
run: sudo apt update && python3 ./mach bootstrap
run: |
sudo apt update
python3 ./mach bootstrap
- name: Tidy
run: python3 ./mach test-tidy --no-progress --all
- name: Build (${{ inputs.profile }})

574
Cargo.lock generated

File diff suppressed because it is too large Load diff

View file

@ -40,6 +40,14 @@ fxhash = "0.2"
getopts = "0.2.11"
gfx_traits = { path = "components/shared/gfx" }
gleam = "0.15"
glib = "0.18"
gstreamer = { version = "0.21", features = ["v1_18"] }
gstreamer-base = "0.21"
gstreamer-gl = "0.21"
gstreamer-gl-sys = { version = "0.21" }
gstreamer-gl-wayland = { version = "0.21" }
gstreamer-sys = "0.21"
gstreamer-video = "0.21"
headers = "0.3"
html5ever = "0.26"
http = "0.2"

View file

@ -378,9 +378,9 @@ impl From<&RTCDataChannelInit> for DataChannelInit {
impl From<DataChannelState> for RTCDataChannelState {
fn from(state: DataChannelState) -> RTCDataChannelState {
match state {
DataChannelState::New |
DataChannelState::Connecting |
DataChannelState::__Unknown(_) => RTCDataChannelState::Connecting,
DataChannelState::Connecting | DataChannelState::__Unknown(_) => {
RTCDataChannelState::Connecting
},
DataChannelState::Open => RTCDataChannelState::Open,
DataChannelState::Closing => RTCDataChannelState::Closing,
DataChannelState::Closed => RTCDataChannelState::Closed,

View file

@ -458,8 +458,11 @@ impl RTCPeerConnection {
.task_manager()
.networking_task_source_with_canceller();
let this = Trusted::new(self);
self.controller.borrow_mut().as_ref().unwrap().create_offer(
(move |desc: SessionDescription| {
self.controller
.borrow_mut()
.as_ref()
.unwrap()
.create_offer(Box::new(move |desc: SessionDescription| {
let _ = task_source.queue_with_canceller(
task!(offer_created: move || {
let this = this.root();
@ -476,9 +479,7 @@ impl RTCPeerConnection {
}),
&canceller,
);
})
.into(),
);
}));
}
fn create_answer(&self) {
@ -493,27 +494,24 @@ impl RTCPeerConnection {
.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);
}
.create_answer(Box::new(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(),
);
}
}),
&canceller,
);
}));
}
}
@ -642,7 +640,7 @@ impl RTCPeerConnectionMethods for RTCPeerConnection {
.unwrap()
.set_local_description(
desc.clone(),
(move || {
Box::new(move || {
let _ = task_source.queue_with_canceller(
task!(local_description_set: move || {
// XXXManishearth spec actually asks for an intricate
@ -659,8 +657,7 @@ impl RTCPeerConnectionMethods for RTCPeerConnection {
}),
&canceller,
);
})
.into(),
}),
);
p
}
@ -683,7 +680,7 @@ impl RTCPeerConnectionMethods for RTCPeerConnection {
.unwrap()
.set_remote_description(
desc.clone(),
(move || {
Box::new(move || {
let _ = task_source.queue_with_canceller(
task!(remote_description_set: move || {
// XXXManishearth spec actually asks for an intricate
@ -700,8 +697,7 @@ impl RTCPeerConnectionMethods for RTCPeerConnection {
}),
&canceller,
);
})
.into(),
}),
);
p
}

View file

@ -49,7 +49,7 @@ euclid = { workspace = true }
gfx = { path = "../gfx" }
gfx_traits = { workspace = true }
gleam = { workspace = true }
gstreamer = { version = "0.15", features = ["v1_16"], optional = true }
gstreamer = { workspace = true, optional = true }
ipc-channel = { workspace = true }
keyboard-types = { workspace = true }
layout_thread_2013 = { path = "../layout_thread" }

View file

@ -16,7 +16,7 @@ bench = false
[dependencies]
android_injected_glue = "0.2"
android_logger = "0.10"
gstreamer = "0.15"
gstreamer = { workspace = true }
jni = "0.18.0"
libc = { workspace = true }
log = { workspace = true }

View file

@ -430,10 +430,10 @@ def package_gstreamer_dlls(env, servo_exe_dir, target):
# All the shared libraries required for starting up and loading plugins.
gst_dlls = [
"avcodec-58.dll",
"avfilter-7.dll",
"avformat-58.dll",
"avutil-56.dll",
"avcodec-59.dll",
"avfilter-8.dll",
"avformat-59.dll",
"avutil-57.dll",
"bz2.dll",
"ffi-7.dll",
"gio-2.0-0.dll",
@ -443,26 +443,21 @@ def package_gstreamer_dlls(env, servo_exe_dir, target):
"graphene-1.0-0.dll",
"intl-8.dll",
"libcrypto-1_1-x64.dll",
"libgmp-10.dll",
"libgnutls-30.dll",
"libhogweed-4.dll",
"libjpeg-8.dll",
"libnettle-6.dll.",
"libogg-0.dll",
"libopus-0.dll",
"libpng16-16.dll",
"libssl-1_1-x64.dll",
"libtasn1-6.dll",
"libtheora-0.dll",
"libtheoradec-1.dll",
"libtheoraenc-1.dll",
"libusrsctp-1.dll",
"libvorbis-0.dll",
"libvorbisenc-2.dll",
"libwinpthread-1.dll",
"nice-10.dll",
"opus-0.dll",
"orc-0.4-0.dll",
"swresample-3.dll",
"pcre2-8-0.dll",
"swresample-4.dll",
"theora-0.dll",
"theoradec-1.dll",
"theoraenc-1.dll",
"z-1.dll",
] + windows_dlls()

View file

@ -22,6 +22,7 @@ GSTREAMER_DYLIBS = [
"gstfft",
"gstgl",
"gstpbutils",
"gstplay",
"gstriff",
"gstrtp",
"gstrtsp",
@ -33,6 +34,7 @@ GSTREAMER_DYLIBS = [
"gstcodecparsers",
"gstplayer",
"gstwebrtc",
"gstwebrtcnice",
]
@ -84,12 +86,9 @@ def windows_dlls():
def windows_plugins():
# FIXME: We should support newer gstreamer versions here that replace
# gstvideoconvert and gstvideoscale with gstvideoconvertscale.
libs = [
*GSTREAMER_PLUGINS,
"gstvideoconvert",
"gstvideoscale",
"gstvideoconvertscale",
"gstwasapi"
]
return [f"{lib}.dll" for lib in libs]

View file

@ -56,7 +56,7 @@ class Base:
# the cross-compilation case, we might be picking it up from another directory.
if check_installation and not self.is_gstreamer_installed(cross_compilation_target):
raise FileNotFoundError(
"GStreamer libraries not found (>= version 1.16)."
"GStreamer libraries not found (>= version 1.18)."
"Please see installation instructions in README.md"
)
@ -83,7 +83,7 @@ class Base:
env, cross_compilation_target, check_installation=False)
return (
subprocess.call(
["pkg-config", "--atleast-version=1.16", "gstreamer-1.0"],
["pkg-config", "--atleast-version=1.18", "gstreamer-1.0"],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
env=env,

View file

@ -9,7 +9,6 @@
import os
import subprocess
import tempfile
from typing import Optional, Tuple
import distro
@ -28,8 +27,16 @@ from .base import Base
APT_PKGS = [
'build-essential', 'ccache', 'clang', 'cmake', 'curl', 'g++', 'git',
'gperf', 'libdbus-1-dev', 'libfreetype6-dev', 'libgl1-mesa-dri',
'libgles2-mesa-dev', 'libglib2.0-dev', 'libgstreamer-plugins-bad1.0-dev',
'libgstreamer-plugins-base1.0-dev', 'libgstreamer1.0-dev',
'libgles2-mesa-dev', 'libglib2.0-dev',
'libgstreamer-plugins-base1.0-dev',
'gstreamer1.0-plugins-good', 'libgstreamer-plugins-good1.0-dev',
'gstreamer1.0-plugins-bad', 'libgstreamer-plugins-bad1.0-dev',
'gstreamer1.0-plugins-ugly',
"gstreamer1.0-plugins-base", 'libgstreamer-plugins-base1.0-dev',
'gstreamer1.0-libav',
'libgstrtspserver-1.0-dev',
'gstreamer1.0-tools',
'libges-1.0-dev',
'libharfbuzz-dev', 'liblzma-dev', 'libunwind-dev', 'libunwind-dev',
'libvulkan1', 'libx11-dev', 'libxcb-render0-dev', 'libxcb-shape0-dev',
'libxcb-xfixes0-dev', 'libxmu-dev', 'libxmu6', 'libegl1-mesa-dev',
@ -156,7 +163,7 @@ class Linux(Base):
if self.distro in ['Ubuntu', 'Debian GNU/Linux', 'Raspbian GNU/Linux']:
command = ['apt-get', 'install']
pkgs = APT_PKGS
if subprocess.call(['dpkg', '-s'] + pkgs,
if subprocess.call(['dpkg', '-s'] + pkgs, shell=True,
stdout=subprocess.PIPE, stderr=subprocess.PIPE) != 0:
install = True
elif self.distro in ['CentOS', 'CentOS Linux', 'Fedora', 'Fedora Linux']:
@ -204,18 +211,6 @@ class Linux(Base):
if not force and self.is_gstreamer_installed(cross_compilation_target=None):
return False
with tempfile.TemporaryDirectory() as temp_dir:
file_name = os.path.join(temp_dir, GSTREAMER_URL.rsplit('/', maxsplit=1)[-1])
util.download_file("Pre-packaged GStreamer binaries", GSTREAMER_URL, file_name)
print(f"Installing GStreamer packages to {PREPACKAGED_GSTREAMER_ROOT}...")
os.makedirs(PREPACKAGED_GSTREAMER_ROOT, exist_ok=True)
# Extract, but strip one component from the output, because the package includes
# a toplevel directory called "./gst/" and we'd like to have the same directory
# structure on all platforms.
subprocess.check_call(["tar", "xf", file_name, "-C", PREPACKAGED_GSTREAMER_ROOT,
"--strip-components=2"])
assert self.is_gstreamer_installed(cross_compilation_target=None)
return True
raise EnvironmentError(
"Bootstrapping GStreamer on Linux is not supported. "
+ "Please install it using your distribution package manager.")

View file

@ -23,8 +23,8 @@ DEPENDENCIES = {
}
URL_BASE = "https://github.com/servo/servo-build-deps/releases/download/msvc-deps/"
GSTREAMER_URL = f"{URL_BASE}/gstreamer-1.0-msvc-x86_64-1.16.0.msi"
GSTREAMER_DEVEL_URL = f"{URL_BASE}/gstreamer-1.0-devel-msvc-x86_64-1.16.0.msi"
GSTREAMER_URL = f"{URL_BASE}/gstreamer-1.0-msvc-x86_64-1.22.8.msi"
GSTREAMER_DEVEL_URL = f"{URL_BASE}/gstreamer-1.0-devel-msvc-x86_64-1.22.8.msi"
DEPENDENCIES_DIR = os.path.join(util.get_target_dir(), "dependencies")
@ -118,19 +118,19 @@ class Windows(Base):
# The bootstraped version of GStreamer always takes precedance of the installed vesion.
prepackaged_root = os.path.join(
DEPENDENCIES_DIR, "gstreamer", "1.0", gst_arch_name
DEPENDENCIES_DIR, "gstreamer", "1.0", f"msvc_{gst_arch_name}"
)
if os.path.exists(os.path.join(prepackaged_root, "bin", "ffi-7.dll")):
return prepackaged_root
# The installed version of GStreamer often sets an environment variable pointing to
# the install location.
root_from_env = os.environ.get(f"GSTREAMER_1_0_ROOT_{gst_arch_name}")
root_from_env = os.environ.get(f"GSTREAMER_1_0_ROOT_MSVC_{gst_arch_name}")
if root_from_env and os.path.exists(os.path.join(root_from_env, "bin", "ffi-7.dll")):
return root_from_env
# If all else fails, look for an installation in the default install directory.
default_root = os.path.join("C:\\gstreamer\\1.0", gst_arch_name)
default_root = os.path.join("C:\\gstreamer\\1.0", f"msvc_{gst_arch_name}")
if os.path.exists(os.path.join(default_root, "bin", "ffi-7.dll")):
return default_root

View file

@ -21,12 +21,10 @@ rand = [
# Ignored packages with duplicated versions
packages = [
"bitflags",
"cfg-if",
"cookie",
"futures",
"libloading",
"nix",
"num-rational",
"redox_syscall",
"syn",
"synstructure",
@ -34,6 +32,11 @@ packages = [
"wasi",
"wayland-sys",
# New versions of these dependencies is pulled in by GStreamer / GLib.
"itertools",
"proc-macro-crate",
"toml",
# This dependency is for "hermit os" which Servo doesn't support.
# Theoretically, it's never fetched.
"hermit-abi",
@ -53,12 +56,11 @@ packages = [
"foreign-types",
"foreign-types-shared",
"metal",
"paste",
# Duplicated by indexmap.
"hashbrown",
# Duplicated by style, cbindgen, clap.
# Duplicated by style, cbindgen, clap, and GStreamer.
"indexmap",
# style (0.64) vs. webxr (0.66) vs. mozjs_sys (0.68).

View file

@ -82,7 +82,3 @@
[video/webm; codecs="opus" (optional)]
expected: FAIL
[video/webm; codecs="vorbis" (optional)]
expected: FAIL

View file

@ -931,3 +931,15 @@
[X SNR (46.132795778267024 dB) is not greater than or equal to 65.737. Got 46.132795778267024.]
expected: FAIL
[X Stitched sine-wave buffers at sample rate 43800 does not equal [0,0.06264832615852356,0.12505052983760834,0.18696144223213196,0.24813786149024963,0.308339387178421,0.36732959747314453,0.4248766601085663,0.480754554271698,0.5347436666488647,0.5866320133209229,0.6362156271934509,0.6832997798919678,0.7276994585990906,0.7692402601242065,0.8077589869499207...\] with an element-wise tolerance of {"absoluteThreshold":0.0038986,"relativeThreshold":0}.\n\tIndex\tActual\t\t\tExpected\t\tAbsError\t\tRelError\t\tTest threshold\n\t[15073\]\t6.4777153693314271e+21\t6.4605611562728882e-1\t6.4777153693314271e+21\t1.0026552202887025e+22\t3.8985999999999999e-3\n\t[15074\]\t2.5936898589134216e-1\t5.9696805477142334e-1\t3.3759906888008118e-1\t5.6552283858697683e-1\t3.8985999999999999e-3\n\tMax AbsError of 6.4777153693314271e+21 at index of 15073.\n\tMax RelError of 1.0026552202887025e+22 at index of 15073.\n]
expected: FAIL
[X SNR (-392.7943512800274 dB) is not greater than or equal to 65.737. Got -392.7943512800274.]
expected: FAIL
[X Stitched sine-wave buffers at sample rate 43800 does not equal [0,0.06264832615852356,0.12505052983760834,0.18696144223213196,0.24813786149024963,0.308339387178421,0.36732959747314453,0.4248766601085663,0.480754554271698,0.5347436666488647,0.5866320133209229,0.6362156271934509,0.6832997798919678,0.7276994585990906,0.7692402601242065,0.8077589869499207...\] with an element-wise tolerance of {"absoluteThreshold":0.0038986,"relativeThreshold":0}.\n\tIndex\tActual\t\t\tExpected\t\tAbsError\t\tRelError\t\tTest threshold\n\t[15073\]\t3.5112564086914063e+2\t6.4605611562728882e-1\t3.5047958475351334e+2\t5.4249093271598372e+2\t3.8985999999999999e-3\n\t[15074\]\t2.5936898589134216e-1\t5.9696805477142334e-1\t3.3759906888008118e-1\t5.6552283858697683e-1\t3.8985999999999999e-3\n\tMax AbsError of 3.5047958475351334e+2 at index of 15073.\n\tMax RelError of 5.4249093271598372e+2 at index of 15073.\n]
expected: FAIL
[X SNR (-7.45917280407153 dB) is not greater than or equal to 65.737. Got -7.45917280407153.]
expected: FAIL

View file

@ -82,7 +82,3 @@
[video/webm; codecs="opus" (optional)]
expected: FAIL
[video/webm; codecs="vorbis" (optional)]
expected: FAIL

View file

@ -1,3 +1,6 @@
[resize-during-playback.html]
[webm video]
expected: FAIL
[mp4 video]
expected: PRECONDITION_FAILED

View file

@ -1,2 +1,4 @@
[tex-2d-alpha-alpha-unsigned_byte.html]
expected: ERROR
expected: TIMEOUT
[Overall test]
expected: NOTRUN

View file

@ -1,2 +1,4 @@
[tex-2d-luminance-luminance-unsigned_byte.html]
expected: ERROR
expected: TIMEOUT
[Overall test]
expected: NOTRUN

View file

@ -1,2 +1,4 @@
[tex-2d-luminance_alpha-luminance_alpha-unsigned_byte.html]
expected: ERROR
expected: TIMEOUT
[Overall test]
expected: NOTRUN

View file

@ -1,2 +1,4 @@
[tex-2d-rgb-rgb-unsigned_byte.html]
expected: ERROR
expected: TIMEOUT
[Overall test]
expected: NOTRUN

View file

@ -1,2 +1,4 @@
[tex-2d-rgb-rgb-unsigned_short_5_6_5.html]
expected: ERROR
expected: TIMEOUT
[Overall test]
expected: NOTRUN

View file

@ -1,2 +1,4 @@
[tex-2d-rgba-rgba-unsigned_byte.html]
expected: ERROR
expected: TIMEOUT
[Overall test]
expected: NOTRUN

View file

@ -1,2 +1,4 @@
[tex-2d-rgba-rgba-unsigned_short_4_4_4_4.html]
expected: ERROR
expected: TIMEOUT
[Overall test]
expected: NOTRUN

View file

@ -1,2 +1,4 @@
[tex-2d-rgba-rgba-unsigned_short_5_5_5_1.html]
expected: ERROR
expected: TIMEOUT
[Overall test]
expected: NOTRUN

View file

@ -1,8 +1,11 @@
[tex-video-using-tex-unit-non-zero.html]
bug: https://github.com/servo/servo/issues/21132
expected: TIMEOUT
[WebGL test #0: Unable to fetch WebGL rendering context for Canvas]
expected: FAIL
[WebGL test #1: context does not exist]
expected: FAIL
[Overall test]
expected: NOTRUN

View file

@ -1,2 +1,4 @@
[tex-2d-alpha-alpha-unsigned_byte.html]
expected: ERROR
expected: TIMEOUT
[Overall test]
expected: NOTRUN

View file

@ -1,2 +1,4 @@
[tex-2d-luminance-luminance-unsigned_byte.html]
expected: ERROR
expected: TIMEOUT
[Overall test]
expected: NOTRUN

View file

@ -1,2 +1,4 @@
[tex-2d-luminance_alpha-luminance_alpha-unsigned_byte.html]
expected: ERROR
expected: TIMEOUT
[Overall test]
expected: NOTRUN

View file

@ -1,2 +1,4 @@
[tex-2d-rgb-rgb-unsigned_byte.html]
expected: ERROR
expected: TIMEOUT
[Overall test]
expected: NOTRUN

View file

@ -1,2 +1,4 @@
[tex-2d-rgb-rgb-unsigned_short_5_6_5.html]
expected: ERROR
expected: TIMEOUT
[Overall test]
expected: NOTRUN

View file

@ -1,2 +1,4 @@
[tex-2d-rgba-rgba-unsigned_byte.html]
expected: ERROR
expected: TIMEOUT
[Overall test]
expected: NOTRUN

View file

@ -1,2 +1,4 @@
[tex-2d-rgba-rgba-unsigned_short_4_4_4_4.html]
expected: ERROR
expected: TIMEOUT
[Overall test]
expected: NOTRUN

View file

@ -1,2 +1,4 @@
[tex-2d-rgba-rgba-unsigned_short_5_5_5_1.html]
expected: ERROR
expected: TIMEOUT
[Overall test]
expected: NOTRUN

View file

@ -1,7 +1,11 @@
[tex-video-using-tex-unit-non-zero.html]
bug: https://github.com/servo/servo/issues/21132
expected: TIMEOUT
[WebGL test #0: Unable to fetch WebGL rendering context for Canvas]
expected: FAIL
[WebGL test #1: context does not exist]
expected: FAIL
[Overall test]
expected: NOTRUN