Commit graph

63 commits

Author SHA1 Message Date
Sebastian Dröge a022bbe260 Fix some new clippy warnings 2020-07-28 18:52:11 +03:00
Sebastian Dröge 9bb3e75fb9 Update to use the new pad builders for safely setting pad functions
Only two uses of unsafely setting the pad functions is left:
- fallbacksrc for overriding the chain function of the proxy pad of a
  ghost pad
- threadshare for overriding the pad functions after creationg, which
  probably needs some fixing at some point
2020-06-22 11:28:19 +03:00
François Laignel dfaf59a59b threadshare: simplify Pad{Src,Sink} implementations
Pad{Src,Sink}[Ref] delegate some functions to their respective
Pad{Src,Sink}Inner. Since they act as smart pointers, we can
safely implement the Deref trait to simplify the implementations.
2020-05-30 08:30:27 +00:00
François Laignel 244f6dd6f7 threadshare: fix Transition naming 2020-05-25 18:31:49 +02:00
François Laignel 725eb0a093 threadshare: spawn StateMachine on the futures::executor::ThreadPool
StateMachines are spawned on a runtime::Context which uses a tokio
runtime. The StateMachine doesn't need all the features from tokio
such as the IO and timers drivers.

This commit makes use of a light-weight futures executor to spawn
the StateMachines.
2020-05-25 18:31:49 +02:00
François Laignel f0793587f6 threadshare/TaskImpl: allow transition hooks to fail...
... and add error handlers for iterate and transitions hooks with
default implementation.
2020-05-25 18:31:49 +02:00
François Laignel 5c9bbc6818 threadshare: Task: reduce memory usage
Using dynamic dispatch instead of monomorphization reduces the lib size
and memory use without affecting CPU nor throughput significantly.
2020-05-25 18:31:49 +02:00
François Laignel 1bea2ad279 threadshare: introduce TaskImpl trait
TaskImpl is the trait for specific Task behaviour. It is the basis
of a new Task model. The main motivation for this model is to ease
threadsafe implementations of state transitions.

See https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/298
2020-05-25 18:31:48 +02:00
François Laignel 8e38d861b4 threadshare: save upgrade in Pad functions
When initializing Pad functions in `Pad{Src,Sink}`, we downgrade the
`Pad{Src,Sink}` and upgrade it when necessary. This was implemented
to avoid reference cycles:

`gst::Pad` -> pad function -> `Pad{Src,Sink}` -> `gst::Pad`.

Since `Pad{Src,Sink}` reset the pad functions when dropping, there is
no cycles, so we can use an `Arc<Pad{Src,Sink}>` in the pad functions,
thus saving an `upgrade`.
2020-04-29 16:10:19 +02:00
François Laignel 26634f591a threadshare: build Pad{Src,Sink} with handlers
Handlers for `Pad{Src,Sink}` are assigned when `prepare` is called
which prevents them from handling pre-prepare queries.

See https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/issues/247
2020-04-29 16:08:16 +02:00
Sebastian Dröge 5a7fcfad7f Fix various new clippy warnings with clippy 1.43 2020-04-24 13:55:01 +03:00
Sebastian Dröge 5ad93604ef threadshare: Call gst::init() in all tests 2020-04-13 15:00:27 +03:00
Arun Raghavan dc3c8fd049 Drop gst-plugin- prefix in plugin directory name 2020-04-05 19:10:47 +00:00