Commit graph

755 commits

Author SHA1 Message Date
Sebastian Dröge
4c0ba5c374 threadshare/inputselector: Query all sinkpads for their latency and post latency messages when the pads change 2020-03-19 11:37:27 +02:00
Mathieu Duponchelle
c01ef0e774 threadshare/inputselector: port to new API 2020-03-19 11:37:27 +02:00
Sebastian Dröge
ad4597a40e threadshare/inputselector: Set DISCONT flag on first buffer after each pad switch 2020-03-19 11:37:25 +02:00
Sebastian Dröge
625798c5db threadshare/inputselector: Fix sticky event handling
Whenever a new sticky event arrives we must make sure to forward it
downstream before the next buffer.

Also make sure to unlock all our mutexes when they're not needed
anymore.
2020-03-19 11:37:22 +02:00
Sebastian Dröge
6c4108671f threadshare/inputselector: Implement a correct chain_list() function
Instead of directly forwarding the list, handle each buffer separately
for now. Previously we would directly forward the lists from any pad,
including inactive ones, downstream.
2020-03-19 11:37:18 +02:00
Mathieu Duponchelle
0b240b829e threadshare/inputselector: fix tearing down
GstElementClass.release_pad() may be called after the element
has transitioned back to NULL, we need to keep our sink_pads
map around until then.

They should also not be affected by state transitions at all but only be
removed once the user does so or the element is destroyed, so they need
to live independent of the state.
2020-03-19 11:20:24 +02:00
Sebastian Dröge
575efcab7e threadshare/inputselector: Port to latest API 2020-03-19 11:20:24 +02:00
Mathieu Duponchelle
b3becb01c3 threadshare: New input selector element 2020-03-19 11:20:24 +02:00
Sebastian Dröge
cbfd80d75f Update for new GLib boxed deriving API 2020-03-19 11:18:17 +02:00
Sebastian Dröge
56895f35bc threadshare/runtime: Add a dummy context when blocking the current thread
This allows downstreams to function as if a normal context thread is
operating upstream apart from not being able to spawn new tasks.

Fixes https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/issues/96
2020-03-16 15:19:39 +02:00
Sebastian Dröge
12dcca3f17 threadshare/runtime: Drain pending sub tasks in a loop
A pending sub task might add new pending sub tasks that have to be
handled first.
2020-03-16 15:02:30 +02:00
Sebastian Dröge
fa7cc9826d appsrc: Don't make pushing of buffers/eos asynchronous
We can directly use try_send(), which has the same effect.
2020-03-16 15:01:06 +02:00
Sebastian Dröge
d2ad227a2f threadshare/udpsink: Some more refactoring
Let's take locks less often.
2020-03-16 12:42:33 +02:00
Sebastian Dröge
85cbbf5240 threadshare/udpsink: Properly remove clients
Leave any multicast groups they might have joined.
2020-03-16 12:33:18 +02:00
Sebastian Dröge
ac574cd112 threadshare/udpsink: Minor cleanup / optimizations for client addition 2020-03-16 12:31:41 +02:00
Sebastian Dröge
9ddcae4ed2 threadshare: Fix some clippy warnings 2020-03-15 13:40:45 +02:00
François Laignel
bfedca6cfe threadshare/proxy: Port proxysrc/sink to new API 2020-03-15 13:18:02 +02:00
Mathieu Duponchelle
5f9e923a04 threadshare/jitterbuffer: Avoid buffer copies
Replaces the RTPJitterBufferItem.get_buffer() method with an
into_buffer() version, ensuring that when we make it mutable we
don't make a copy (unless necessary)
2020-03-15 13:18:02 +02:00
Sebastian Dröge
776708bee6 threadshare/jitterbuffer: Port jitterbuffer to new API and completely refactor 2020-03-15 13:17:59 +02:00
François Laignel
95b2641056 threadshare/queue: Port queue to the new API 2020-03-15 13:17:26 +02:00
Sebastian Dröge
ded3af31c1 threadshare/tcpclientsrc: Port tcpclientsrc to new API 2020-03-15 13:17:26 +02:00
Mathieu Duponchelle
5f5f0fe866 threadshare/udpsink: Port udpsink to new API 2020-03-15 13:17:26 +02:00
François Laignel
d9cd48287e threadshare/appsrc: Port appsrc to new API 2020-03-15 13:17:26 +02:00
Sebastian Dröge
f5eb91ebe2 threadshare/udpsrc: Port udpsrc to new API 2020-03-15 13:17:26 +02:00
François Laignel
4c584fd162 threadshare: Pad{Src,Sink}::unprepare: release all functions 2020-03-15 13:17:26 +02:00
Sebastian Dröge
e729324cce threadshare: Refactor infrastructure
The biggest changes are
- Many functions are not asynchronous anymore as it would be difficult
  to run them correctly with our mix of synchronous C code and Rust
  code.
- The pad context and its corresponding custom event are gone and
  instead thread local storage and task local storage are used. This
  makes it easier to correctly pass it through the different layers
  of Rust and C code and back.
- Sink events have a different function for serialized and oob events,
  src events are handled correctly by default now by simply forwarding
  them.
- Task::prepare() has a separate variant that takes a preparation
  function as this is a very common task.
- The task loop function can signal via its return value if it wants to
  be called again or not.
2020-03-15 13:17:26 +02:00
Sebastian Dröge
3ea465907d threadshare: Disable all elements for now 2020-03-15 13:17:26 +02:00
Mathieu Duponchelle
03fda100d4 threadshare/udpsink: pass correct defaults to v6 bind properties 2020-03-15 12:38:20 +02:00
Mathieu Duponchelle
bcbf862ded threadshare/udpsink: don't error out when socket can't be prepared for protocol
Instead, error out at chain time if a client with the unavailable
protocol (eg IPv6) has been added.
2020-03-15 12:38:20 +02:00
Sebastian Dröge
b8f8705c47 threadshare/udpsink: Add Element::send_event() impl and handle latency event
We need to add the latency to the running time we're waiting for, and
also should push all upstream events (apart from Step events) upstream.
2020-03-15 12:38:20 +02:00
Sebastian Dröge
160ae4d11c threadshare/udpsink: Port to latest API 2020-03-15 12:38:20 +02:00
Mathieu Duponchelle
382b9f118c threadshare: Initial version of a UDP sink 2020-03-15 12:38:20 +02:00
Sebastian Dröge
4c27d560a9 closedcaption: Add libcaption based CEA-608 to SRT/WebVTT converter 2020-03-07 11:20:19 +02:00
Sebastian Dröge
9202e8fddd tutorial: Update for Caps API changes 2020-03-07 00:56:35 +02:00
Sebastian Dröge
af56755aaa Revert "threadshare: Temporarily pin quote to 1.0.2"
This reverts commit 90b9499909.

It was fixed in the meantime.
2020-03-06 11:16:37 +02:00
Philippe Normand
90b9499909 threadshare: Temporarily pin quote to 1.0.2
See https://github.com/rust-lang-nursery/failure/issues/342

https://gitlab.freedesktop.org/gstreamer/gst-build/issues/83
2020-03-05 13:10:52 +00:00
Mathieu Duponchelle
9e665ae807 ts-jitterbuffer: fix request-pt-map emission
When a new payload type is encountered, we first check whether
it matches the caps received as an event before emitting the
request-pt-map signal if not, which means we shouldn't consider
errors from the first call to parse_caps as fatal.
2020-03-04 17:30:01 +01:00
Sebastian Dröge
e5e29b18d1 threadshare/rtpjitterbuffer: Use different GType names than used by the C rtpjitterbuffer
Otherwise there are conflicts when using them both in the same process.
2020-03-04 15:08:59 +00:00
Mathieu Duponchelle
1bfa20a656 ts-jitterbuffer: reset on unprepare
.. and reset earliest_pts in reset()
2020-03-04 15:13:41 +01:00
François Laignel
c60c6f0dc6 ts: use tag tokio-0.2.12-throttling 2020-02-28 16:05:48 +01:00
Stéphane Cerveau
1c7f9041e0 meson: update cargo to minimum 1.40 2020-02-25 13:44:46 +01:00
Markus Ebner
750b29b76c gif: Add initial implementation of a gif encoder
- Implemented a simple gif encoder based on the rust crate "gif".
- Currently supported input pixel formats are RGB and RGBA
- The encoder dynamically changes frame delays to approximate the actual
  input framerate
- For the moment, each frame uses its own local colorpalette, leading to
  good image quality, but big files
- Every frame is currently a full frame. No incremental frames for now
- The produced GIF is currently compressed (LZW)
2020-02-25 08:45:22 +00:00
Sebastian Dröge
4dac77bb93 Fix some clippy warnings 2020-02-25 10:12:55 +02:00
Sebastian Dröge
d58cdc41b7 Require Rust 1.40 for the CI
At least one dependency of one plugin uses 1.40 features now.
2020-02-25 10:10:13 +02:00
Mathieu Duponchelle
49f73fbf61 proxy: fix items mistakenly discarded
When emptying the pending queue, we need to break as soon as
as we failed to push an item to the data queue, otherwise only
the last failed item is pushed back to the front of the pending
queue, and all the previously failed items in the loop get
discarded
2020-02-05 21:35:12 +01:00
Mathieu Duponchelle
bcae2423f5 proxy: signal the pending queue in ProxySrc.start()
If the proxy sink has already queued buffers in the shared
context pending queue and is waiting for space in the data
queue, we should signal that space is available when creating
it!
2020-02-05 21:35:12 +01:00
Mathieu Duponchelle
53e948b8da proxy: fix blocking upwards state change
ProxySink previously blocked on receiving the source pad
of ProxySrc in its ReadyToPaused transition, which meant
ProxySrc had to transition to Ready at the same time.

The usual use case is for the source and sink to reside in
two separate pipelines, and such an arrangement easily led
to deadlocks, as examplified by the new test case.

Instead we now maintain two more global hash maps holding
per-context sink pads and src pads weak references, and
forward events to those when needed.

As ProxySink may not have a source pad context to run
a future on when receiving FlushStart, gst::Element::call_async
is used instead, with a simple oneshot channel used to synchronize
flush start and flush stop handling.
2020-02-05 21:35:11 +01:00
Mathieu Duponchelle
4abb389269 socket based sources: close socket stream on unprepare
the socket was otherwise leaked
2020-02-04 20:09:27 +01:00
Guillaume Desmottes
90cb42fdf9 meson: check for openssl on not Windows/Mac platforms 2020-01-30 10:57:00 +00:00
Guillaume Desmottes
1b84dd1f6b meson: add sodium option
Allow us to pick between the built-in libsodium, use the one from the
system or disable the plugin.
2020-01-30 10:57:00 +00:00