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.
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
* 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.
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.
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.
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.
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)