Manually dropping video frame in element

Sebastian Dröge sebastian at centricular.com
Wed Jan 20 16:05:31 UTC 2021


On Tue, 2021-01-19 at 16:32 -0800, Ryan Brigden wrote:
> 
> I found this issue [2] on the gstreamer-rs gitlab repo to exactly
> describe this double invocation of the meta registration (despite
> having been declared as `Lazy`).

It's the standard static linking problem where the same code is
included twice in the resulting application.

The solution has to be to move this code into some kind of shared
library.

> @slomo mentioned a possible solution (if I understand its
> implications
> correctly) is to put the `imp` module in the official example [3]
> into
> a separate cdylib and then copy over the wrapper code into each place
> the custom meta is to be used -- in my case this would be in both the
> crate invoking the pipeline and the crate with the plugin.

You can also move the wrapper code into a separate crate instead of
copying it. The important part is that the meta implementation must be
in a shared library and only used through that.

It should also be possible to have cargo build the crate defining the
meta implementation into a shared Rust library, but the tooling for
that is rather suboptimal and you'll run into all kinds of interesting
problems unless you build that crate and all users of it as part of the
same cargo workspace.

> example[3]). Unfortunately I can't seem to get the linking to work in
> this case.

How does it fail and is your code or a testcase available somewhere?

> Does anyone have a suggestion for a simpler way to accomplish a
> shared CustomMetaAPI in Rust? It seems... not great to have to
> duplicate the wrapper code or keep it in a separate crate as the ffi.

Think of the wrapper code as bindings to your meta implementation that
is provided by a shared library with a C API :) The wrapper code would
live in its own bindings crate, just like gstreamer-rs currently. And
the implementation of the meta would be a separate project.

-- 
Sebastian Dröge, Centricular Ltd · https://www.centricular.com




More information about the gstreamer-devel mailing list