mirror of
https://github.com/servo/servo.git
synced 2025-07-02 21:13:39 +01:00
Auto merge of #21730 - ferjm:android.gstreamer, r=paulrouget
Enable WebAudio on Android - [X] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [X] These changes fix #21619 <!-- 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/21730) <!-- Reviewable:end -->
This commit is contained in:
commit
6e844f2278
7 changed files with 82 additions and 23 deletions
40
Cargo.lock
generated
40
Cargo.lock
generated
|
@ -115,7 +115,7 @@ dependencies = [
|
|||
"cmake 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"euclid 0.19.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"servo-freetype-sys 4.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"servo-freetype-sys 4.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"servo-skia 0.30000019.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
|
@ -1009,7 +1009,7 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "expat-sys"
|
||||
version = "2.1.5"
|
||||
version = "2.1.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"cmake 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
@ -1073,7 +1073,7 @@ version = "0.4.0"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"libc 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"servo-freetype-sys 4.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"servo-freetype-sys 4.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -2848,7 +2848,7 @@ dependencies = [
|
|||
"lazy_static 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"num_cpus 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rand 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rand 0.3.22 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -3246,22 +3246,22 @@ version = "0.2.1"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"libc 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"servo-fontconfig-sys 4.0.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"servo-fontconfig-sys 4.0.7 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "servo-fontconfig-sys"
|
||||
version = "4.0.6"
|
||||
version = "4.0.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"expat-sys 2.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"expat-sys 2.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"servo-freetype-sys 4.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"servo-freetype-sys 4.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "servo-freetype-sys"
|
||||
version = "4.0.3"
|
||||
version = "4.0.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"cmake 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
@ -3271,7 +3271,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "servo-media"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/servo/media#3292937b8bec7daed12b2f1b5739eb293610f5a2"
|
||||
source = "git+https://github.com/servo/media#e700a0834c3f38d49890d846591fd699e7405a48"
|
||||
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)",
|
||||
|
@ -3281,7 +3281,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "servo-media-audio"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/servo/media#3292937b8bec7daed12b2f1b5739eb293610f5a2"
|
||||
source = "git+https://github.com/servo/media#e700a0834c3f38d49890d846591fd699e7405a48"
|
||||
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)",
|
||||
|
@ -3297,7 +3297,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "servo-media-gstreamer"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/servo/media#3292937b8bec7daed12b2f1b5739eb293610f5a2"
|
||||
source = "git+https://github.com/servo/media#e700a0834c3f38d49890d846591fd699e7405a48"
|
||||
dependencies = [
|
||||
"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)",
|
||||
|
@ -3315,7 +3315,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "servo-media-player"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/servo/media#3292937b8bec7daed12b2f1b5739eb293610f5a2"
|
||||
source = "git+https://github.com/servo/media#e700a0834c3f38d49890d846591fd699e7405a48"
|
||||
dependencies = [
|
||||
"ipc-channel 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde 1.0.66 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
@ -3330,15 +3330,15 @@ dependencies = [
|
|||
"cgl 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"cmake 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"euclid 0.19.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"expat-sys 2.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"expat-sys 2.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"gleam 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"glutin 0.18.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"glx 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"io-surface 0.11.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"servo-egl 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"servo-fontconfig-sys 4.0.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"servo-freetype-sys 4.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"servo-fontconfig-sys 4.0.7 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"servo-freetype-sys 4.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"x11 2.17.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
|
@ -3410,7 +3410,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "servo_media_derive"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/servo/media#3292937b8bec7daed12b2f1b5739eb293610f5a2"
|
||||
source = "git+https://github.com/servo/media#e700a0834c3f38d49890d846591fd699e7405a48"
|
||||
dependencies = [
|
||||
"quote 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"syn 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
@ -4412,7 +4412,7 @@ dependencies = [
|
|||
"checksum env_logger 0.5.10 (registry+https://github.com/rust-lang/crates.io-index)" = "0e6e40ebb0e66918a37b38c7acab4e10d299e0463fe2af5d29b9cc86710cfd2a"
|
||||
"checksum error-chain 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)" = "07e791d3be96241c77c43846b665ef1384606da2cd2a48730abe606a12906e02"
|
||||
"checksum euclid 0.19.0 (registry+https://github.com/rust-lang/crates.io-index)" = "70a2ebdf55fb9d6329046e026329a55ef8fbaae5ea833f56e170beb3125a8a5f"
|
||||
"checksum expat-sys 2.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "c470ccb972f2088549b023db8029ed9da9426f5affbf9b62efff7009ab8ed5b1"
|
||||
"checksum expat-sys 2.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "658f19728920138342f68408b7cf7644d90d4784353d8ebc32e7e8663dbe45fa"
|
||||
"checksum fixedbitset 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "86d4de0081402f5e88cdac65c8dcdcc73118c1a7a465e2a05f0da05843a8ea33"
|
||||
"checksum flate2 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "9fac2277e84e5e858483756647a9d0aa8d9a2b7cba517fd84325a0aaa69a0909"
|
||||
"checksum fnv 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "6cc484842f1e2884faf56f529f960cc12ad8c71ce96cc7abba0a067c98fee344"
|
||||
|
@ -4589,8 +4589,8 @@ dependencies = [
|
|||
"checksum serde_json 1.0.13 (registry+https://github.com/rust-lang/crates.io-index)" = "5c508584d9913df116b91505eec55610a2f5b16e9ed793c46e4d0152872b3e74"
|
||||
"checksum servo-egl 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "21069a884c33fe6ee596975e1f3849ed88c4ec857fbaf11d33672d8ebe051217"
|
||||
"checksum servo-fontconfig 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "93f799b649b4a2bf362398910eca35240704c7e765e780349b2bb1070d892262"
|
||||
"checksum servo-fontconfig-sys 4.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "b0aa080856db55f188aaf36f01cae8c03448a6056552adb77d461179e44e1a14"
|
||||
"checksum servo-freetype-sys 4.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "9232032c2e85118c0282c6562c84cab12316e655491ba0a5d1905b2320060d1b"
|
||||
"checksum servo-fontconfig-sys 4.0.7 (registry+https://github.com/rust-lang/crates.io-index)" = "b46d201addcfbd25c1798ad1281d98c40743824e0b0f1e611bd3d5d0d31a7b8d"
|
||||
"checksum servo-freetype-sys 4.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "5d00ab791f66cd2ec58e72c91b6076cee20fac560463aa871404eb31dfc9c4ff"
|
||||
"checksum servo-media 0.1.0 (git+https://github.com/servo/media)" = "<none>"
|
||||
"checksum servo-media-audio 0.1.0 (git+https://github.com/servo/media)" = "<none>"
|
||||
"checksum servo-media-gstreamer 0.1.0 (git+https://github.com/servo/media)" = "<none>"
|
||||
|
|
|
@ -13,8 +13,11 @@ import datetime
|
|||
import os
|
||||
import os.path as path
|
||||
import platform
|
||||
import sys
|
||||
import shutil
|
||||
import subprocess
|
||||
import sys
|
||||
import urllib
|
||||
import zipfile
|
||||
|
||||
from time import time
|
||||
|
||||
|
@ -396,6 +399,34 @@ class MachCommands(CommandBase):
|
|||
if not os.path.exists(aar_out_dir):
|
||||
os.makedirs(aar_out_dir)
|
||||
env["AAR_OUT_DIR"] = aar_out_dir
|
||||
# GStreamer and its dependencies use pkg-config and this flag is required
|
||||
# to make it work in a cross-compilation context.
|
||||
env["PKG_CONFIG_ALLOW_CROSS"] = '1'
|
||||
# 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 = "%s.zip" % gst_lib
|
||||
gst_dir = os.path.join(base_path, "gstreamer")
|
||||
gst_lib_path = os.path.join(base_path, gst_dir, gst_lib)
|
||||
pkg_config_path = os.path.join(gst_lib_path, "pkgconfig")
|
||||
env["PKG_CONFIG_PATH"] = pkg_config_path
|
||||
if not os.path.exists(gst_lib_path):
|
||||
# Download GStreamer dependencies if they have not already been downloaded
|
||||
print("Downloading GStreamer dependencies")
|
||||
gst_url = "https://github.com/servo/libgstreamer_android_gen/blob/master/out/%s?raw=true" % gst_lib_zip
|
||||
urllib.urlretrieve(gst_url, gst_lib_zip)
|
||||
zip_ref = zipfile.ZipFile(gst_lib_zip, "r")
|
||||
zip_ref.extractall(gst_dir)
|
||||
os.remove(gst_lib_zip)
|
||||
|
||||
# Change pkgconfig info to make all GStreamer dependencies point
|
||||
# to the libgstreamer_android.so bundle.
|
||||
for each in os.listdir(pkg_config_path):
|
||||
if each.endswith('.pc'):
|
||||
print("Setting pkgconfig info for %s" % each)
|
||||
pc = os.path.join(pkg_config_path, each)
|
||||
expr = "s#libdir=.*#libdir=%s#g" % gst_lib_path
|
||||
subprocess.call(["perl", "-i", "-pe", expr, pc])
|
||||
|
||||
if very_verbose:
|
||||
print (["Calling", "cargo", "build"] + opts)
|
||||
|
|
|
@ -20,3 +20,9 @@ LOCAL_PATH:= $(SERVO_TARGET_DIR)
|
|||
LOCAL_MODULE := servojni
|
||||
LOCAL_SRC_FILES := libsimpleservo.so
|
||||
include $(PREBUILT_SHARED_LIBRARY)
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
LOCAL_PATH:= $(SERVO_TARGET_DIR)/../../gstreamer/gst-build-$(APP_ABI)
|
||||
LOCAL_MODULE := gstreamer
|
||||
LOCAL_SRC_FILES := libgstreamer_android.so
|
||||
include $(PREBUILT_SHARED_LIBRARY)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
NDK_TOOLCHAIN_VERSION := 4.9
|
||||
APP_MODULES := c++_shared servojni
|
||||
APP_MODULES := c++_shared servojni gstreamer
|
||||
APP_PLATFORM := android-18
|
||||
APP_STL:= c++_shared
|
||||
|
|
|
@ -14,6 +14,7 @@ import android.app.Activity;
|
|||
public class JNIServo {
|
||||
JNIServo() {
|
||||
System.loadLibrary("c++_shared");
|
||||
System.loadLibrary("gstreamer_android");
|
||||
System.loadLibrary("simpleservo");
|
||||
}
|
||||
|
||||
|
|
|
@ -7,11 +7,14 @@ package com.mozilla.servoview;
|
|||
|
||||
import android.app.Activity;
|
||||
import android.content.res.AssetManager;
|
||||
import android.content.Context;
|
||||
import android.util.Log;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
|
||||
import org.freedesktop.gstreamer.GStreamer;
|
||||
|
||||
public class Servo {
|
||||
private static final String LOGTAG = "Servo";
|
||||
private AssetManager mAssetMgr;
|
||||
|
@ -27,7 +30,8 @@ public class Servo {
|
|||
String args,
|
||||
String url,
|
||||
String logstr,
|
||||
int width, int height, float density, boolean log) {
|
||||
int width, int height,
|
||||
float density, boolean log) {
|
||||
|
||||
mRunCallback = runCallback;
|
||||
|
||||
|
@ -38,6 +42,12 @@ public class Servo {
|
|||
mRunCallback.inGLThread(() -> {
|
||||
mJNI.init(activity, args, url, logstr, cbs, width, height, density, log);
|
||||
});
|
||||
|
||||
try {
|
||||
GStreamer.init((Context) activity);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public String version() {
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
package org.freedesktop.gstreamer;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
public class GStreamer {
|
||||
private static native void nativeInit(Context context) throws Exception;
|
||||
|
||||
public static void init(Context context) throws Exception {
|
||||
nativeInit(context);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue