Commit graph

1078 commits

Author SHA1 Message Date
Sebastian Dröge
bbf800f17f Update for gstreamer bindings API changes 2020-04-02 20:29:18 +03:00
Sebastian Dröge
9cdf09d106 threadshare/udpsink: Unconfigure all clients that are removed on clear()
Fixes https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/issues/101
2020-04-02 19:42:00 +03:00
Sebastian Dröge
3f05e448d7 audioloudnorm: Allow more than 2 channels
There's no limitation of the number of channels in the code, so allow
more in the caps too.
2020-04-02 17:01:33 +03:00
Sebastian Dröge
ba7186aa6e audioloudnorm: Fix some outdated comments 2020-04-02 16:01:27 +03:00
Sebastian Dröge
65dc7cc0eb audioloudnorm: Add some more tests
This covers the limiter too now and various other code paths that were
previously not covered. No new bugs found.
2020-04-02 14:53:38 +03:00
Sebastian Dröge
6c4aadee4e csound: Use gst-plugin-version-helper from this repository by path 2020-04-02 13:35:25 +03:00
Sebastian Dröge
666ec7d54d audiofx: Add audioloudnorm filter based on the ffmpeg af_loudnorm filter
This normalizes the loudness of an audio stream to a target loudness
with a given maximum peak based on EBU R128.

Conceptually it keeps a 3s lookahead for calculating the perceived
loudness and based on that calculates the gain required to reach the
target loudness. The calculated gains then go through a gaussian filter
for smoothening and are then applied to the audio in 100ms blocks. Each
of the 100ms blocks is then passed to a limiter filter to prevent going
above the maximum peak.

See http://k.ylo.ph/2016/04/04/loudnorm.html for some more details about
the algorithm.

It introduces 3s of latency and currently only works on 192kHz audio.
Using it with a different sample rate requires resampling before and
afterwards. The upsampling is required to calculate the true peak.

Other than the ffmpeg filter it currently does not support two-pass
processing but only one-pass/live processing.

Compared to the ffmpeg filter this code was refactored considerably and
the limiter implementation was fixed to actually work, as well as
various other bugs in different places that were fixed.
2020-04-01 23:55:48 +03:00
Guillaume Desmottes
4bfd1f76f3 threadshare: fix GstClockTime formatting
GstClockTime is a guint64 whose format is platform dependent.
2020-04-01 15:02:54 +02:00
Brian Gonzalez
e0695b637f Fall back to default unknown COMMIT_ID and BUILD_REL_DATE if unable to find commit in repo 2020-03-29 20:54:56 -04:00
Natanael Mojica
888f98e2f0 use the latest release of csound-rs bindings 2020-03-28 11:33:34 +00:00
François Laignel
20a9eba4c8 threadshare: separate Task from PadSrc 2020-03-27 19:57:39 +01:00
François Laignel
89682aa6a8 threadshare/jitterbuffer: fix a race condition when stopping
Don't hold the `state` while stopping as the task might attempt to
lock it before reaching an `await` point.
2020-03-27 19:35:25 +01:00
Sebastian Dröge
bb6ec76951 Fix/silence some clippy warnings 2020-03-26 10:59:43 +02:00
Mathieu Duponchelle
800d3435eb closedcaption: implement tttocea608 element 2020-03-24 21:24:03 +01:00
Natanael Mojica
cf59318ab4 Add csound-based filter plugin 2020-03-22 13:44:40 +02:00
François Laignel
116cf9bd3c threadshare/*src: rework pause/flush_start/flush_stop
This commit fixes several issues with the `Ts*Src` elements.

The pause functions used cancel_task which breaks the Task loop at await
points. For some elements, this implies making sure no item is being lost.
Moreover, cancelling the Task also cancels downstream processing, which
makes it difficult to ensure elements can handle all cases.

This commit reimplements Task::pause which allows completing the running
loop iteration before pausing the loop.

See https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/277#note_439529

In the Paused state, incoming items were rejected by TsAppSrc and DataQueue.

See https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/277#note_438455

- FlushStart must engage items rejection and cancel the Task.
- FlushStop must purge the internal stream & accept items again.

If the task was cancelled, `push_prelude` could set `need_initial_events`
to `true` when the events weren't actually pushed yet.

TsAppSrc used to renew its internal channel which could cause Buffer loss
when transitionning Playing -> Paused -> Playing.

See https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/issues/98
2020-03-21 18:46:03 +00:00
Mathieu Duponchelle
3c82f7d82e sccparse: fix timestamps
There is no reason to have the buffers' PTS start at 0
2020-03-21 01:26:41 +01:00
Mathieu Duponchelle
f271ac8f75 cea608tott: port to updated libcaption API 2020-03-21 01:26:28 +01:00
Mathieu Duponchelle
96cfcff4cf caption_frame_decode: rework API
* pop_on mode requires incrementing the frame timestamp until
  end_of_caption is encountered.

* caption_frame_decode now always updates the timestamp of the
  frame when the timestamp parameter != -1. This requires that callers
  only pass a valid timestamp when a new one is encountered, for
  example with SCC the timestamp at the start of the cue, then -1
  until the next new timestamp.

* A new enum member is added for the return value, LIBCAPTION_CLEAR.
  It allows the caller to determine that closed captions should not
  be displayed anymore, in order to finish the previous cue earlier
  than the start of the next cue.
2020-03-20 22:50:13 +01:00
Sebastian Dröge
09f332f31f reqwest: Don't use deprecated Error::description() anymore 2020-03-19 13:24:10 +02:00
Sebastian Dröge
5dd80e0706 Fix/silence various new clippy warnings 2020-03-19 12:55:29 +02:00
Sebastian Dröge
cd2957679d Don't include gst-ci template
It disables all our other tests apparently.
2020-03-19 11:43:13 +02:00
Sebastian Dröge
dcf2befe52 threadshare/inputselector: Send a reconfigure event when the active pad changes 2020-03-19 11:37:27 +02:00
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