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

Improve GStreamer plugin resolution #32061

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 11 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions components/servo/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ mozangle = { workspace = true }
msg = { workspace = true }
net = { path = "../net" }
net_traits = { workspace = true }
process_path = "0.1"
profile = { path = "../profile" }
profile_traits = { workspace = true }
script = { path = "../script" }
Expand Down
23 changes: 18 additions & 5 deletions components/servo/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,12 +124,25 @@ mod media_platform {
#[cfg(any(windows, target_os = "macos"))]
pub fn init() {
ServoMedia::init_with_backend(|| {
let mut plugin_dir = std::env::current_exe().unwrap();
plugin_dir.pop();
// Allow overriding of plugin path via standard GStreamer env var.
let plugin_dir = if let Ok(value) = std::env::var("GST_PLUGIN_PATH") {
std::path::PathBuf::from(value)
} else {
// Prefer the path of the folder containing the current module,
// or if that's not available the folder containing the currrent
// executable.
let mut file_path = process_path::get_dylib_path()
.unwrap_or_else(|| std::env::current_exe().unwrap());
file_path.pop();

// Mac OS GStreamer distro has plugins at lib subfolder of rpath.
if cfg!(target_os = "macos") {
file_path.push("lib");
}

if cfg!(target_os = "macos") {
plugin_dir.push("lib");
}
file_path
};
println!("GStreamer plugin dir: {:?}", plugin_dir);

match GStreamerBackend::init_with_plugins(
plugin_dir,
Expand Down