Skip to content

Draft: gstreamer-full: Improve footprint by allowing element selection

This MR intends to offer a way to create a very light gstreamer-full library containing only a set of elements from a given plugin. During the link stage of gstreamer-full, the dead code path will be removed and the final binary size will be smaller.

By example you could have in gstreamer-full only a subset of the coreelements including by example filesrc and fakesink with this command:

meson build_static_minimal --buildtype=release -Ddefault_library=static -Dlibav=disabled -Dpython=disabled -Dlibnice=disabled -Ddevtools=disabled -Dges=disabled -Drtsp_server=disabled -Dgst-examples=disabled -Dtests=enabled -Dexamples=disabled -Ddoc=disabled -Dbad=disabled -Dugly=disabled -Dgood=disabled -Dbase=disabled -Dgstreamer:optimize-gc-sections=true -Dgst-full-elements=coreelements:filesrc,fakesink,identity

This MR depends on another MR pending on gstreamer repository:

gstreamer!567 (closed)

Here is some numbers where only filesrc, identity and fakesink are enabled:

lib (stripped) 1 2 3 4
ligstreamer-full.so 2337112 2341176 2250776 1793240
  1. before any mods in gst repos (except removing base and good from the build, see commit): build without -Dgstreamer:optimize-gc-sections=true -Dgst-full-elements=coreelements:filesrc,fakesink,identity in the meson command line.
  2. without element separation: build without -Dgstreamer:optimize-gc-sections=true -Dgst-full-elements=coreelements:filesrc,fakesink,identity in the meson command line.
  3. with element separation: build without -Dgstreamer:optimize-gc-sections=true
  4. Final build with command line above.
Edited by Stéphane Cerveau

Merge request reports