Commit graph

1025 commits

Author SHA1 Message Date
Arun Raghavan
d398d4a7dc rusoto: Upgrade to Rusoto 0.43
This moves to Rusoto 0.43, which has moved from futures to async/.await.
As a result, we implement a utility function to convert the
async/streaming bits to blocking operations backed by a tokio runtime.

In the process, we also need to restructure s3sink a little, so that the
client is now part of the started state (like it is for s3src). This is
a better model than a separate client, as it reflects the condition that
the client is only available in the started state.
2020-05-28 07:19:13 -04:00
Sebastian Dröge
65333d85ab transcribe: Update to rusoto 0.43 and async-tungstenite 0.5 2020-05-28 13:22:59 +03:00
François Laignel
04f85f6dbd threadshare: return false when Flush{Start,Stop} fails 2020-05-25 18:31:49 +02:00
François Laignel
244f6dd6f7 threadshare: fix Transition naming 2020-05-25 18:31:49 +02:00
François Laignel
725eb0a093 threadshare: spawn StateMachine on the futures::executor::ThreadPool
StateMachines are spawned on a runtime::Context which uses a tokio
runtime. The StateMachine doesn't need all the features from tokio
such as the IO and timers drivers.

This commit makes use of a light-weight futures executor to spawn
the StateMachines.
2020-05-25 18:31:49 +02:00
François Laignel
f0793587f6 threadshare/TaskImpl: allow transition hooks to fail...
... and add error handlers for iterate and transitions hooks with
default implementation.
2020-05-25 18:31:49 +02:00
François Laignel
5c9bbc6818 threadshare: Task: reduce memory usage
Using dynamic dispatch instead of monomorphization reduces the lib size
and memory use without affecting CPU nor throughput significantly.
2020-05-25 18:31:49 +02:00
François Laignel
1bea2ad279 threadshare: introduce TaskImpl trait
TaskImpl is the trait for specific Task behaviour. It is the basis
of a new Task model. The main motivation for this model is to ease
threadsafe implementations of state transitions.

See https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/298
2020-05-25 18:31:48 +02:00
Sebastian Dröge
b3138ad041 utils/fallbacksrc: Schedule another timeout after the last buffering activity
If we switch to the fallback stream but the last buffering activity was
less than $timeout ago, we shouldn't restart the source yet but wait a
bit longer. However for that we actually need to schedule another
timeout, which was not happening before.

Fixes https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/issues/116
2020-05-21 11:45:28 +03:00
Sebastian Dröge
621907556d utils/fallbacksrc: Don't error out if we just reached 100% buffering when the timeout triggered
It will take a moment for the fallbackswitch to actually switch to the
main stream. So instead take into account the time since the last
buffering update even when we reached 100%, and don't reset that time
when reaching 100%.
2020-05-20 12:44:28 +03:00
Sebastian Dröge
ba161a146d utils/fallbacksrc: Set use-buffering=true on uridecodebin3 to actually get network buffering 2020-05-20 12:42:42 +03:00
Sebastian Dröge
c91e480f09 utils/fallbacksrc: Block all currently unblocked pads when receiving the stream collection
It might be a second stream collection that we receive at a later time,
and the previous pads would already be unblocked at that point. So block
all currently unblocked pads again and then adjust the offset
according to the new situation.

This fixes playback of various RTMP streams where usually we first get a
stream collection with only one of the two streams, and shortly
afterwards with both streams.
2020-05-20 12:13:25 +03:00
Sebastian Dröge
d50abd74a1 utils/fallbacksrc: Try unblocking pads if a pad was removed
Maybe now all pads we're waiting for were already removed or are ready.
2020-05-20 12:13:25 +03:00
Sebastian Dröge
026bbde403 utils/fallbacksrc: Also handle gap events like buffers for blocking pads 2020-05-20 12:13:25 +03:00
Sebastian Dröge
09c30d73f1 utils/fallbacksrc: Use StreamsSelected message instead of StreamCollection
We don't do any selection ourselves yet so work based on the selection
that uridecodebin does for us.
2020-05-20 12:13:25 +03:00
Sebastian Dröge
ed3ef5f741 utils/fallbacksrc: Add "source" property that allows to directly provide a source element
This works as an alternative to the "uri" property, which would use an
`uridecodebin3` element.

The provided source element can have static audio/video pads or provide
them as sometimes pad while signalling no-more-pads or a stream
collection message once all pads are available.
2020-05-20 07:24:57 +00:00
neithanmo
d130b29146 video/png: Add PNG encoder element
It can encode raw video formats like Gray8/16, RGB and RGBA and
uses the PNG crate which is a decoding and encoding library in pure Rust
2020-05-15 08:30:32 -06:00
Sebastian Dröge
36bcd54306 closedcaption/{scc,mcc}parse: Allow an optional UTF-8 BOM at the beginning
Some software is apparently writing an UTF-8 BOM at the beinning of the
file.
2020-05-13 10:10:45 +03:00
Sebastian Dröge
a4a0a669bd togglerecord: Set the DISCONT flag on the first buffer after recording starts
While continuous in time, each recording start will be a discontinuity
in audio/video content.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/336>
2020-05-08 22:39:05 +03:00
Sebastian Dröge
e1c3491915 togglerecord: Improve logging 2020-05-08 15:57:07 +03:00
Sebastian Dröge
56962b1273 rusoto/s3sink: Don't use mem::replace() for a simple assignment
The return value of mem::replace() would be the old value but we don't
really need that here, so simply do an assignment instead.
2020-05-08 11:23:03 +00:00
Sebastian Dröge
d4e9a56e54 fallbackswitch/fallbacksrc: Ignore errors when shutting down the source 2020-05-08 13:56:50 +03:00
Sebastian Dröge
b180517b29 fallbackswitch/fallbackswitch: Don't convert buffer PTS/DTS twice to running time
They were already converted to the running time a few lines above and
updated inside the buffer. Converting another time for the timeout
causes the timeout to happen at the wrong time, usually much later than
it should.
2020-05-08 13:56:50 +03:00
Guillaume Desmottes
6c6917077d cdgdec: fix test with gst master
Test was relying on 'blocksize' property on the source which can
only be used in push mode.

This change in baseparse broke it:
e906197c62
so ensure we are actually in push mode by using pushfilesrc.
2020-05-01 10:29:28 +02:00
Jordan Petridis
896bda12f9
ci: always run the clippy and rustfmt jobs
Unless they are explicitly marked, they won't
run on detached pipelines by default
2020-04-30 19:21:42 +03:00
Jordan Petridis
3d2792a1c3
ci: replace only clause with rules
only/except is deprecated and going to be removed
from future versions of gitlab.
2020-04-30 19:14:04 +03:00
François Laignel
4cba9d1e53 threadshare: src elements: don't reset configured_caps
See https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/issues/113
2020-04-29 21:37:22 +02:00
François Laignel
8e38d861b4 threadshare: save upgrade in Pad functions
When initializing Pad functions in `Pad{Src,Sink}`, we downgrade the
`Pad{Src,Sink}` and upgrade it when necessary. This was implemented
to avoid reference cycles:

`gst::Pad` -> pad function -> `Pad{Src,Sink}` -> `gst::Pad`.

Since `Pad{Src,Sink}` reset the pad functions when dropping, there is
no cycles, so we can use an `Arc<Pad{Src,Sink}>` in the pad functions,
thus saving an `upgrade`.
2020-04-29 16:10:19 +02:00
François Laignel
26634f591a threadshare: build Pad{Src,Sink} with handlers
Handlers for `Pad{Src,Sink}` are assigned when `prepare` is called
which prevents them from handling pre-prepare queries.

See https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/issues/247
2020-04-29 16:08:16 +02:00
François Laignel
c414f78248 threadshare: fix race condition in tcpclientsrc test 2020-04-28 20:47:08 +02:00
Guillaume Desmottes
ee71a4ab8a ci: update ci template
Prevent creating a second useless layer, see
https://gitlab.freedesktop.org/freedesktop/ci-templates/-/merge_requests/26

Update image tag to ensure building images is still working.
2020-04-28 16:11:18 +02:00
Guillaume Desmottes
9efe4168b7 ci: install dav1d when generating image
Save us from using the static version when building the crate.
2020-04-28 14:21:01 +02:00
Guillaume Desmottes
871f91d87f deny: fail on multiple versions
Will ensure to keep the ignore list up to date.
2020-04-28 12:16:08 +02:00
Guillaume Desmottes
c58c6bf7fd deny: remove dav1d-sys exception
dav1d 0.5.1 has just been released fixing the duplicated deps issue.
2020-04-28 11:46:41 +02:00
Guillaume Desmottes
3d1df3ca25 ci: switch from cargo-audit to cargo-deny
Fix #110
2020-04-28 10:39:50 +02:00
Guillaume Desmottes
f34673b704 ci: add update jobs
Those jobs are triggered by gstreamer-rs when their images are updated
so we can rebuild ours.

Also disable normal building jobs and unrelated tests when updating a
specific image as they are not needed.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/321>
2020-04-27 12:19:17 +02:00
Guillaume Desmottes
54586c6ecc ci: use fdo template
Build our own images based on the ones used by gstreamer-rs ci.

Fix #109

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/321>
2020-04-27 12:19:08 +02:00
François Laignel
957aac94ae threadshare: align some properties with their C counterparts
Some ts-elements properties don't match the name, type or default
value of the C elements counterparts.
2020-04-27 11:22:26 +02:00
François Laignel
dae38eb0a3 threadshare: benchmark: add throughput tracking 2020-04-25 23:18:20 +02:00
Sebastian Dröge
36f032ef15 Configure crate-type to cdylib/rlib consistently in Cargo.toml
And not in the source code, it's a build decision.
2020-04-24 15:02:12 +03:00
Sebastian Dröge
2019cdb8cb fallbackswitch: Clean up 1.18 aggregator compat code 2020-04-24 14:37:43 +03:00
Sebastian Dröge
a63991e325 fallbackswitch: Add fallbacksource element that automatically retries playback of an URI
This is a wrapper around uridecodebin3 and fallbackswitch that allows to
switch to a still frame on errors and automatically retries the source
in the background on errors until a given retry timeout is reached.
2020-04-24 14:12:01 +03:00
Sebastian Dröge
5a7fcfad7f Fix various new clippy warnings with clippy 1.43 2020-04-24 13:55:01 +03:00
Mathieu Duponchelle
44d4a2a832 meson: fix mistakenly checked-in csound disabling 2020-04-23 22:05:57 +02:00
Mathieu Duponchelle
510c1cf2df tttocea608: use mul_div_round
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/314>
2020-04-23 20:58:54 +02:00
Mathieu Duponchelle
5c82e6fe6c tttocea608: forward gaps from upstream
taking our own latency into account

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/314>
2020-04-23 20:10:42 +02:00
Mathieu Duponchelle
fbb2022b25 tttocea608: protect State with a simple mutex
There was no reason to use AtomicRefcell in this context,
aside from the dubious pleasure of panicing when attempting
to borrow mutably while another mutable borrow was already
held.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/314>
2020-04-23 20:10:42 +02:00
Mathieu Duponchelle
de796c95f0 tttocea608: refactor to fit more scenarios
- Report a latency:
  By design, tttocea608 will output buffers in the "past" when
  receiving an input buffer: we want the second to last buffer
  in the buffer list that we output to have the same pts as the
  input buffer, as it contains the end_of_caption control code
  which determines when the current closed caption actually gets
  displayed in pop_on mode. The previous buffers have timestamps
  decreasing as a function of the framerate, for up to potentially
  74 byte pairs (the breakdown is detailed in a comment).

  The element thus has to report a latency, at 30 frames per second
  it represents around 2.5 seconds.

- Refactor timestamping:
  Stop using a frame duration, but rather base our timestamps on
  a scaled frame index. This is to avoid rounding errors, and
  allow for exactly one byte pair per buffer if the proper framerate
  is set on the closed caption branch, and the video branch has
  perfect timestamps, eg videorate. In practice, that one byte
  pair per frame requirement should only matter for line 21 encoding,
  but we have to think about this use case too.

- Splice in erase_display_memory:
  When there is a gap between the end of a buffer and the start
  of the next one, we want to erase the display memory (this
  is unnecessary otherwise, as the end_of_caption control code
  will in effect ensure that the display is erased when the
  new caption is displayed). The previous implementation only
  supported this imperfectly, as it could cause timestamps to
  go backwards.

- Output last erase_display_memory:
  The previous implementation was missing the final
  erase_display_memory on EOS

- Output gaps

- Write more tests

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/314>
2020-04-23 20:10:42 +02:00
Mathieu Duponchelle
bdfb24abbd jitterbuffer: release state lock when requesting pt map
This is similar to what the standard jitterbuffer does, and
is necessary to avoid deadlocks with the rtpbin session lock,
if the user calls onto any API that requires us to take the
state lock at the wrong time (eg setting the latency property,
clearing the pt map)
2020-04-22 12:40:23 +00:00
Sebastian Dröge
d08268627e threadshare/jitterbuffer: Use GSlice allocator for the jitter buffer items
They're actually used as a hackish intrusive list around GQueue so using
a different allocator is rather dangerous. Or rather, this is generally
dangerous and shouldn't be done but ...

Also make sure to free items manually in finalize() so that any
contained buffers can also be unreffed.
2020-04-22 14:02:44 +03:00