Commit graph

48 commits

Author SHA1 Message Date
Sebastian Dröge b021a8bf10 utils: Update for subclassing API changes 2020-11-15 18:25:42 +02:00
Seungha Yang c62bdb171a fallbacksrc: Don't give up to running even if segment event is unavailable on blocking probe
The blocking probe will be called on buffer or downstream event.
So segment event might not be available at that moment if it was
called by downstream events.
2020-11-03 05:13:20 +09:00
Seungha Yang 6390d85b5f fallbacksrc: Add statistics property
This property would be useful for application to understand
the internal status of fallbacksrc element.
2020-10-30 17:08:05 +09:00
Seungha Yang 1b546bb562 fallbacksrc: Ignore buffering message of restart was scheduled
In case that there is pending restart, fallbacksrc should not
try to add pad probe.
2020-10-22 02:25:52 +09:00
Seungha Yang 46af97219c fallbacksrc: Clear exisiting pad probe on restarting
Fallback might happen even after uridecodebin3 exposed pad.
For later use of audio and video streams, clear it if any
2020-10-22 02:23:22 +09:00
François Laignel 7c3e69bb4a Fix ClockTime comparisons not being Ord and use saturating_sub
See:
https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/607
2020-10-20 23:45:01 +02:00
Sebastian Dröge bbc18d6349 Update for ClockId creation API changes 2020-10-20 12:49:51 +03:00
Sebastian Dröge 1e661e6d5b Update for gst::ClockId changes 2020-10-10 13:53:28 +03:00
Sebastian Dröge 4561b0bc3c utils/fallbacksrc: Add update-uri signal
This allows to update the URI just before configuring it on
uridecodebin3. It might be necessary to update the original URI because
it expired in the meantime, for example.
2020-09-28 16:54:42 +00:00
Sebastian Dröge bf82e750f4 utils/fallbacksrc: Remove custom source elements from internal bin when shutting down
Otherwise we can't add it again later to a new bin when starting up again.
2020-09-26 12:24:05 +00:00
Sebastian Dröge 4b171ec7ff utils/fallbacksrc: Remove pad probes before restarting the source
Otherwise the source might be blocked downstream in the pad probe on the
queue. Previously this was not a problem because the probes were
directly on the srcpads of the source but due to a workaround for
uridecodebin3 buffering bugs this is not the case anymore.
2020-08-04 10:37:08 +03:00
Sebastian Dröge a2c0d70930 utils/fallbacksrc: Don't schedule a source restart timeout if the source is already pending restart 2020-08-04 10:36:45 +03:00
Sebastian Dröge 9ebcfbf333 utils/fallbacksrc: Improve debug output related to pad probes 2020-08-04 10:36:28 +03:00
Sebastian Dröge 0ce36c0f76 utils/fallbacksrc: Forward the state change return of custom sources
Without this, custom sources that are live are not actually considered
live.
2020-08-03 17:56:15 +03:00
Sebastian Dröge 42a3cf8bb2 utils/fallbacksrc: Fix debug output in pad probe callback
Let's print the name of the source's srcpad that is going to be blocked
instead of the "src" pad of the following queue. Without this it's hard
to distinguish the different streams from the logs.
2020-08-03 17:55:35 +03:00
Sebastian Dröge 30c711886e utils/fallbacksrc: Add a 1s queue between uridecodebin and clocksync and do buffering after the queue
This adds 1s more buffering (of uncompressed data), but works around
https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/issues/800
2020-07-30 14:53:18 +03:00
Sebastian Dröge 34fab8786f utils/fallbacksrc: Fix fallback stream detection if only audio or video is enabled 2020-07-30 14:35:34 +03:00
Sebastian Dröge a022bbe260 Fix some new clippy warnings 2020-07-28 18:52:11 +03:00
Sebastian Dröge 0eb777cf5a Update for removal of ObjectImpl::get_type_data() 2020-07-26 18:46:32 +03:00
Sebastian Dröge 5e1ce7f9a7 utils/fallbacksrc: Proxy the uridecodebin3 buffer-duration property 2020-07-10 11:14:33 +03:00
Sebastian Dröge 2b892ec01a utils/fallbacksrc: Proxy the aggregator min-upstream-latency property as min-latency
The fallback stream will usually have a lower latency than the main
stream, so a too low latency would be configured if the fallback is
activated in the beginning.

This property allows to override this and does not require latency
reconfiguration.
2020-07-08 13:43:06 +03:00
Sebastian Dröge 45f547c4be fallbacksrc: Configure up to 5s of buffering on the fallback stream
imagefreeze in live mode can handle only up to 1 frame of buffering
itself.
2020-07-07 14:29:07 +03:00
Sebastian Dröge daa6cfbb6a utils/fallbacksrc: Add property to optionally restart the source on EOS
EOS might be unexpected and the stream might be supposed to run forever,
in which case it should transparently be restarted on EOS.
2020-07-03 15:37:36 +03:00
Sebastian Dröge 2903d4a66c fallbacksrc: Refactor some code to reduce code duplication 2020-07-03 09:53:55 +03:00
Sebastian Dröge 44ad0a2f52 fallbacksrc: Differentiate between fallback and restart timeout
This also fixes the bug that the source wouldn't be restarted another
time if we switched to the fallback stream before and didn't at least
shortly switch to the normal stream. There was no timeout for this.

Based on a patch by Mathieu Duponchelle <mathieu@centricular.com>
2020-07-02 14:46:59 +03:00
Mathieu Duponchelle f7fc5bb0a3 fallbacksrc: add missing assignment to source_pending_timeout
b3138ad041 added the field for
that purpose, let's also use it!
2020-07-02 11:51:16 +03:00
Sebastian Dröge 2192c9d3b4 fallbacksrc: Unset ghost pad targets before removing from the element
Workaround for https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/553
2020-07-02 11:38:01 +03:00
Sebastian Dröge a28455f0ce Update for Element::post_message() signature change 2020-06-30 21:28:02 +00:00
Sebastian Dröge 48c20471d5 Fix compilation after flags cleanup 2020-06-30 12:04:50 +03:00
Sebastian Dröge 86e983ef11 fallbacksrc: Try setting imagefreeze to live mode
Otherwise we would start outputting at running time 0, which is going to
be wrong if the pipeline was already running for a while.

Requires https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/653
2020-06-29 12:03:57 +03:00
Sebastian Dröge f62c11f851 Update for functions returning a Builder being renamed to builder() instead of new()
And new video event APIs.
2020-06-25 19:49:07 +03:00
Sebastian Dröge 392bfc0b1e fallbacksrc: Create an identity sync=true if the new clocksync element can't be found 2020-06-25 13:58:22 +03:00
Sebastian Dröge 2e13e4ce73 fallbacksrc: Mark internal source property for custom sources as write/construct-only
It's only used during construction of the internal bin after all.
Keeping it readable would cause e.g. creating a pipeline graph trying to
read it, which is not implemented.
2020-06-25 13:47:45 +03:00
François Laignel e40267e95d event,message,query: update instantiation
See https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/532
2020-06-25 11:26:32 +02:00
Sebastian Dröge fe274ac6e7 fallbacksrc: Use new proxy_pad_chain_function() support when building pads
Less unsafe code.
2020-06-23 10:01:27 +03:00
Sebastian Dröge 9bb3e75fb9 Update to use the new pad builders for safely setting pad functions
Only two uses of unsafely setting the pad functions is left:
- fallbacksrc for overriding the chain function of the proxy pad of a
  ghost pad
- threadshare for overriding the pad functions after creationg, which
  probably needs some fixing at some point
2020-06-22 11:28:19 +03:00
Guillaume Desmottes e85799b9d6 use new constructor names 2020-06-11 13:07:01 +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
Sebastian Dröge d4e9a56e54 fallbackswitch/fallbacksrc: Ignore errors when shutting down the source 2020-05-08 13:56:50 +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