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
Vivia Nikolaidou
385a983e5f
fallbackswitch: Fix racy manual switching test
...
The element has a small race condition where it might output two buffers
with the same running time during e.g. a manual switch. In practice this
is not a problem, so the test takes this race into account.
Fixes: https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/issues/195
2022-04-18 16:13:00 +03: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
4aa00c9eca
fallbackswitch: Don't configure a framerate in the test
...
The tests assume that buffers have no known duration and would deadlock
otherwise because timeouts are scheduled to the end of a buffer.
2022-04-14 08:14:26 +00:00
Sebastian Dröge
f5260f9b36
fallbackswitch: Explictly set priority of pads in the test
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
Seungha Yang
930cc41aaa
fallbacksrc: Don't forward manual flush events to downstream
...
fallbackswitch might forward flush event if it's for the currently
active pad. But forwarded flush event will be problematic in various
reasons and that's not a behavior we expected.
2022-04-12 23:21:32 +09:00
Sebastian Dröge
5788837fb6
fallbacksrc: Unflush downstream pads of the source after shutting down everything
...
Otherwise the pads might still be flushing on the next try and the
source would never recover.
2022-04-12 14:40:08 +03:00
Sebastian Dröge
7233d6936c
fallbacksrc: Remove imagefreeze if it becomes unneeded
2022-04-12 14:37:29 +03:00
Vivia Nikolaidou
de936f42e9
fallbackswitch: Minor cleanup in get_sync_time
2022-04-11 15:57:20 +03:00
Sebastian Dröge
3de317b3c9
fallbacksrc: Don't panic when shutting down the source and there are source pad blocks but no actual source pads
...
This can happen if the source removed the actual source pad already but
our downstream pad that is blocked still exists.
2022-04-11 11:01:27 +00:00
Sebastian Dröge
84402f39ef
fallbacksrc: Reset state in fallbacksrc custom source also if changing the state to READY before failed
...
Otherwise it will panic on the next try because always pads are already
linked to the ghostpads.
2022-04-11 11:01:27 +00: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
08379ab389
fallbacksrc: Request the main pad first from fallbackswitch
...
By default the first created pad is the active one before the
fallbackswitch is actually processing data.
2022-04-08 20:24:03 +03: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
Sebastian Dröge
d3d98c73ca
fallbacksrc: Connect to notify::active-pad
after requesting pads
...
Requesting the first pad will emit the property because the first pad is
then selected. That will cause the callback to be called, which tries to
take the same mutex that is already locked during element setup and
causes a deadlock.
2022-04-08 19:53:38 +03:00
Sebastian Dröge
803e452889
Update minimum supported GStreamer version to 1.14
2022-04-07 12:41:54 +03:00
Jan Alexander Steffens (heftig)
0a3e9c81f9
fallbackswitch: Add missing requires_private
2022-04-06 11:11:25 +02: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
Sebastian Dröge
4a54001aed
fallbacksrc: Flush source before restarting on errors
...
It might still be blocked downstream for a while, e.g. in the clocksync.
Flushing does not cause any problems as fallbackswitch is not going to
forward it and will only unblock everything up to there.
2022-03-17 16:12:34 +00: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
Sebastian Dröge
b38f6cc731
Remove now unnecessary Send+Sync
impls for element/etc subclasses
...
This is now automatically implemented.
2022-02-28 18:56:58 +02:00
Seungha Yang
de2ea8a1b2
fallbacksrc: Disconnect signals on ReadyToNull
...
Otherwise multiple signal handlers will be connected to the source
2022-02-25 23:12:30 +09:00
Sebastian Dröge
a1e2debde4
fallbacksrc: Changing the URI of the video fallback is supported in NULL state
...
And not just during construction.
This fixes switching from a failing video fallback to a dummy fallback,
which was added in c7fe08bf6
.
2022-02-24 12:29:53 +02:00
François Laignel
2cf84d5ce8
Update minimum supported Rust version to 1.57
2022-02-21 23:32:32 +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
f44b86cd30
Simplify some code around event/query views
2022-01-22 12:18:02 +02:00
Sebastian Dröge
65fcd55160
Update for event/message/query view API changes
2022-01-19 15:07:45 +02:00
Sebastian Dröge
b2d0172422
Replace Foo::from_instance(foo)
with foo.imp()
2022-01-17 19:36:41 +02: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
0c7764fa40
Update versions to 0.9.0
2022-01-15 20:33:49 +02:00
Sebastian Dröge
ab14c50d1c
Ignore clippy::non_send_fields_in_send_ty
lint
...
It's useless in its current shape and wrongly triggering on all types.
See https://github.com/rust-lang/rust-clippy/issues/8045
2022-01-14 12:09:57 +02:00
Sebastian Dröge
86021d637b
fallbacksrc: Actually calculate running times of segment start/stop if the PTS is outside the segment
...
Previously it was just using the segment start/stop without converting
it to the corresponding running time.
2021-12-09 12:30:42 +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
c68f6b2631
Update for GLib signal emit_by_name()
API changes
2021-11-21 18:15:04 +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