Commit graph

2218 commits

Author SHA1 Message Date
Thibault Saunier
dbcbfef8c7 Refactor signalling protocol around a Session ID
This allows for more use cases to be handled like having several session
between 2 peers, and it simplifies the code a bit and makes the protocol
sensibly cleaner

Webrtcsink has been refactored a bit to take the new concept into
account
2022-08-30 22:28:55 +02:00
Thibault Saunier
f243f5fe5c protocol: Add an "Unregister" message type
This way we can use the same WebSocket where several peerTypes being
communicated and some those type can be unregistered, re registered
without ever closing the Socket connection.

This also introduces sensible symmetry between different message types.
2022-08-30 22:28:55 +02:00
Thibault Saunier
e391f1ef25 ci: Check that documentation is updated as required 2022-08-29 18:33:22 -04:00
Thibault Saunier
16d804e761 doc: Mark request::user-agent as doc show default 2022-08-29 18:33:22 -04:00
Thibault Saunier
67e651f57c Allow "unused_doc_comments" as we use hotdoc and not rustdoc 2022-08-29 18:33:22 -04:00
Thibault Saunier
31a53bba8a Generate plugins documentation using hotdoc
Which will automatically be integrated in gstreamer documentation
2022-08-29 18:33:22 -04:00
Thibault Saunier
25465fd9f3 csound: Fix score-offset getter
Name of the property was wrong
2022-08-29 15:29:17 -04:00
Mathieu Duponchelle
052092cd2e onvifmetadata: removing encoding field
The encoding of ONVIF metadata is always UTF-8. ONVIF metadata may
or may not be encoded with gzip, but we don't see a use case for
transporting compressed ONVIF metadata between elements for now.
2022-08-24 08:57:12 +00:00
Arun Raghavan
56e7a2f6ab aws: Document the s3hlssink element in README 2022-08-23 06:19:39 -04:00
Guillaume Desmottes
b5d5cf25fe textahead: generate a buffer with ahead text at segment start
This is useful for karaoke use cases where the first text may appear
after a while but you want to already display the upcoming lyrics to
users.
2022-08-23 08:37:33 +02:00
Vivia Nikolaidou
5606111345 plugins: Simplify code using ParamSpecBuilder 2022-08-22 17:58:43 +03:00
Sebastian Dröge
84f6484140 fmp4mux: Consider invalid running times as zero and before anything else
The code tried to do this before but didn't consider the case where the
first pad has a valid running time, in which case the buffer with the
invalid running time would never be dequeued and the muxer would never
output anything.
2022-08-22 15:20:10 +03:00
Thibault Saunier
2dc42ba0db webrtcsink: Fix the way we handle max-bitrate
Computation of actual max bitrate was broken and in the end it is simpler
to keep the value set by the user and take into account the fec only
when required.
2022-08-20 00:27:23 +02:00
Thibault Saunier
e0ad7e4c16 Update dependencies using the new Signall::builder API 2022-08-18 22:58:15 +02:00
François Laignel
2bb071a950 ts/runtime: slight optimizations for sub tasks related operations
Using callgrind with the standalone test showed opportunities for
improvements for sub tasks addition and drain.

All sub task additions were performed after making sure we were
operating on a Context Task. The Context and Task were checked
again when adding the sub task.

Draining sub tasks was perfomed in a loop on every call places,
checking whether there were remaining sub tasks first. This
commit implements the loop and checks directly in
`executor::Task::drain_subtasks`, saving one `Mutex` lock and
one `thread_local` access per iteration when there are sub
tasks to drain.

The `PadSink` functions wrapper were performing redundant checks
on the `Context` presence and were adding the delayed Future only
when there were already sub tasks.
2022-08-18 18:42:18 +02:00
François Laignel
57da8e649d ts/examples: introduce a standalone pipeline test
Implement a test that initializes pipelines with minimalistic
theadshare src and sink. This can help with the evaluation of
changes to the threadshare runtime or with element
implementation details. It makes it easy to run flamegraph or
callgrind and to focus on the threadshare runtime overhead.
2022-08-18 18:42:18 +02:00
Sebastian Dröge
374bb8323f Fix build after glib SignalBuilder::param_types() API change 2022-08-17 23:37:39 +03:00
Sebastian Dröge
2c99f66ea5 fmp4mux: Dequeue the earliest buffer from any pad first instead of dequeueing up to a whole fragment from the same pad
This keeps the fill levels of each sinkpad in sync.
2022-08-17 19:23:18 +03:00
Thibault Saunier
c0c0d42d9a webrtcsink: Make GCC default 2022-08-17 17:56:00 +02:00
Sebastian Dröge
9827406113 onvifmetadataparse: Use NTP reference timestamp meta
The times are in the NTP epoch.
2022-08-16 15:51:32 +03:00
Sebastian Dröge
be56991b73 onvifmetadataparse: use NTP epoch everywhere instead of mixing UNIX/NTP epochs 2022-08-16 14:14:24 +03:00
Sebastian Dröge
23098a98ab deny: Update 2022-08-16 13:24:04 +03:00
Mathieu Duponchelle
3011764da1 onvifaggregator: refactor, expect parsed metadata
The aggregator was consuming meta buffers too greedily, causing
potential interleaving starvation upstream. Refactor to consume
media and meta buffers synchronously

Also expect parsed=true metadata caps (requiring an upstream
onvifmetadataparse element).
2022-08-16 12:28:52 +03:00
François Laignel
21da753607 ts/udpsink: move sync on buffer to try_next
By moving sync on buffer ts to `try_next`, the resulting delay
can be cancelled when a state transition occurs.

To prevent item loss, this requires first peeking the incoming
item from the channel without popping it. After the delay has
elasped, we can pop the item as the last await point in
`try_next`: either it will be cancelled before popping or the
popped item will be passed on to `handle_item`.

Also add `flush` which was missing from `stop` and `flush_start`
transition actions.
2022-08-13 13:03:43 +02:00
Sebastian Dröge
837126be76 onvifmetadataparse: Only define the namespace prefix once for the top-level element 2022-08-12 22:35:40 +03:00
Sebastian Dröge
b464e74d41 fmp4mux: Require parsed ONVIF timed metadata 2022-08-12 18:51:26 +03:00
Sebastian Dröge
e4081872c5 fmp4mux: Use UTC times from reference timestamp meta in ONVIF mode 2022-08-12 18:51:26 +03:00
Sebastian Dröge
5376596557 fmp4mux: Write ONVIF Export File Format CorrectStartTime box for ONVIF variant 2022-08-12 18:51:06 +03:00
Sebastian Dröge
2b61d51e91 Remove unnecessary unsafe blocks for Buffer::as_ptr() 2022-08-12 18:12:22 +03:00
Sebastian Dröge
35b42b88d9 onvif: Add onvifmetadataparse element
This splits XML metadata into separate frames and ensures properly
timestamped metadata.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/781>
2022-08-12 14:00:27 +00:00
Sebastian Dröge
ef7ed2d953 fmp4mux: Remove obsolete #[allow(clippy::too_many_arguments)] 2022-08-12 10:06:10 +03:00
Sebastian Dröge
2a54d57968 tracers: queue_levels.py: cycle colors
Fix crash when drawing more dataset than the number of colors.
2022-08-11 09:34:46 +00:00
François Laignel
33e601d33e ts: migrate elements to try_next / handle_item
See previous commit for details.

Also switched to panicking for some programming errors.
2022-08-10 20:10:08 +02:00
François Laignel
8b54c3fed6 ts/Task: split iterate into try_next and handle_item
Previous Task iteration model suffered from the following
shortcomings:

- When an iteration was engaged it could be cancelled at
  await points by Stop or Flush state transitions,
  which could lead to inconsistent states.
- When an iteration was engaged it could not be cancelled
  by a Pause state transition so as to prevent data loss.
  This meant we couldn't block on the Pause request because
  the mechanism couldn't guarantee Paused would be reached
  in a timely manner.

This commit split the Task iteration into:

- `try_next`: this function returns a future that awaits
  for a new iteration to begin. The regular use case is
  to return an item to process. The item can be left to
  `()` if `try_next` acts as a tick generator. It can
  also return an error. This function can be cancelled at
  await points when a state transition request occurs.
- `handle_item`: this function is called with the item
  returned by `try_next` and is guaranteed to run to
  completion even if a transition request is received.

Note that this model plays well with the common Future
cancellation pitfalls in Rust.
2022-08-10 20:02:53 +02:00
Vivia Nikolaidou
07cbc2f025 audio, video: Use AudioCapsBuilder::new_interleaved where applicable
Further code simplification
2022-08-10 11:18:18 +00:00
Sebastian Dröge
bdaa39e267 threadshare: Fix some new clippy beta warnings
warning: this expression borrows a value the compiler would automatically borrow
   --> generic/threadshare/src/runtime/executor/async_wrapper.rs:402:19
    |
402 |             match (&mut *self).get_mut().read(buf) {
    |                   ^^^^^^^^^^^^ help: change this to: `(*self)`
    |
    = note: `#[warn(clippy::needless_borrow)]` on by default
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
2022-08-10 12:58:28 +03:00
Vivia Nikolaidou
8ee8ae581a audio: Use gst_audio::AudioCapsBuilder in some plugins
Simplify caps creation codes
2022-08-09 22:01:10 +03:00
Vivia Nikolaidou
247702b76d video: Use gst_video::VideoCapsBuilder in some plugins
Simplify caps creation codes
2022-08-09 22:01:10 +03:00
François Laignel
fb7929dda6 ts: update elements for new TransitionStatus
See previous commit
2022-08-09 19:48:06 +02:00
François Laignel
d4061774a4 ts/Task: return a future for state transitions
State transitions request functions hid the synchronization
details to the caller:

- If the transition was requested from a Context, a subtask was
  added or the transition ack was not awaited if the new transition
  was requested from a running transition or an iteration function.
- If the transition was not requested from a Context, current
  thread was blocked until the ack was received.

This strategy facilitated code in elements, but it suffered from
the following shortcomings:

- The `prepare` transition request didn't comply with the above
  strategy and would always return an `Async` form. This was
  designed to accomodate the `Prepare` function for elements
  such as `ts-tcpclientsrc` which takes times due to the
  TCP socket connection delays. The idea was that the actual
  transition result would be available after calling `start`.
  This was a disadvantage for elements which would prefer to
  error immediately in the event of a preparation failure.
- Hidding the transition request synchronization to the caller
  meant that they had no options but relying on the internal
  mechanism. E.g.: it was not possible to `start` from another
  async runtime without blocking. Also it was not possible
  to request a transition and choose not to await for the
  ack.

This commit introduces a more flexible API for state
transitions requests:

- The transition request function now return a `TransitionStatus`,
  which is a Future.
- When an error occurs immediately (e.g. the transition
  request is not autorized due to current state of the Task),
  the `TransitionStatus` is resolved immediately and can be
  `check`ed for errors. This is useful for functions such as
  `pepare` in the case of `ts-tcpclientsrc` (see above).
  This is also useful for `pause`, because in current design,
  the transition is always async. Note however, that `pause` is
  forseen to adhere to the same behaviour as the other transition
  requests in the near future [1].
- If the caller chooses to await for the ack and they don't know
  if they are running on a ts Context (e.g. in `Pad{Src,Sink}`
  handlers), they can call `await_maybe_on_context`. This is mostly
  the same behaviour as the one that used to be performed internaly.
- If the caller knows for sure they can't possibly block an async
  executor, they can call `block_on` which is more explicite, but
  will nonetheless make sure no ts Context is being blocked. This
  last check was introduced as it was considered low overhead
  while it should ease preventing missues in cases where the above
  functions should be used.

[1]: https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/793#note_1464400
2022-08-09 19:48:06 +02:00
François Laignel
625fce3934 ts/Task: spawn StateMachine on ts Context
Task state machines used to execute in an executor from the Futures
crate. State transitions actions and iteration functions were then
spawned on the target threadshare Context.

This commit directly spawns the task state machine on the threadshare
Context. This simplifies code a bit and paves the way for the changes
described in [1].

Also introduces struct `StateMachineHandle`, which gather together
fields to communicate and synchronize with the StateMachine. Renamed
`StateMachine::run` as `spawn` and return `StateMachineHandle`.

[1]: https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/793#note_1464400
2022-08-09 19:48:06 +02:00
François Laignel
0858dfedb4 ts-udpsrc: align default port with C counterpart
... and also with the default settings for ts-udpsink.
2022-08-09 17:42:53 +02:00
Sebastian Dröge
05207cafea raptorq: Derive Eq for some more structs
warning: you are deriving `PartialEq` and can implement `Eq`
  --> net/raptorq/src/fecscheme.rs:13:24
   |
13 | #[derive(Clone, Debug, PartialEq)]
   |                        ^^^^^^^^^ help: consider deriving `Eq` as well: `PartialEq, Eq`
   |
   = note: `#[warn(clippy::derive_partial_eq_without_eq)]` on by default
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#derive_partial_eq_without_eq

warning: you are deriving `PartialEq` and can implement `Eq`
  --> net/raptorq/src/fecscheme.rs:38:24
   |
38 | #[derive(Clone, Debug, PartialEq)]
   |                        ^^^^^^^^^ help: consider deriving `Eq` as well: `PartialEq, Eq`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#derive_partial_eq_without_eq
2022-08-09 13:40:39 +00:00
Sebastian Dröge
cbb55c2322 hlssink3: Update to m3u8-rs 5 2022-08-09 13:40:39 +00:00
Sebastian Dröge
d058c96596 fmp4: Update to m3u8-rs 5 2022-08-09 13:40:39 +00:00
Sebastian Dröge
8b11aee04d aws: Update to aws 0.17/0.47 2022-08-09 13:40:39 +00:00
François Laignel
28a62e622e ts/scheduler: rename awake / wake_up as unpark 2022-08-09 13:17:21 +00:00
François Laignel
833331ab66 ts/Task: wake up after the triggering event is pushed
The scheduler is awaken when aborting a task loop, but not after
a triggering event is pushed. This can cause throttling to induce
long state transitions for pipelines with many streams.

Observed for Unprepare with:

GST_DEBUG=ts-benchmark:4 ../../target/debug/examples/benchmark 2000 ts-udpsrc 2 20 5000
2022-08-09 13:17:21 +00:00
François Laignel
374671cb6f ts/udpsink: fix default clients not leading to socket configuration
During MR !793, the socket configuration mechanism was changed to
use commands passed to the Task via a channel. This worked properly
for user changes via settings and signals, however the default
clients setting was not used.

A simple solution could have been to send a command at initialization
to add the default clients, but it was considered a better solution
to just wait for the Task preparation to configure the sockets based
on the value of settings.clients at that time, thus avoiding
unnecessary successive removals and additions of clients which could
have happened before preparation.

Of course, users can still add or remove clients as before, before
and after Task preparation.

See also https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/793
2022-08-09 12:43:36 +00:00
Mathieu Duponchelle
f646cabb3d aws_transcriber: expose filtering related properties
- vocabulary-filter-name allows picking a vocabulary to filter words
- vocabulary-filter-method allows controlling how words are filtered
2022-08-09 12:14:31 +00:00