mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +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
|
@ -112,24 +112,25 @@ mod media_platform {
|
|||
|
||||
#[cfg(any(windows, target_os = "macos"))]
|
||||
pub fn init() {
|
||||
let mut plugin_dir = std::env::current_exe().unwrap();
|
||||
plugin_dir.pop();
|
||||
ServoMedia::init_with_backend(|| {
|
||||
let mut plugin_dir = std::env::current_exe().unwrap();
|
||||
plugin_dir.pop();
|
||||
|
||||
if cfg!(target_os = "macos") {
|
||||
plugin_dir.push("lib");
|
||||
}
|
||||
if cfg!(target_os = "macos") {
|
||||
plugin_dir.push("lib");
|
||||
}
|
||||
|
||||
let backend = match GStreamerBackend::init_with_plugins(
|
||||
plugin_dir,
|
||||
&gstreamer_plugins::GSTREAMER_PLUGINS,
|
||||
) {
|
||||
Ok(b) => b,
|
||||
Err(e) => {
|
||||
eprintln!("Error initializing GStreamer: {:?}", e);
|
||||
std::process::exit(1);
|
||||
},
|
||||
};
|
||||
ServoMedia::init_with_backend(backend);
|
||||
match GStreamerBackend::init_with_plugins(
|
||||
plugin_dir,
|
||||
&gstreamer_plugins::GSTREAMER_PLUGINS,
|
||||
) {
|
||||
Ok(b) => b,
|
||||
Err(e) => {
|
||||
eprintln!("Error initializing GStreamer: {:?}", e);
|
||||
std::process::exit(1);
|
||||
},
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
#[cfg(not(any(windows, target_os = "macos")))]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue