Commit graph

349 commits

Author SHA1 Message Date
Guillaume Desmottes 91d2406180 fallbackswitch: protect src pad stream lock using Cond
Should prevent stream and State deadlocks, see https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/issues/202

Fix #202
Hopefully fix #192 as well.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1330>
2023-09-20 19:44:22 +03:00
Guillaume Desmottes e1d35536ad fallbackswitch: prevent deadlocks in chain function
Calling schedule_timeout() may result in handle_timeout() being called right away,
which will need pad state locks which was still hold in chain().

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1330>
2023-09-20 19:44:14 +03:00
Guillaume Desmottes 74b6955e0e fallbackswitch: ensure strict ordering when taking mutexes
Should prevent deadlocks.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1330>
2023-09-20 19:43:59 +03:00
Sebastian Dröge 6393572b37 Update version to 0.10.11 2023-07-20 14:43:13 +03:00
Jan Schmidt 83a2c52f32 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/1286>
2023-07-19 09:52:32 +03:00
Jan Schmidt e7f70cc228 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/1286>
2023-07-19 09:52:25 +03:00
Sebastian Dröge 4f78e7b92e Update versions to 0.10.10 2023-07-05 15:53:20 +03:00
Sebastian Dröge 698db4b13e Correctly declare 1.64 as minimum supported Rust version
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1266>
2023-07-05 12:36:57 +03:00
Vivia Nikolaidou bbc775b8dc 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/1266>
2023-07-05 12:36:08 +03:00
Vivia Nikolaidou 8f19a01fdd 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/1266>
2023-07-05 12:36:08 +03:00
Sebastian Dröge 69d4ecc3be 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/1266>
2023-07-05 12:31:08 +03:00
Jan Alexander Steffens (heftig) 51173cfdc8 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/1266>
2023-07-05 12:31:02 +03:00
Sebastian Dröge ab8525451a Update versions to 0.10.9 2023-06-19 20:43:14 +03:00
Guillaume Desmottes 638ffc3c7c 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/1248>
2023-06-19 18:44:16 +03:00
Guillaume Desmottes 0998f9a303 fallbackswitch: remove unused SinkState::eos
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1248>
2023-06-19 18:44:08 +03:00
Guillaume Desmottes 06c5d8766d fallbackswitch: log when handling events
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1248>
2023-06-19 18:44:02 +03:00
Sebastian Dröge bea00c7413 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/1248>
2023-06-19 18:42:12 +03:00
Sebastian Dröge 361152d884 Update versions to 0.10.8 2023-06-07 00:54:32 +03:00
Guillaume Desmottes 14168930cd uriplaylistbin: use thiserror
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1233>
2023-06-06 22:45:35 +03:00
Guillaume Desmottes 52b30a37ed uriplaylistbin: example: display iterations
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1233>
2023-06-06 22:45:28 +03:00
Guillaume Desmottes 7e9cb37892 uriplaylistbin: example display when leaving because of eos
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1233>
2023-06-06 22:45:21 +03:00
Guillaume Desmottes febc28863e uriplaylistbin: prevent deadlock when notifying property changes
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1233>
2023-06-06 22:45:15 +03:00
Seungha Yang 1dc96548c4 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/1215>
2023-05-18 17:55:25 +03:00
Guillaume Desmottes 403ac0c188 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/1215>
2023-05-18 17:55:16 +03:00
Sebastian Dröge 573307b32e Update version to 0.10.7 2023-05-09 20:44:27 +03:00
Sebastian Dröge 48ffd4eb49 Update versions to 0.10.6 2023-04-06 11:24:25 +03:00
Tim-Philipp Müller 198477e63b 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/1160>
2023-04-05 15:12:40 +00:00
Sebastian Dröge b2a0591676 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/1160>
2023-04-05 15:12:40 +00:00
Guillaume Desmottes 329956de87 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/1160>
2023-04-05 15:12:40 +00:00
Vivia Nikolaidou edc366f612 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/1160>
2023-04-05 15:12:40 +00:00
Sebastian Dröge 67de191be2 Update versions to 0.10.5 2023-03-19 18:40:49 +02:00
Sebastian Dröge 751a4c7597 Update versions to 0.10.4 2023-03-14 14:01:04 +02:00
Talha Khan 9a3f86f497 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/1129>
2023-03-10 15:36:07 +01:00
Guillaume Desmottes 09a9877f40 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/1129>
2023-03-10 15:35:43 +01:00
Sebastian Dröge 20b18c23e6 Update versions to 0.10.3 2023-03-02 13:27:22 +02:00
Guillaume Desmottes 6936bf65c4 tracers: queue_levels: add appsrc support
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1115>
2023-03-02 10:50:19 +02:00
Sebastian Dröge b3cb41eae3 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/1115>
2023-03-02 10:50:19 +02:00
Sebastian Dröge f22b3420b6 Update versions to 0.10.2 2023-02-23 10:07:43 +02:00
Sebastian Dröge 73a5703eeb Update versions to 0.10.1 2023-02-13 11:52:37 +02:00
Sebastian Dröge f3c1a91fb9 Add versions to local dependencies 2023-02-10 00:36:22 +02:00
Sebastian Dröge 6df679d69f Update to gtk-rs-core 0.17, gtk4-rs 0.6 and gstreamer-rs 0.20 branches 2023-02-10 00:33:25 +02:00
Sebastian Dröge 85bf8d6c63 Update versions to 0.10.0 2023-02-10 00:26:24 +02:00
Jan Alexander Steffens (heftig) f55c32ed37 livesync: Document State's fields
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1083>
2023-02-09 13:07:33 +01:00
Jan Alexander Steffens (heftig) 953773a314 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/1083>
2023-02-09 13:07:33 +01:00
Jan Alexander Steffens (heftig) c1bfeb4c23 livesync: Fix log message capitalization
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1083>
2023-02-09 13:07:33 +01:00
Jan Alexander Steffens (heftig) 0af7151ae9 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/1083>
2023-02-09 13:07:32 +01:00
Jan Alexander Steffens (heftig) f03ee95bf0 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/1083>
2023-02-09 13:07:32 +01:00
Jan Alexander Steffens (heftig) c971c4d1d5 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/1083>
2023-02-09 13:07:32 +01:00
Jan Alexander Steffens (heftig) 165b5f8c50 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/1082>
2023-02-09 12:44:47 +01:00
Jan Alexander Steffens (heftig) 33696a8aed 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/1069>
2023-01-30 15:37:00 +00:00