Commit graph

75 commits

Author SHA1 Message Date
Sebastian Dröge 6132788b02 Update for caps/structure-related string API changes
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1048>
2023-01-15 22:58:44 +02:00
Sebastian Dröge 9a68f6e221 Move from imp.instance() to imp.obj()
It's doing the same thing and is shorter.
2022-10-23 23:08:46 +03:00
Sebastian Dröge f045099fc1 Fix GObject type names, GStreamer debug category names and element factory names
Fixes https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/issues/198
2022-10-23 20:46:08 +03:00
François Laignel 6319d104a8 Take advantage of Into<Option<_>> args
Commit 24b7cfc8 applied changes related to nullability as declared
by gir. One consequence was that some functions signature ended up
requiring users to pass `Some(val)` when they could use `val`
before.

This commit applies changes on `gstreamer-rs` which, will honoring
the nullability stil allow users to pass `val` for the few affected
functions.

This commit also fixes the signature for `Element::request_new_pad`
which was updated upstream.
2022-10-21 11:54:24 +02:00
Sebastian Dröge e49138516c Update for pad default functions API changes 2022-10-12 19:50:15 +03:00
Sebastian Dröge 7ee4afacf4 Change *Impl trait methods to only take &self and not Self::Type in addition 2022-10-10 15:03:25 +03:00
Sebastian Dröge 00411523d4 fallbackswitch: Make sure to flush/reset pads during pad (de)activation
Otherwise this can potentially deadlock or delay state changes for a
longer time.
2022-09-27 12:56:01 +03:00
Sebastian Dröge 1f7126a8a1 fallbackswitch: Flush and deactivate pads before releasing them 2022-09-27 12:56:01 +03:00
Sebastian Dröge b6ebad2761 fallbackswitch: Fix lock order problem between state and stream lock
The order is first stream lock, then state lock. Everything else can
lead to deadlocks.
2022-09-27 12:54:21 +03:00
Sebastian Dröge 1a40186485 Update for GLib ParamSpec builder API changes 2022-09-05 11:45:47 +03:00
Vivia Nikolaidou 5606111345 plugins: Simplify code using ParamSpecBuilder 2022-08-22 17:58:43 +03:00
François Laignel 5c5c15d36a Simplify Formatted value handling
See https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1059
2022-07-11 21:21:54 +02:00
Sebastian Dröge cb84206457 Fix a couple of new 1.62 clippy warnings 2022-06-28 14:52:20 +03:00
Mathieu Duponchelle abf872130a fallbackswitch: fix gap processing regression
This was broken by the rewrite, receiving gaps on the main pad
should let the position progress, reset timeouts and keep the main
pad active.

This picks the simplest solution, transforming gap events into GAP
buffers and letting them go through chain(), this achieves the desired
effect.
2022-06-15 06:21:04 +00:00
Jan Alexander Steffens (heftig) a5dd92f479
fallbackswitch: Reset timeout_clock_id on timeout
We shouldn't leave the used clock ID around. Otherwise, we might never
schedule a new timeout from an inactive pad if the active pad doesn't
get a buffer.
2022-06-02 11:07:20 +02:00
Jan Alexander Steffens (heftig) 90ad761d83
fallbackswitch: Use cancel_timeout in schedule_timeout
Dedupe the code and use the function that does the exact same thing.
2022-06-02 11:07:20 +02:00
Jan Alexander Steffens (heftig) 68c55ca413
fallbackswitch: Recheck active_sinkpad after schedule_timeout
`schedule_timeout` can synchronously call `handle_timeout` and change the
active pad. We need to update `is_active` afterwards.

After calling `schedule_timeout` with `end_running_time`, we used to
assume there was no pad switch and reset `switched_pad` immediately. If
the pad actually got switched, this would make us miss a sticky events
update.
2022-05-25 17:53:55 +02:00
Jan Alexander Steffens (heftig) d27e279272
fallbackswitch: Move active_sinkpad out of State into its own Mutex
As described in issue #200, we hold the srcpad's stream lock in some
situations where we notify the `active-pad` property.

If there's a handler installed it will most likely attempt to read the
property, which had to take the `state` lock. Another thread could
already be holding this lock and attempting to obtain the srcpad's
stream lock. This resulted in a deadlock.

To avoid this, move the `active_sinkpad` field into its own Mutex, which
we never hold for long.

Fixes: https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/issues/200
2022-05-12 16:52:07 +02:00
Sebastian Dröge e82678586f fallbackswitch: Remove a redundant pad state unlock/lock 2022-04-14 08:14:26 +00:00
Sebastian Dröge 279dd7d053 fallbackswitch: Set end running time as current running time once a buffer has passed 2022-04-14 08:14:26 +00:00
Sebastian Dröge 0ca0d485a0 fallbackswitch: Log affected pad when scheduling buffer waiting for it 2022-04-14 08:14:26 +00:00
Sebastian Dröge d73bce2985 fallbackswitch: Only update the output running time if it's increasing 2022-04-14 08:14:26 +00:00
Sebastian Dröge 930cdca750 fallbackswitch: Only drop raw audio/video buffers if they're trailing
Otherwise this can cause decoding errors further downstream.
2022-04-14 08:14:26 +00:00
Sebastian Dröge bbb7ced95a fallbackswitch: Improve some debug outputs
Don't print "buffer buffer ...".
2022-04-14 08:14:26 +00:00
Sebastian Dröge ca7cf7dee7 fallbackswitch: Fix clipping of buffers against the output running time
To handle buffers outside the segment correctly.

Also fix debug output to print the correct value.
2022-04-14 08:14:26 +00:00
Sebastian Dröge 617a2ef49e fallbackswitch: Clip buffers against the segment
Also clip raw audio/video buffers according to the caps if they have the
relevant information in the caps, and drop raw audio samples if they're
outside the segment too.

In addition also set durations on raw audio/video buffers based on the
caps if no duration is set.
2022-04-14 08:14:26 +00:00
Sebastian Dröge 6ce523a7a8 fallbackswitch: Improve debug output of clock times and simplify some code 2022-04-14 08:14:26 +00:00
Vivia Nikolaidou de936f42e9 fallbackswitch: Minor cleanup in get_sync_time 2022-04-11 15:57:20 +03:00
Vivia Nikolaidou 0ba6ebb10f fallbackswitch: Notify active-pad without state lock held
Can otherwise deadlock.
2022-04-11 10:48:28 +00:00
Sebastian Dröge 96c28a5728 fallbackswitch: Only notify active-pad property on state changes if it actually changed 2022-04-08 20:23:28 +03:00
Sebastian Dröge 452ea76a69 fallbackswitch: Rename debug category from fallback-switch to fallbackswitch
The element name is without hyphen so the debug category should ideally
too to reduce confusion.
2022-04-08 20:07:01 +03:00
Jan Schmidt bd2ff494c7 fallbackswitch: Replace with priorityswitch
fallbackswitch now supports multiple sink pads, and on a timeout of the
active pad, it will automatically switch to the next lowest priority pad
that has data available.

fallbackswitch sink pads follow the `sink_%u` template and have
`priority` as a pad property.

Co-authored-by: Vivia Nikolaidou <vivia.nikolaidou@ltnglobal.com>
2022-04-05 18:52:31 +03:00
Vivia Nikolaidou c6feb31207 Revert "fallbackswitch: Forward custom downstream events from active sinkpad"
This reverts commit 9ebbae9d27.

It works even without the change.
2022-03-22 13:11:00 +02:00
Vivia Nikolaidou 9ebbae9d27 fallbackswitch: Forward custom downstream events from active sinkpad
This will allow us to forward e.g. SCTE-35 events
2022-03-21 15:30:36 +02:00
Guillaume Desmottes 8389bff7d8 fallbackswitch: properly handle GAP events
Handle GAP events from the active pad as activity and forward
downstream.
2022-03-03 11:48:26 +01:00
Guillaume Desmottes 7b109785be fallbackswitch: factor out handle_main_timed_item()
No semantic change, I'll re-use this to handle GAP events.
2022-03-03 10:01:59 +01:00
Guillaume Desmottes 31864c9a9d fallbackswitch: add support for buffers without pts
Re-use the previously seen PTS.

Fix #186
2022-03-02 13:32:06 +01:00
Guillaume Desmottes 73cfb357c6 fallbackswitch: export GEnum used in properties
Rust applications will be able to use those directly.
2022-03-01 14:44:16 +01:00
François Laignel 422ea740ca Update to gst::_log_macro_
See the details:
https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/980
2022-02-21 20:50:01 +01:00
Sebastian Dröge 326449b3e6 Re-license LGPL-2.1 plugins to MPL-2
Fixes https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/issues/168
2022-01-15 21:05:11 +02:00
Sebastian Dröge 86f422592b Update for glib::Enum / glib::Boxed / glib::flags! macro renames 2021-11-22 11:04:26 +02:00
Sebastian Dröge 55aad51141 Update for glib constructor renames
See https://github.com/gtk-rs/gtk-rs-core/pull/384
2021-11-20 14:31:06 +02:00
Jan Alexander Steffens (heftig) 5285fab8b3 fallbackswitch: Correct immediate-fallback default value
Only affects the claimed default in the properties, not the actual
default.
2021-11-18 21:02:54 +00:00
Sebastian Dröge d9bda62a47 Update for GLib/GStreamer API changes
And clean up a lot of related property/caps/structure code.
2021-11-06 09:34:10 +02:00
Sebastian Dröge b9541b2ca4 Update for GstObjectImpl API change 2021-10-23 12:31:33 +03:00
François Laignel 27b9f0d868 Improve usability thanks to opt-ops
The crate option-operations simplifies usage when dealing with
`Option`s, which is often the case with `ClockTime`.
2021-10-18 15:09:47 +02:00
Sebastian Dröge 54c8f5b3ab fallbackswitch: Remove bundled aggregator copy and require GStreamer 1.18
1.18 is old enough at this point and carrying around a copy of
 aggregator is not sustainable.
2021-10-17 17:35:45 +03:00
Sebastian Dröge 96d86eaa06 Clean up clippy warnings and CI configuration
Put clippy overrides into the sources files instead of the CI
configuration, and fix various warnings / clean up code.
2021-09-08 12:35:41 +00:00
Mathieu Duponchelle 19dcb8159a fallbackswitch: only drop MISSING_DATA gap events pre queue
Regular gap events can be output by sources such as cefsrc in
normal operation, and should not trigger an active pad change.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/538>
2021-08-04 15:12:02 +00:00
Sebastian Dröge 052365ba1a Fix various needless-borrow clippy warnings and others 2021-07-30 13:53:35 +03:00