Commit graph

384 commits

Author SHA1 Message Date
Sebastian Dröge 8335bdb0b7 Update versions to 0.11.4 2024-02-13 11:13:23 +02:00
Sebastian Dröge d0b944b2a7 Fix a couple of compiler/clippy warnings with --no-default-features
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1457>
2024-02-12 17:52:58 +02:00
Michael Tretter 9f7bb6102c livesync: add support for image formats
The livesync element is also useful for Motion JPEG streams. However,
Motion JPEG uses image/ caps instead of video/ caps.

The framerate is defined for image/, too.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1457>
2024-02-12 17:46:36 +02:00
Guillaume Desmottes ddc15b92a5 livesync: properly format jitter in debug logs
Easier to read that way.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1457>
2024-02-12 17:45:46 +02:00
Sebastian Dröge 4c8db5623f Update versions to 0.11.3 2023-12-18 12:13:48 +02:00
Seungha Yang 4fd3b287e8 fallbacksrc: Fix timeout scheduling
Other thread can schedule the timeout (e.g., unblock signal
or active pad change) while state lock is released

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1410>
2023-12-18 10:00:15 +02:00
Sebastian Dröge 2274c62db7 uriplaylistbin: Fix new clippy warning
warning: the borrowed expression implements the required traits
    --> utils/uriplaylistbin/src/uriplaylistbin/imp.rs:1691:32
     |
1691 |         self.obj().remove_many(&children_ref).unwrap();
     |                                ^^^^^^^^^^^^^ help: change this to: `children_ref`

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1410>
2023-12-18 09:52:20 +02:00
Sebastian Dröge 151702d264 Update versions to 0.11.2 2023-11-11 20:52:45 +02:00
Sebastian Dröge 1ceaf8b179 Use let-else instead of match for weak reference upgrades
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1388>
2023-11-10 16:04:38 +02:00
Jan Alexander Steffens (heftig) b4855f1ba8 livesync: Remove the stop from outgoing segments
Our buffer duplication can extend a segment indefinitely.

Fixes: https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/issues/452
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1388>
2023-11-10 16:02:42 +02:00
Jan Alexander Steffens (heftig) d65504aeb8 livesync: Keep existing buffer duration in some cases
Resize a repeat buffer only if caps gave us a duration to use, or we
consider its current duration unreasonable.

In particular, for audio streams we should prefer reusing the buffer
size upstream gave us, as we did before 6633cc4046.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1388>
2023-11-10 16:02:36 +02:00
Jan Alexander Steffens (heftig) 48020dfbf5 livesync: Split fallback_duration into in_ and out_duration
Make it independent of the `latency`; this was inconsistent anyway,
where the default latency of zero got you a fallback duration of 100 ms
and something else got you half the latency.

Maintain a separate duration for the `in` and the `out` side so we
change the duration of repeat buffers after a caps change, not just
before.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1388>
2023-11-10 16:02:31 +02:00
Guillaume Desmottes 352d947655 livesync: display jitter when waiting on clock
We already log the result of the clock wait call so may as well log the
returned jitter.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1388>
2023-11-10 16:02:27 +02:00
Guillaume Desmottes 559825a551 livesync: log new pending segments
The debug print of the event does not display details about the segment:
  Unqueueing Some(Event(Event { ptr: 0x7fa3e0002580, type: "segment", seqnum: Seqnum(479), structure: Some(GstEventSegment { segment: (GstSegment) ((GstSegment*) 0x7fa3e8001d00) }) }))

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1388>
2023-11-10 16:02:22 +02:00
Jan Alexander Steffens (heftig) 34ce94932f livesync: example: Add identities single-segment=1
These let us change the runtime offset of the test buffers via pad
offsets without pushing new segments into livesync, which is necessary
to demo the late-threshold behavior.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1388>
2023-11-10 16:02:17 +02:00
Jan Alexander Steffens (heftig) 7c2f05c271 livesync: Use fallback_duration for audio repeat buffers as well
Don't depend on upstream giving us sanely-sized buffers if we want to
repeat.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1388>
2023-11-10 16:02:12 +02:00
Jan Alexander Steffens (heftig) 0b80e3aa47 livesync: Separate out_buffer duplicate status from GAP flag
Otherwise we might get confused by upstream GAP buffers.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1388>
2023-11-10 16:02:07 +02:00
Jan Alexander Steffens (heftig) ccf1171776 livesync: Handle flags and late buffer patching after queueing
This makes the chain function almost independent of the output state. We
still do the early discard check with `buffer_is_backwards` so we don't
try to queue buffers we can't use, allowing us to fast-forward upstream
without blocking on the src task.

Don't accept `LateOverThreshold` buffers when we have `pending_caps` or
a `pending_segment`. We need to apply these first before we can sensibly
patch buffers from the new stream.

Deduplicate most of the output buffer patching code into a new
`patch_output_buffer` method.

For: https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/issues/450
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1388>
2023-11-10 16:02:00 +02:00
Jan Alexander Steffens (heftig) 8deb2d26a8 livesync: Simplify num_duplicate counting
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1388>
2023-11-10 16:01:55 +02:00
Jan Alexander Steffens (heftig) 3a7bf71483 livesync: Move num_in counting to the src task
This is in preparation for moving more accept/discard logic to the src
task, so we can only count `num_in` here.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1388>
2023-11-10 16:01:49 +02:00
Jan Alexander Steffens (heftig) 9ad3c42e21 livesync: Move a notify closer to the interesting state change
Move the `notify_all` to where we pop the buffer. We're moving within a
single state lock so no change in behavior.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1388>
2023-11-10 16:01:41 +02:00
Jan Alexander Steffens (heftig) 80ba5b980d livesync: Replace an if-let with match
No change in behavior, yet. Separate commit to ease reviewing.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1388>
2023-11-10 16:01:37 +02:00
Jan Alexander Steffens (heftig) 391b244b9e livesync: Clean up state handling
- Separate resetting state more cleanly, introducing `set_flushing`,
  `sink_reset` and `src_reset`.
- Clear the queue early when we flush, in order to unblock waits on
  query responses.
- Return an error when we fail to start, pause or stop the task.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1388>
2023-11-10 16:01:32 +02:00
Jan Alexander Steffens (heftig) 04b7a1afd6 livesync: Log a category error when we are missing the segment
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1388>
2023-11-10 16:01:27 +02:00
Jan Alexander Steffens (heftig) 79f58785d9 livesync: Improve audio duration fixups
- An entirely missing duration is now only logged at debug level instead
  of pretending the duration was zero and warning about it.
- Silently fix up a duration difference up to one sample.
- Error when we fail to calculate the duration; don't try to apply the
  `fallback_duration` to a non-video stream.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1388>
2023-11-10 16:01:22 +02:00
Jan Alexander Steffens (heftig) 913fb606fc livesync: Simplify start_src_task and src_loop
This should effect no change in behavior.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1388>
2023-11-10 16:01:16 +02:00
Jan Alexander Steffens (heftig) 90a22950d2 livesync: Rename activatemode methods to *_activatemode
This matches the other plugins.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1388>
2023-11-10 16:01:11 +02:00
Sebastian Dröge 880f4229d0 Clean up usage of pad probes
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1388>
2023-11-10 15:52:18 +02:00
Sebastian Dröge 2b8728103f Update versions to 0.11.1 2023-10-04 23:35:35 +03:00
Sebastian Dröge b360b5247e Update gst-plugin-version-helper version requirement to 0.8
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1350>
2023-10-04 19:15:53 +03:00
Guillaume Desmottes dd117366c5 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/1331>
2023-09-20 19:56:14 +03:00
Guillaume Desmottes a11388453a 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/1331>
2023-09-20 19:56:09 +03:00
Guillaume Desmottes acc9fcd8c8 fallbackswitch: ensure strict ordering when taking mutexes
Should prevent deadlocks.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1331>
2023-09-20 19:56:03 +03:00
Sebastian Dröge 383d8e2668 Add version to gst-plugin-gtk4 dependencies 2023-08-10 17:12:16 +03:00
Sebastian Dröge 982b5d6ef9 Add version to the gst-plugin-version-helper dependency 2023-08-10 16:56:04 +03:00
Sebastian Dröge 67c3732b94 Update dependencies to release branches of gtk-rs / gtk4-rs / gstreamer-rs 2023-08-09 18:14:18 +03:00
Sebastian Dröge 9b1853c1de Update versions to 0.11.0 2023-08-09 18:04:38 +03:00
Sebastian Dröge 3b41f206bc Don't generate .def files for plugins
Fixes https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/issues/389

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1299>
2023-08-09 13:54:34 +03:00
François Laignel 10902c0485 utils: fix further to glib change ControlFlow -> Propagation
See: https://github.com/gtk-rs/gtk-rs-core/pull/1144
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1292>
2023-08-02 13:19:22 +02:00
Sebastian Dröge 31b1cb8ca6 Update minimum supported Rust version to 1.70
gtk-rs will update soonish too.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1280>
2023-07-19 09:19:34 +03:00
Sebastian Dröge bbd3d9ffe0 Remove unnecessary mut everywhere
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1273>
2023-07-11 10:09:35 +03:00
Bilal Elmoussaoui 0fa2c861d6 Adapt to removal of glib::Inhibit
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1270>
2023-07-06 22:02:31 +02:00
Jan Schmidt 2abc72b606 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/1198>
2023-07-07 01:45:52 +10:00
Jan Schmidt 61e282af1a 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/1198>
2023-07-07 01:45:52 +10:00
Bilal Elmoussaoui dd2d7d9215 Use re-exported once_cell
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1268>
2023-07-06 17:50:49 +03:00
Bilal Elmoussaoui 2cc98bf410 Adapt to glib::Continue rename
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1268>
2023-07-06 17:50:49 +03:00
Vivia Nikolaidou 9d7af671c5 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/1265>
2023-07-04 09:07:36 +00:00
Vivia Nikolaidou 8417efc630 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/1264>
2023-06-30 09:20:42 +00:00
Vivia Nikolaidou 8366716456 togglerecord: Change test_two_stream_close_open_nonlivein_liveout timeout to 60ms
20ms was not enough for the CI.

Closes https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/issues/379

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1258>
2023-06-26 12:33:31 +00:00
Vivia Nikolaidou 2be14b95b3 togglerecord: Fix nonlive inputs when element is started not recording
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1252>
2023-06-21 16:27:00 +03:00