Commit graph

54 commits

Author SHA1 Message Date
Sebastian Dröge a8250abbf1 Fix various new clippy warnings 2022-11-01 10:27:48 +02:00
François Laignel 5ca033049e ts/pad: use gst::Pad in handlers trait functions...
... instead of the `Pad{Src,Sink}Ref` wrappers:

- In practice, only the `gst::Pad` is useful in these functions.
  Some of these which need a `Pad{Src,Sink}Ref`, but it's the one
  for the opposite stream direction. In those cases, it is accessed
  via the element's implementation.
- It saves a few `clone`s.
- The implementations usually use the `gst::Pad` for logging.
  They no longer need to access it via `pad.gst_pad()`.
2022-10-24 13:15:13 +02:00
François Laignel 554ce7e7d6 ts/pad: don't pass self as ref in remaining handler traits functions
- They are either unit types or `Clone` (in which case they are implemented
  as pointers).
- Internally, we already use an owned version, so there's no need to get a
  reference.
- It facilitates implementation if the handler must be moved into a closure
  or a `Future`.
2022-10-24 12:01:09 +02:00
Sebastian Dröge 9a68f6e221 Move from imp.instance() to imp.obj()
It's doing the same thing and is shorter.
2022-10-23 23:08:46 +03:00
François Laignel 86776be58c Remove & for obj in log macros
This is no longer necessary.

See https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1137
2022-10-23 21:22:31 +02:00
Sebastian Dröge f045099fc1 Fix GObject type names, GStreamer debug category names and element factory names
Fixes https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/issues/198
2022-10-23 20:46:08 +03:00
François Laignel 2bffdec691 ts: better use of imp & elem args in Pad{Sink,Src}Handlers
This is a follow-up to commit 7ee4afac.

This commit cleans up the `Pad{Sink,Src}Handler` by

- Keeping arguments which are strictly necessary.
- Passing arguments by value for the trait functions which return
  a `Future`. The arguments which were previously passed by reference
  were `clone`d internally and then `clone`d again in most
  implementations.

There are unfortunate differences in trait function signatures
between those which return a `Future` and the sync functions. This
is due to the requirement for the arguments to be moved to the
resulting `Future`, whereas sync functions can rely on references.
One particular notable difference is the use of the `imp` in sync
functions instead of the `elem` in functions returning a `Future`.
Because the `imp` is not guaranteed to implement `Clone`, we can't
move it to the resulting `Future`, so the `elem` is used.
2022-10-12 12:35:20 +02:00
Sebastian Dröge 7ee4afacf4 Change *Impl trait methods to only take &self and not Self::Type in addition 2022-10-10 15:03:25 +03:00
Sebastian Dröge 4c57a97d4d Update for glib::Object::new() API changes 2022-10-07 23:54:53 +03:00
Mathieu Duponchelle 18f08ae5dc jitterbuffer: fix typo when calculating max_misorder_time 2022-09-21 16:02:54 +02:00
Mac Thi Kieu Van 98fc0d5bd6 ts-jitterbuffer: Declare request-pt-map signal 2022-09-21 11:31:06 +00:00
François Laignel 61c62ee1e8 ts/timers: multiple improvements
This commit improves threadshare timers predictability
by better making use of current time slice.

Added a dedicate timer BTreeMap for after timers (those
that are guaranteed to fire no sooner than the expected
instant) so as to avoid previous workaround which added
half the max throttling duration. These timers can now
be checked against the reactor processing instant.

Oneshot timers only need to be polled as `Future`s when
intervals are `Stream`s. This also reduces the size for
oneshot timers and make user call `next` on intervals.
Intervals can also implement `FusedStream`, which can help
when used in features such as `select!`.

Also drop the `time` module, which was kepts for
compatibility when the `executor` was migrated from tokio
based to smol-like.
2022-09-13 07:29:50 +00:00
François Laignel 2355be1cef ts/jitterbuffer: extra robustness for Windows CI
jitterbuffer tests crash on Windows CI sometimes. Activating logs
showed time values which are probably not expected in a regular
environment, but which can happen there. Adding extra robustness
to `next_wakeup` computation seems to fix the problem judging by
the few runs I triggered.
2022-09-12 18:42:34 +00:00
Sebastian Dröge 1a40186485 Update for GLib ParamSpec builder API changes 2022-09-05 11:45:47 +03:00
Thibault Saunier 664e2b75bd tsjitterbuffer: Fix latency type when getting property 2022-09-02 21:41:35 +00:00
Vivia Nikolaidou 5606111345 plugins: Simplify code using ParamSpecBuilder 2022-08-22 17:58:43 +03: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 fb7929dda6 ts: update elements for new TransitionStatus
See previous commit
2022-08-09 19:48:06 +02:00
Bilal Elmoussaoui 52973d975e Update per glib::SignalBuilder changes 2022-07-21 20:03:13 +02:00
Mathieu Duponchelle 943a138d49 ts-jitterbuffer: set jbuf delay when instantiating it
The internal (C) jitterbuffer needs to know about the configured
latency when calculating a PTS, as it otherwise may consider that
the packet is too late, trigger a resync and cause the element to
discard the packet altogether.

I could not identify when this was broken, but the net effect was
that in the current state, ts-jitterbuffer was discarding up to
half of all the incoming packets.
2022-05-11 06:29:22 +00:00
Sebastian Dröge 5af52f94a8 threadshare: Remove glib::SendUnique usage
It's being removed from the GLib bindings because it does not add much
value.
2022-04-09 08:41:58 +00:00
François Laignel 1ef9ae6398 ts/jitterbuffer: don't wake up immediately...
... when next wakeup delay is shorter than the max throttling duration.

See https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/issues/169
2022-03-28 08:47:32 +00:00
François Laignel 97985d6442 ts/examples: add rtp mode with jitter-buffer & trace stop duration 2022-03-28 08:47:32 +00:00
François Laignel 422ea740ca Update to gst::_log_macro_
See the details:
https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/980
2022-02-21 20:50:01 +01:00
Sebastian Dröge 65fcd55160 Update for event/message/query view API changes 2022-01-19 15:07:45 +02:00
Sebastian Dröge b2d0172422 Replace Foo::from_instance(foo) with foo.imp() 2022-01-17 19:36:41 +02:00
Sebastian Dröge 51f8e963d6 Add SPDX-License-Identifier to all file headers 2022-01-15 21:18:47 +02:00
François Laignel 6163589ac7 ts/executor: replace tokio with smol-like implementation
The threadshare executor was based on a modified version of tokio
which implemented the throttling strategy in the BasicScheduler.
Upstream tokio codebase has significantly diverged from what it
was when the throttling strategy was implemented making it hard
to follow. This means that we can hardly get updates from the
upstream project and when we cherry pick fixes, we can't reflect
the state of the project on our fork's version. As a consequence,
tools such as cargo-deny can't check for RUSTSEC fixes in our fork.

The smol ecosystem makes it quite easy to implement and maintain
a custom async executor. This MR imports the smol parts that
need modifications to comply with the threadshare model and implements
a throttling executor in place of the tokio fork.

Networking tokio specific types are replaced with Async wrappers
in the spirit of [smol-rs/async-io]. Note however that the Async
wrappers needed modifications in order to use the per thread
Reactor model. This means that higher level upstream networking
crates such as [async-net] can not be used with our Async
implementation.

Based on the example benchmark with ts-udpsrc, performances seem on par
with what we achieved using the tokio fork.

Fixes https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/issues/118

Related to https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/604
2021-12-25 11:25:56 +00:00
Sebastian Dröge c46901d150 Fix or silence various new 1.57 clippy warnings 2021-11-30 16:31:50 +02:00
Sebastian Dröge c68f6b2631 Update for GLib signal emit_by_name() API changes 2021-11-21 18:15:04 +02:00
Sebastian Dröge 55aad51141 Update for glib constructor renames
See https://github.com/gtk-rs/gtk-rs-core/pull/384
2021-11-20 14:31:06 +02:00
Bilal Elmoussaoui 82be7b3ac5 adapt to ObjectExt improvements 2021-11-08 14:43:53 +02:00
Sebastian Dröge d9bda62a47 Update for GLib/GStreamer API changes
And clean up a lot of related property/caps/structure code.
2021-11-06 09:34:10 +02:00
Sebastian Dröge b9541b2ca4 Update for GstObjectImpl API change 2021-10-23 12:31:33 +03:00
François Laignel 27b9f0d868 Improve usability thanks to opt-ops
The crate option-operations simplifies usage when dealing with
`Option`s, which is often the case with `ClockTime`.
2021-10-18 15:09:47 +02:00
Sebastian Dröge 052365ba1a Fix various needless-borrow clippy warnings and others 2021-07-30 13:53:35 +03:00
François Laignel 5439f14e57 fix clippy warnings 2021-06-05 10:36:22 +02:00
François Laignel 8f81cb8812 generic: migrate to new ClockTime design 2021-06-05 10:36:21 +02:00
François Laignel 8dfc872544 use gst::glib where applicable 2021-06-03 20:53:16 +02:00
Sebastian Dröge 15cf738616 Update for Value trait refactoring 2021-04-25 15:48:55 +03:00
François Laignel 67c5871957 fix-getters-calls 0.3.0 pass 2021-04-20 18:19:58 +02:00
François Laignel 27bc5c89ca fix-getters-def 0.3.0 pass 2021-04-20 18:19:58 +02:00
François Laignel 7d17f88941 post fix-getters manual updates 2021-04-13 17:24:20 +02:00
François Laignel 06accc8d98 fix-getters-{def,calls} pass 2021-04-12 15:57:19 +02:00
Sebastian Dröge 2cada57efc Update for the subclassing glib/gstreamer bindings API changes 2021-03-09 17:07:13 +02:00
Sebastian Dröge dc0c5f7611 Update for new #[glib::object_subclass] attribute macro 2021-03-07 18:27:00 +02:00
Sebastian Dröge 5dd0a23986 threadshare: Update for glib::Type API changes 2021-02-25 13:12:12 +02:00
Sebastian Dröge 0616c18703 Update for changed GLib signals API 2021-02-22 17:20:40 +02:00
Sebastian Dröge d4ce1a33f2 Update for glib/gstreamer bindings API changes 2021-01-25 14:43:05 +02:00
Sebastian Dröge 3d617371af Update for macro renames 2020-12-20 20:43:45 +02:00