Commit graph

336 commits

Author SHA1 Message Date
Sebastian Dröge 36cdf84655 Update version to 0.9.11 2023-07-20 15:15:07 +03:00
Jan Schmidt eda38a637e fallbackswitch: Change the threshold for trailing buffers
Only discard buffers on inactive pads if they are later
than the current output running time, rather than the
later timeout running time. That can mean switching
to a higher priority pad can happen quicker.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1285>
2023-07-19 09:37:46 +03:00
Jan Schmidt 081a90fefc fallbackswitch: Fix pad health calculation and notifies
Change the pad health calculation to consider a pad 'healthy'
if it has received data within the last 'timeout' window. Previously,
inactive pads were constantly flip-flopping between healthy and not
healthy depending on whether they were slightly ahead of or behind
the active pad running_time.

When the health status of a pad changes, make sure to always notify
the property, so that applications that are manually controlling
the active pad can make their switching decisions.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1285>
2023-07-19 09:37:38 +03:00
Vivia Nikolaidou 774dda249e togglerecord: Clip segment before calculating timestamp/duration
Clipping happens in buffer time space and data.clip can modify the
buffer timestamp and duration. Move it before we calculate them in order
to make it actually have some effect.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1267>
2023-07-05 14:41:21 +03:00
Vivia Nikolaidou 01f96ca40c togglerecord: Error out if main stream buffer has no valid running time
We cannot continue with this buffer, because we cannot calculate the
time when the recording stopped or started. We also cannot safely drop
it, because that might break the stream, especially if it's encoded.
Therefore, we return an element error.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1267>
2023-07-05 14:41:21 +03:00
Sebastian Dröge c74def0b12 livesync: Wait for the end timestamp of the previous buffer before looking at queue
Previously livesync was waiting for the start timestamp of the current
buffer after looking at the queue and right before pushing it
downstream. This meant that it generally looked too early at the queue
and especially that upstream had to provide the next buffer already at
the start timestamp of the previous one.

Instead, now wait before looking at the queue and wait for the end
timestamp of the previous buffer. Once the previous buffer has expired,
a new buffer really needs to be available or otherwise a filler buffer
has to be pushed downstream.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1267>
2023-07-05 14:38:00 +03:00
Jan Alexander Steffens (heftig) 72941b5dc5 livesync: Improve EOS handling
I've looked at the GstQueue code again and tried making livesync behave
better with EOS. This isn't very well tested, though. My goal was to
make this look saner but I think this should be reviewed by someone who
knows the queue code.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1267>
2023-07-05 14:37:55 +03:00
Guillaume Desmottes 6f75243c8f fallbackswitch: add 'stop-on-eos' property
Fix the following use case:
- main input of fallbackswitch is finite (a media file)
- fallback input is infinite (videotestsrc)
- main input is done and send eos, which is propagated downstream
- fallbackswitch switches to fallback, sending STREAM_START which reset
  EOS downstream (aggregator does that)
- fallback input keeps pushing buffers forever.

Solve it by adding a 'stop-on-eos' property so fallbackswitch stops
pushing property once the main input is eos.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1249>
2023-06-19 19:02:33 +03:00
Guillaume Desmottes 68faccdacf fallbackswitch: remove unused SinkState::eos
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1249>
2023-06-19 19:02:28 +03:00
Guillaume Desmottes aa1d89aa9f fallbackswitch: log when handling events
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1249>
2023-06-19 19:02:23 +03:00
Sebastian Dröge c9b2c88469 Use MPL as license specifier for plugins only requiring GStreamer < 1.20
And use MPL-2.0 for all that require GStreamer 1.20 or newer. The new
string is only allowed in 1.20 or newer and using it in older versions
causes failure to load the plugin.

All affected plugins are of course still MPL-2.0 licensed.

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

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1249>
2023-06-19 19:01:52 +03:00
Guillaume Desmottes 3a98bacd39 uriplaylistbin: use thiserror
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1234>
2023-06-06 22:54:34 +03:00
Guillaume Desmottes e33543dbfa uriplaylistbin: example: display iterations
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1234>
2023-06-06 22:53:51 +03:00
Guillaume Desmottes 0285cb1339 uriplaylistbin: example display when leaving because of eos
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1234>
2023-06-06 22:53:45 +03:00
Guillaume Desmottes 9b97e68da3 uriplaylistbin: prevent deadlock when notifying property changes
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1234>
2023-06-06 22:53:40 +03:00
Seungha Yang cc59ff9052 fallbacksrc: Don't apply fallback-audio-caps to the main audio stream
Intended behavior is configuring audio convert/resample elements
only for the fallback stream and also fallback-audio-caps is set.
Video and image stream are doing it as intended already.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1216>
2023-05-18 18:28:29 +03:00
Guillaume Desmottes 015edb7d37 fallbackswitch: document the pad priority ordering
I just wasted lots of time trying to figure out why my higher priority
pad wasn't used...

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1216>
2023-05-18 18:28:24 +03:00
Tim-Philipp Müller 2d56989f5c git: replace LICENSE file symlinks with copies
Git will de-duplicate the contents for us anyway, and
symlinks can cause problems with some versions of git
and also on Windows.

https://github.com/mesonbuild/meson/issues/11646
https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4326

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1161>
2023-04-05 18:17:16 +03:00
Sebastian Dröge f7c81e78f5 fallbacksrc: Don't check caps when linking to the fallbackswitch
Downstream might have different caps requirements and linking might
fail. Instead of having linking fail, give upstream an opportunity to
reconfigure and otherwise have a normal negotiation error during data
flow.

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

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1161>
2023-04-05 18:17:10 +03:00
Guillaume Desmottes 25e9fc55b7 uriplaylistbin: example: add queues
Prevent pipeline starvation with some media such as
https://assets.onestream.live/studio/Videos/1080p/osl-interval-1080p-8.mp4

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1161>
2023-04-05 18:17:05 +03:00
Vivia Nikolaidou f56f40a943 livesync: Actually assume zero upstream latency when query fails
The code said "assuming zero" but left latency at None instead of
Some(0), failing to unwrap the value later.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1161>
2023-04-05 18:16:16 +03:00
Talha Khan 62cac113fb livesync: Support variable framerate in fallback buffer duration calc
Avoids a divide by zero error

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1135>
2023-03-14 13:43:41 +02:00
Guillaume Desmottes c9719e4231 uriplaylistbin: reset element when switching back to NULL
Allow us to re-use the element later.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1135>
2023-03-14 13:43:22 +02:00
Sebastian Dröge 9a779607c7 Update versions to 0.9.10 2023-03-02 13:18:00 +02:00
Guillaume Desmottes e14777573f tracers: queue_levels: add appsrc support
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1116>
2023-03-02 10:53:19 +02:00
Sebastian Dröge 4aacf4d3ad livesync: Correctly calculate fallback buffer duration from framerate
Numerator and denominator were switched.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1116>
2023-03-02 10:53:19 +02:00
Sebastian Dröge eb3d3b3088 Update versions to 0.9.9 2023-02-09 22:08:17 +02:00
Jan Alexander Steffens (heftig) 19c527a9c5 livesync: Document State's fields
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1086>
2023-02-09 21:43:57 +02:00
Jan Alexander Steffens (heftig) fbf50b395d livesync: Improve formatting
Move some code around to make it a bit more readable. No change in
behavior.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1086>
2023-02-09 21:43:57 +02:00
Jan Alexander Steffens (heftig) 9d67753fd6 livesync: Fix log message capitalization
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1086>
2023-02-09 21:43:57 +02:00
Jan Alexander Steffens (heftig) 07adcf5ecf livesync: Extract LiveSync::flow_error
And add details so it behaves more like the `GST_ELEMENT_FLOW_ERROR`
macro.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1086>
2023-02-09 21:43:57 +02:00
Jan Alexander Steffens (heftig) 35552dc73c livesync: Extract audio_info_from_caps
And adjust it slightly so it never panics.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1086>
2023-02-09 21:43:57 +02:00
Jan Alexander Steffens (heftig) 1e67259462 livesync: Move single segment prop
Keep it with the settings, not after the stats.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1086>
2023-02-09 21:43:57 +02:00
Jan Alexander Steffens (heftig) cccf90f59e livesync: Fix queueing
The logic of the element requires the next buffer to be available
immediately after we are done pushing the previous, otherwise we insert
a repeat.

Making the src loop handle events and queries broke this, as upstream is
almost guaranteed not to deliver a buffer in time if we allow non-buffer
items to block upstream's push.

To fix this, replace our single-item `Option` with a `VecDeque` that we
allow to hold an unlimited number of events or queries, but only one
buffer at a time.

In addition, the code was confused about the current caps and segment.

This wasn't an issue before making the src loop handle events and
queries, as only the sinkpad cared about the current segment, using it
to buffers received, and only the srcpad cared about the current caps,
sending it just before sending the next received buffer.

Now the sinkpad cares about caps (through `update_fallback_duration`)
and the srcpad cares about the segment (when not in single-segment
mode).

Fix this by
  - making `in_caps` always hold the current caps of the sinkpad,
  - adding `pending_caps`, which is used by the srcpad to store
    caps to be sent with the next received buffer,
  - adding `in_segment`, holding the current segment of the sinkpad,
  - adding `pending_segment`, which is used by the srcpad to store
    the segment to be sent with the next received buffer,
  - adding `out_segment`, holding the current segment of the srcpad.

Maybe a fix for
https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/issues/298.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1086>
2023-02-09 21:43:57 +02:00
Jan Alexander Steffens (heftig) 402d96b80c livesync: Only resend segment if not in single-segment mode
In single-segment mode, the outgoing segment does not change when the
incoming segment changes. We only need to resend the segment if we got
flushed or deactivated.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1086>
2023-02-09 21:07:06 +02:00
Sebastian Dröge 5c2582d105 Update version to 0.9.8 2023-01-23 11:30:27 +02:00
Sebastian Dröge 4ba452dcc3 Update versions to 0.9.7 2023-01-19 19:06:43 +02:00
Sebastian Dröge c818a575b4 Update versions to 0.9.6 2023-01-18 17:19:17 +02:00
Guillaume Desmottes c6158b7a4e livesync: fix late-threshold property min value
The code is handling 0 as "always over threshold" but it was not
possible to set the property to 0.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1050>
2023-01-18 16:56:34 +02:00
Sebastian Dröge 2a8a90f76f Update versions to 0.9.5 2023-01-07 16:06:17 +02:00
Sebastian Dröge b0bd55c4d2 Update versions to 0.9.4 2022-12-27 13:14:59 +02:00
Sebastian Dröge b701003352 livesync: Add missing version to the gst-plugin-gtk4 / gst-plugin-version-helper dependencies 2022-12-16 20:37:58 +02:00
Sebastian Dröge bae5294e8f Update versions to 0.9.3 2022-12-16 20:22:17 +02:00
Sebastian Dröge bc9408840f livesync: Use release versions of the GLib/GStreamer bindings
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1017>
2022-12-16 18:59:32 +02:00
Sebastian Dröge 08668a4bbb livesync: Fix version
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1017>
2022-12-16 18:59:32 +02:00
Jan Alexander Steffens (heftig) 6596b6cdd1 Add livesync plugin
It attempts to produce a (nearly) gapless live stream by synchronizing
its output to the running time and forwarding the next input buffer if
its start is (nearly) flush with the end of the last output buffer.

If the input buffer is missing or too far in the future, it duplicates
the last output buffer with adjusted timestamps. If it is operating on a
raw audio stream, it will fill duplicate buffers with silence.

If an input buffer arrives too late, it is thrown away. If the last
input buffer was accepted too long ago (according to `late-threshold`),
a late input buffer is accepted anyway, but immediately considered a
duplicate. Due to the silence-filling, this has no effect on audio, but
video gets a "slideshow" effect instead of freezing completely.

The "many-repeats" property will be notified when this element has
recently duplicated a lot of buffers or recovered from such a state.

Co-authored-by: Vivia Nikolaidou <vivia@ahiru.eu>
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1017>
2022-12-16 18:51:22 +02:00
Sebastian Dröge b4185134d1 Fix various new clippy warnings
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1017>
2022-12-16 18:51:00 +02:00
Sebastian Dröge 1f4a035dc0 Update versions to 0.9.2 2022-11-28 11:44:33 +02:00
Sebastian Dröge e434fd19ca Update versions to 0.9.1 2022-11-13 20:23:47 +02:00
Sebastian Dröge 07f3b0f504 Fix various new clippy warnings
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/977>
2022-11-12 15:52:49 +00:00