mirror of
https://github.com/servo/servo.git
synced 2025-08-03 20:50:07 +01:00
Fix Servo taking a long time to start on MacOS after a recompile (#30726)
* update init as we initialize media in the background now With [#405](https://github.com/servo/media/pull/405) changes in servo/media we move initialization of the media engine to a background thread. This PR updates the init function in libservo to adapt that behaviour. Co-authored-by: Martin Robinson <mrobinson@igalia.com> * review fix: simplify code * Update media --------- Co-authored-by: Martin Robinson <mrobinson@igalia.com>
This commit is contained in:
parent
098e6a1580
commit
1e5db618d0
2 changed files with 25 additions and 23 deletions
15
Cargo.lock
generated
15
Cargo.lock
generated
|
@ -5071,8 +5071,9 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "servo-media"
|
name = "servo-media"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
source = "git+https://github.com/servo/media#8ea11a849d5c2f0e469d1d1ccad93a74fbd81462"
|
source = "git+https://github.com/servo/media#97515f64c551e37854c6e29eff93988c4d0ee152"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
|
"once_cell",
|
||||||
"servo-media-audio",
|
"servo-media-audio",
|
||||||
"servo-media-player",
|
"servo-media-player",
|
||||||
"servo-media-streams",
|
"servo-media-streams",
|
||||||
|
@ -5083,7 +5084,7 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "servo-media-audio"
|
name = "servo-media-audio"
|
||||||
version = "0.2.0"
|
version = "0.2.0"
|
||||||
source = "git+https://github.com/servo/media#8ea11a849d5c2f0e469d1d1ccad93a74fbd81462"
|
source = "git+https://github.com/servo/media#97515f64c551e37854c6e29eff93988c4d0ee152"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"boxfnonce",
|
"boxfnonce",
|
||||||
"byte-slice-cast",
|
"byte-slice-cast",
|
||||||
|
@ -5190,7 +5191,7 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "servo-media-player"
|
name = "servo-media-player"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
source = "git+https://github.com/servo/media#8ea11a849d5c2f0e469d1d1ccad93a74fbd81462"
|
source = "git+https://github.com/servo/media#97515f64c551e37854c6e29eff93988c4d0ee152"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"ipc-channel",
|
"ipc-channel",
|
||||||
"serde",
|
"serde",
|
||||||
|
@ -5202,7 +5203,7 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "servo-media-streams"
|
name = "servo-media-streams"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
source = "git+https://github.com/servo/media#8ea11a849d5c2f0e469d1d1ccad93a74fbd81462"
|
source = "git+https://github.com/servo/media#97515f64c551e37854c6e29eff93988c4d0ee152"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"lazy_static",
|
"lazy_static",
|
||||||
"uuid",
|
"uuid",
|
||||||
|
@ -5211,12 +5212,12 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "servo-media-traits"
|
name = "servo-media-traits"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
source = "git+https://github.com/servo/media#8ea11a849d5c2f0e469d1d1ccad93a74fbd81462"
|
source = "git+https://github.com/servo/media#97515f64c551e37854c6e29eff93988c4d0ee152"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "servo-media-webrtc"
|
name = "servo-media-webrtc"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
source = "git+https://github.com/servo/media#8ea11a849d5c2f0e469d1d1ccad93a74fbd81462"
|
source = "git+https://github.com/servo/media#97515f64c551e37854c6e29eff93988c4d0ee152"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"boxfnonce",
|
"boxfnonce",
|
||||||
"lazy_static",
|
"lazy_static",
|
||||||
|
@ -5293,7 +5294,7 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "servo_media_derive"
|
name = "servo_media_derive"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
source = "git+https://github.com/servo/media#8ea11a849d5c2f0e469d1d1ccad93a74fbd81462"
|
source = "git+https://github.com/servo/media#97515f64c551e37854c6e29eff93988c4d0ee152"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
|
|
|
@ -112,24 +112,25 @@ mod media_platform {
|
||||||
|
|
||||||
#[cfg(any(windows, target_os = "macos"))]
|
#[cfg(any(windows, target_os = "macos"))]
|
||||||
pub fn init() {
|
pub fn init() {
|
||||||
let mut plugin_dir = std::env::current_exe().unwrap();
|
ServoMedia::init_with_backend(|| {
|
||||||
plugin_dir.pop();
|
let mut plugin_dir = std::env::current_exe().unwrap();
|
||||||
|
plugin_dir.pop();
|
||||||
|
|
||||||
if cfg!(target_os = "macos") {
|
if cfg!(target_os = "macos") {
|
||||||
plugin_dir.push("lib");
|
plugin_dir.push("lib");
|
||||||
}
|
}
|
||||||
|
|
||||||
let backend = match GStreamerBackend::init_with_plugins(
|
match GStreamerBackend::init_with_plugins(
|
||||||
plugin_dir,
|
plugin_dir,
|
||||||
&gstreamer_plugins::GSTREAMER_PLUGINS,
|
&gstreamer_plugins::GSTREAMER_PLUGINS,
|
||||||
) {
|
) {
|
||||||
Ok(b) => b,
|
Ok(b) => b,
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
eprintln!("Error initializing GStreamer: {:?}", e);
|
eprintln!("Error initializing GStreamer: {:?}", e);
|
||||||
std::process::exit(1);
|
std::process::exit(1);
|
||||||
},
|
},
|
||||||
};
|
}
|
||||||
ServoMedia::init_with_backend(backend);
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(not(any(windows, target_os = "macos")))]
|
#[cfg(not(any(windows, target_os = "macos")))]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue