Commit graph

372 commits

Author SHA1 Message Date
Guillaume Desmottes
03fcc2cb9a uriplaylistbin: implement Debug on State
Help debugging.
2022-04-22 14:50:28 +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
Guillaume Desmottes
5004479c6f uriplaylistbin: disable more tests
See https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/issues/194
2022-04-13 07:55:27 +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
Guillaume Desmottes
7daab76f17 uriplaylistbin: skip missing_http test
It's not reliable.
2022-04-08 16:18:03 +02:00
Guillaume Desmottes
00b3199727 Revert "Revert "uriplaylistbin: disable test deadlocking""
This reverts commit 821ec857e1.

Looks like the test is still unreliable. :(
2022-04-08 16:16:05 +02:00
Guillaume Desmottes
cde5fdf202 uriplaylistbin: break reference cycle
Passing ownership of item to the probe callback was introducing a reference cycle as the item is owning the sinkpad.
2022-04-08 15:50:48 +02:00
Guillaume Desmottes
ffdcc8167c uriplaylistbin: remove useless uridecodebin clone 2022-04-08 15:50:48 +02:00
Guillaume Desmottes
821ec857e1 Revert "uriplaylistbin: disable test deadlocking"
This reverts commit d9f3e8e9e7.

The test seems to work reliably so hopefully it's been fixed with the
latest dead lock fixes.

Fix #191
2022-04-08 12:58:13 +02:00
Guillaume Desmottes
69ceaa3a5e uriplaylistbin: add Status::ShuttingDown
Fix a race where we were trying to process new decodedin pads while the
element was being shutdown, resulting in a dead lock.
2022-04-08 12:58:13 +02:00
Guillaume Desmottes
0ed72a360d uriplaylistbin: replace errored with Status enum 2022-04-08 12:58:13 +02:00
Guillaume Desmottes
97dba9046b uridecodebin: stop using crossbeam_channel
I give up on crossbeam_channel. For some reasons some receivers are not
always unblocked and I was not able to reproduce using simpler test
cases.
Use with mpsc channels instead which are more reliable.
2022-04-08 12:58:13 +02: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
Guillaume Desmottes
bf14939b9b uriplaylistbin: remove pad probe when shutting down
The previous patch was unblocking the receiver in the pad probe but
it could be blocked again as the item streaming status was not changed.
2022-04-01 11:58:50 +02:00
Guillaume Desmottes
5dab4bc502 uriplaylistbin: handle waiting items no longer being set
ab96219c19 broke some assertions as
waiting items are now unset when shutting down the element.
2022-03-28 13:02:40 +02:00
Guillaume Desmottes
ab96219c19 uriplaylistbin: fix deadlock when shutting down
The probes on srcpad was not removed which was preventing the element to
reach the NULL state.
2022-03-28 10:10:42 +02:00
Guillaume Desmottes
e0d05353e8 uriplaylistbin: fix race when handling topology change
Keep the state mutex during the whole decodebin pad-added callback.
Fix a race when we were checking if state.waiting_for_ss_eos was set and
it was removed before we actually processed the item.

Fix #184
2022-03-25 14:33:02 +01: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
Guillaume Desmottes
d9f3e8e9e7 uriplaylistbin: disable test deadlocking 2022-02-28 16:48:13 +01: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
Guillaume Desmottes
52f5dc0185 uriplaylistbin: display invalid state when panicing
Will help debugging failing tests such as #184
2022-02-22 17:29:02 +01: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
42f9f99690 Update to parking_lot 0.12 and hrtf 0.8 2022-01-31 15:20:44 +02: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
763ad0cb18 Rename self_ variables to imp for consistency 2022-01-17 20:09:18 +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
Guillaume Desmottes
8bab034bc8 uriplaylistbin: fix license when registering plugin 2022-01-03 00:08:53 +01:00
Guillaume Desmottes
b7c08933aa uriplaylistbin: add properties reporting the current state of the playlist 2021-12-22 15:26:17 +01:00
Guillaume Desmottes
9783d01a35 uriplaylistbin: prevent overflow panic with infinite playlist
enumerate() will panic if the index overflows.
2021-12-22 12:53:11 +01:00
Guillaume Desmottes
4a5815cc97 uriplaylistbin: factor out create_items() 2021-12-22 12:53:11 +01:00
François Laignel
7c909e59a9 utils/togglerecord: fix race condition in sink_chain when segment is pending
In `sink_chain` when the Segment is pending, attempting to lock
rec state could lead to a dead lock because the stream state is
already locked while the main stream state was not locked.
2021-12-20 09:01:09 +00:00
François Laignel
a1c89dd17b utils/togglerecord: fix race condition checking other streams EOS state
Function `check_and_update_stream_start` checks whether other streams
reached EOS. The stream being checked might already have locked its
state. If it's about to check other streams too, this results in a
deadlock.

The problem was due to the `main_state` guard being dropped handling
event `StreamStart` checking whether the main stream is EOS:

```rust
    let main_is_eos = if let Some(main_state) = main_state {
        main_state.eos
    } else {
        false
    };
```

In the above code, `main_state` main state is comsumed and dropped
after evaluating `main_state.eos`.

This is also the case before handling event `Eos`.

This revealed another deadlock handling event `Eos` which is under
investigation.
2021-12-20 09:01:09 +00:00
Vivia Nikolaidou
2acb83da8f togglerecord: Handle stream-start event after EOS
It should restart any pending streams instead of keeping everything
EOS'd

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/622>
2021-12-14 14:34:50 +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
66e987c174 Fix a couple of new clippy warnings 2021-12-02 22:31:52 +02:00
Sebastian Dröge
423fa0d0a9 uriplaylistbin: Remove unnecessary & to fix clippy warning 2021-12-01 15:57:45 +02:00
Sebastian Dröge
13923051a0 Fix compilation after gst::Pad::sticky_events_foreach API changes 2021-12-01 15:33:45 +02:00
Sebastian Dröge
c46901d150 Fix or silence various new 1.57 clippy warnings 2021-11-30 16:31:50 +02:00
Guillaume Desmottes
f9a39b1138 add uriplaylistbin plugin
uriplaylistbin plays a list of URIs sequentially, ensuring gapless transitions
and proper streams synchronization.
2021-11-29 10:55:01 +01: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
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
Bilal Elmoussaoui
82be7b3ac5 adapt to ObjectExt improvements 2021-11-08 14:43:53 +02: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
0a7d1639e7 Update to Rust edition 2021 and minimum supported Rust version to 1.56 2021-10-31 17:40:05 +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
c5d3a2efce Update for event API changes 2021-10-17 17:30:38 +03:00
Sebastian Dröge
1a830c7c78 Update for glib::source_remove() removal 2021-10-12 06:31:53 +00:00
Vivia Nikolaidou
a132fdb8be togglerecord: Add is-live mode
No "gap eating" behaviour, will forward incoming segment
2021-10-04 16:44:04 +03:00
Vivia Nikolaidou
f6aa03b58a togglerecord: Fix lock ordering
Fixes deadlocks.

Correct lock ordering is:
1) Main stream state lock
2) Other stream state lock
3) Recording state lock
2021-10-04 13:18:20 +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
Vivia Nikolaidou
6f14ebdfee togglerecord: Notify main_stream_cond on release_pad
Otherwise, it would deadlock when releasing first the primary stream and
then the secondary one, because it will wait in the "secondary stream"
handling for the main stream to be fed, which will never happen.
2021-08-27 11:59:33 +03:00
Sebastian Dröge
4894e7b3ee
Update for fallible Object::set_property_from_str() 2021-08-17 15:01:25 +03:00
Sebastian Dröge
848b296390 Add capi feature to all plugin crates
This fixes the build with cargo-c 0.9.2.
2021-08-11 20:51:36 +03: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
Sebastian Dröge
24ec79cd1a Update versions to 0.8.0 for the master branch 2021-07-09 13:49:33 +03:00
Sebastian Dröge
1c3ae0f89a Update versions to 0.7.0 2021-07-09 13:49:21 +03:00
Mathieu Duponchelle
36b346e733 fallbacksrc: update-uri is not an action signal 2021-06-30 17:34:13 +02:00
Mathieu Duponchelle
d38a84ab79 fallbacksrc: add support for still images as primary
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/515>
2021-06-30 00:46:46 +00:00
Mathieu Duponchelle
ef41adf776 fallbacksrc: implement manual unblocking feature
This enables a use case for preparing slow to start up sources
ahead of time in a live cueing system, where a stream is scheduled
to start at some point in the future, and the application wants to
make sure it is ready for prime time by that time, instead of
spinning it up at the last moment and waiting for the stream to
actually come up.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/515>
2021-06-30 00:46:46 +00:00
Mathieu Duponchelle
29052b1acb fallbacksrc: implement send_event to forward EOS
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/515>
2021-06-30 00:46:46 +00:00
Mathieu Duponchelle
0b08f855c5 fallbacksrc: send EOS on fallback-only stream
When both audio and video are enabled, but the primary stream
only has either, when that stream ends we want to end the other
fallback-only stream as well.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/515>
2021-06-30 00:46:46 +00:00
Mathieu Duponchelle
a5a80281f3 fallbackswitch: output buffers ASAP at startup
When only the backup pad is receiving buffers, and the primary
pad is a bit slow to start up (eg network source with buffering),
it makes for a better UX to output buffers from the backup pad
while waiting for the network source to make its move.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/515>
2021-06-30 00:46:46 +00:00
François Laignel
5439f14e57 fix clippy warnings 2021-06-05 10:36:22 +02:00
François Laignel
c2de0649a7 utils: migrate to new ClockTime design 2021-06-05 10:36:21 +02:00
François Laignel
8dfc872544 use gst::glib where applicable 2021-06-03 20:53:16 +02:00
Sebastian Dröge
04a60b8f46 Update repository URL for gtk-rs "core" crates 2021-05-13 09:50:08 +03:00
Sebastian Dröge
9349b86b27 fallbackswitch: Fix compilation after gstreamer API changes 2021-05-05 10:34:02 +03:00
Bilal Elmoussaoui
78d9fb521d rename ToGlib into IntoGlib 2021-04-27 20:45:47 +02:00
Sebastian Dröge
15cf738616 Update for Value trait refactoring 2021-04-25 15:48:55 +03:00
François Laignel
95cdd43f4f manual fixes remove get prefix round 2 2021-04-20 18:19:58 +02:00
François Laignel
3203f57748 fallbackswitch: update base/aggregator* 2021-04-20 18:19:58 +02:00
François Laignel
67c5871957 fix-getters-calls 0.3.0 pass 2021-04-20 18:19:58 +02:00
François Laignel
27bc5c89ca fix-getters-def 0.3.0 pass 2021-04-20 18:19:58 +02:00
François Laignel
e573f0ba16 fallbackswitch: update base/aggregator* 2021-04-13 17:24:20 +02:00
François Laignel
7d17f88941 post fix-getters manual updates 2021-04-13 17:24:20 +02:00
François Laignel
06accc8d98 fix-getters-{def,calls} pass 2021-04-12 15:57:19 +02:00
Sebastian Dröge
c3fb55f235 examples: gtk::Application::new() is not fallible anymore 2021-04-12 11:53:40 +03:00
Sebastian Dröge
2bd4fc4728 examples: Update for gio::Application::run() API simplification 2021-04-08 07:37:25 +00:00
Matthew Waters
359c07203e gst: don't use volatile to mean atomic
volatile is not sufficient to provide atomic guarantees and real atomics
should be used instead.  GCC 11 has started warning about using volatile
with atomic operations.

https://gitlab.gnome.org/GNOME/glib/-/merge_requests/1719

Discovered in https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/issues/868
2021-03-19 17:24:25 +11:00
Sebastian Dröge
2cada57efc Update for the subclassing glib/gstreamer bindings API changes 2021-03-09 17:07:13 +02:00
Sebastian Dröge
9721b3e762 fallbackswitch: Update bundled aggregator bindings with glib subclass API cleanups 2021-03-08 12:43:05 +02:00
Sebastian Dröge
dc0c5f7611 Update for new #[glib::object_subclass] attribute macro 2021-03-07 18:27:00 +02:00
Sebastian Dröge
0616c18703 Update for changed GLib signals API 2021-02-22 17:20:40 +02:00
Sebastian Dröge
cbda137fbf Fix various warnings from clippy 1.50 2021-02-09 18:57:34 +02:00
Jan Schmidt
f63c4284c1 fallbackswitch: Fix draining of the backup pad.
When not autoswitching between the primary and fallback pad, make sure
to drain the disabled pad to the current running time, and fix the
drain_pad_to_time() function to use the correct running time variable.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/472>
2021-02-05 03:24:02 +11:00
Sebastian Dröge
b649e9b076 Use gst::PARAM_FLAG_MUTABLE_PLAYING and others consistently everywhere
Fixes https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/issues/139
2021-01-31 15:43:00 +02:00
Sebastian Dröge
d4ce1a33f2 Update for glib/gstreamer bindings API changes 2021-01-25 14:43:05 +02:00
Seungha Yang
084c9d1447 fallbackswitch,togglerecord: Don't apply clipped PTS to buffer DTS
Setting DTS on raw video buffers doesn't make sense and it's even wrong
in case of compressed video stream because PTS might be able to
go back when B frames are placed, but DTS is expected to be monotonically
increased.
2021-01-19 19:45:14 +09:00
Seungha Yang
2b7cebb02a togglerecord: Update recording state on EOS
If all input streams are in EOS state, update recording state
to Stopped and notify the change as well
2021-01-07 22:16:51 +09:00
Guillaume Desmottes
8bc2e5ebb8 use cargo-c to produce cdy and static libs
cargo-c will produce a pkg-config file making it easier to statically
link plugins.

Also add 'static' features for plugins depending on < 1.14 as this is the
minimal required version to use static linking because of ABI changes in
core.
2021-01-04 12:26:45 +01:00
Sebastian Dröge
c09dc96c2c togglerecord: Also check for flushing at the top of the chain function
It would return further down anyway but there's no point in doing
useless work if it can be avoided.
2020-12-31 12:06:18 +02:00
Sebastian Dröge
cdca6c9372 togglerecord: Check for flushing when the main stream waits for the other streams
Otherwise it would not wake up and return when shutting down the element.
2020-12-31 12:05:37 +02:00
Sebastian Dröge
3d617371af Update for macro renames 2020-12-20 20:43:45 +02:00
Sebastian Dröge
ea6c05e16c Update everything for glib macro renamings 2020-12-18 00:44:49 +02:00
Sebastian Dröge
708c6aa57e Update for new simplified glib::Object::new() API 2020-12-17 18:15:54 +02:00
Jan Schmidt
b80a607737 fallbackswitch: Reset fallback pad state on remove. 2020-12-11 13:02:00 +00:00
Jan Schmidt
f57ce41e89 fallbackswitch: Document return parameters for get_next_buffer()
The return type for get_next_buffer() is quite complex, so add some
comments about what is what.
2020-12-11 13:02:00 +00:00
Jan Schmidt
fddf33d339 fallbackswitch: Use pad as the debug object
Instead of using the aggregator as the object in debug statements
relating to pad dataflow, use the pad itself.
2020-12-11 13:02:00 +00:00
Jan Schmidt
34a2dd80a2 fallbackswitch: Move health checks to the OutputState.
Move some code to the OutputState from the fallbackswitch
struct to make things a bit cleaner.
2020-12-11 13:02:00 +00:00
Jan Schmidt
74f3de5674 fallbackswitch: Update for upstream changes 2020-12-11 13:02:00 +00:00
Jan Schmidt
d5b648921c fallbackswitch: Add manual stream control mode
Add properties to report and notify on stream health changes, and
a mode where the app can control the stream switching by setting
the active-pad property manually.

This is useful for modifying the policy of fallbackswitch stream
choices, and to synchronise switching of multiple fallbackswitches
2020-12-11 13:02:00 +00:00
Seungha Yang
c7fe08bf6d fallbacksrc: Fallback to videotestsrc if image fallback URI is invalid
... or on error from video fallback path
2020-12-11 12:35:26 +00:00
Sebastian Dröge
6aed1ed926 Remove various unneeded unwraps 2020-12-05 20:29:50 +02:00
Sebastian Dröge
767ed3afae utils: Update to 2018 edition 2020-11-23 10:28:34 +02:00
Sebastian Dröge
d56ae71e0e Update for ObjectImpl::get_property() being infallible now 2020-11-19 18:25:53 +02:00
Sebastian Dröge
df6a229f58 Fix or silence various clippy warnings 2020-11-19 15:31:50 +00:00
Guillaume Desmottes
b9f8ce9995 meson: add support for static build
There is no way to dynamically ask Cargo to build static or dynamic lib
so we have to build both and pick the one we care when doing the meson
processing.

Fix #88
2020-11-16 15:30:32 +01:00
Sebastian Dröge
b021a8bf10 utils: Update for subclassing API changes 2020-11-15 18:25:42 +02:00
Sebastian Dröge
9c48de75d8 Update for glib_wrapper! API changes 2020-11-07 13:14:00 +02:00
Sebastian Dröge
4c4ed6eed2 fallbackswitch: Update local version of aggregator bindings 2020-11-05 17:06:34 +02:00
Seungha Yang
c62bdb171a fallbacksrc: Don't give up to running even if segment event is unavailable on blocking probe
The blocking probe will be called on buffer or downstream event.
So segment event might not be available at that moment if it was
called by downstream events.
2020-11-03 05:13:20 +09:00
Sebastian Dröge
1f446f6b64 Switch to the combined gtk-rs and gstreamer-rs repositories 2020-11-01 10:24:57 +02:00
Seungha Yang
6390d85b5f fallbacksrc: Add statistics property
This property would be useful for application to understand
the internal status of fallbacksrc element.
2020-10-30 17:08:05 +09:00
Seungha Yang
1b546bb562 fallbacksrc: Ignore buffering message of restart was scheduled
In case that there is pending restart, fallbacksrc should not
try to add pad probe.
2020-10-22 02:25:52 +09:00
Seungha Yang
46af97219c fallbacksrc: Clear exisiting pad probe on restarting
Fallback might happen even after uridecodebin3 exposed pad.
For later use of audio and video streams, clear it if any
2020-10-22 02:23:22 +09:00
François Laignel
7c3e69bb4a Fix ClockTime comparisons not being Ord and use saturating_sub
See:
https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/607
2020-10-20 23:45:01 +02:00
Sebastian Dröge
bbc18d6349 Update for ClockId creation API changes 2020-10-20 12:49:51 +03:00
Sebastian Dröge
1e661e6d5b Update for gst::ClockId changes 2020-10-10 13:53:28 +03:00
Sebastian Dröge
4561b0bc3c utils/fallbacksrc: Add update-uri signal
This allows to update the URI just before configuring it on
uridecodebin3. It might be necessary to update the original URI because
it expired in the meantime, for example.
2020-09-28 16:54:42 +00:00
Sebastian Dröge
331374fabe utils/fallbackswitch: Use the correct segment when deciding to drop fallback buffers
Thanks to Jan Schmidt for noticing.
2020-09-28 14:39:10 +00:00
Sebastian Dröge
bf82e750f4 utils/fallbacksrc: Remove custom source elements from internal bin when shutting down
Otherwise we can't add it again later to a new bin when starting up again.
2020-09-26 12:24:05 +00:00
Sebastian Dröge
3b5d9b7392 examples: Update for glib API changes
Timeouts now use std::time::Duration instead of plain integers.
2020-09-14 16:47:27 +03:00
Sebastian Dröge
87025d7a02 Use glib::timeout_add_local() instead of removed gtk::timeout_add() 2020-08-27 09:50:33 +03:00
Sebastian Dröge
98b618cc9d utils/togglerecord: Fix timestamp tracking logic for partially overlapping timestamps
And various other cases. Also adjust one of the tests accordingly and
improve assertions to print more information about internal
inconsistencies.
2020-08-06 11:56:59 +00:00
Vivia Nikolaidou
a91e8aadb2 fallbackswitch: Consistently store running time in last_sinkpad_time
It was using buffer timestamps mixed with running time
2020-08-05 18:49:44 +00:00
Sebastian Dröge
4b171ec7ff utils/fallbacksrc: Remove pad probes before restarting the source
Otherwise the source might be blocked downstream in the pad probe on the
queue. Previously this was not a problem because the probes were
directly on the srcpads of the source but due to a workaround for
uridecodebin3 buffering bugs this is not the case anymore.
2020-08-04 10:37:08 +03:00
Sebastian Dröge
a2c0d70930 utils/fallbacksrc: Don't schedule a source restart timeout if the source is already pending restart 2020-08-04 10:36:45 +03:00
Sebastian Dröge
9ebcfbf333 utils/fallbacksrc: Improve debug output related to pad probes 2020-08-04 10:36:28 +03:00
Sebastian Dröge
0ce36c0f76 utils/fallbacksrc: Forward the state change return of custom sources
Without this, custom sources that are live are not actually considered
live.
2020-08-03 17:56:15 +03:00
Sebastian Dröge
42a3cf8bb2 utils/fallbacksrc: Fix debug output in pad probe callback
Let's print the name of the source's srcpad that is going to be blocked
instead of the "src" pad of the following queue. Without this it's hard
to distinguish the different streams from the logs.
2020-08-03 17:55:35 +03:00
Sebastian Dröge
30c711886e utils/fallbacksrc: Add a 1s queue between uridecodebin and clocksync and do buffering after the queue
This adds 1s more buffering (of uncompressed data), but works around
https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/issues/800
2020-07-30 14:53:18 +03:00
Sebastian Dröge
34fab8786f utils/fallbacksrc: Fix fallback stream detection if only audio or video is enabled 2020-07-30 14:35:34 +03:00
Sebastian Dröge
a022bbe260 Fix some new clippy warnings 2020-07-28 18:52:11 +03:00
Sebastian Dröge
0eb777cf5a Update for removal of ObjectImpl::get_type_data() 2020-07-26 18:46:32 +03:00
Sebastian Dröge
54c5612ac8 utils/fallbackswitch: Enable the v1_18 feature now that it exists 2020-07-10 13:06:28 +03:00
Sebastian Dröge
e9b61b733d Add LICENSE files to each individual crate 2020-07-10 13:06:28 +03:00
Sebastian Dröge
5e1ce7f9a7 utils/fallbacksrc: Proxy the uridecodebin3 buffer-duration property 2020-07-10 11:14:33 +03:00
Sebastian Dröge
2b892ec01a utils/fallbacksrc: Proxy the aggregator min-upstream-latency property as min-latency
The fallback stream will usually have a lower latency than the main
stream, so a too low latency would be configured if the fallback is
activated in the beginning.

This property allows to override this and does not require latency
reconfiguration.
2020-07-08 13:43:06 +03:00
Sebastian Dröge
45f547c4be fallbacksrc: Configure up to 5s of buffering on the fallback stream
imagefreeze in live mode can handle only up to 1 frame of buffering
itself.
2020-07-07 14:29:07 +03:00
Sebastian Dröge
879767599e utils/fallbackswitch: Allow buffers to be up to 40ms too late before considering them too late
This mirrors the processing-deadline property on various elements, but
for now just with a hardcoded value.
2020-07-07 10:21:24 +03:00
Sebastian Dröge
55f3349b39 utils/fallbackswitch: Timeout the main stream if buffers were too late for too long
Buffers are still forwarded until the timeout is reached even if they're
too late, but if they were continuously too late for more than the
duration of the timeout setting then switch to the fallback stream
instead.
2020-07-06 07:59:52 +00:00
Sebastian Dröge
daa6cfbb6a utils/fallbacksrc: Add property to optionally restart the source on EOS
EOS might be unexpected and the stream might be supposed to run forever,
in which case it should transparently be restarted on EOS.
2020-07-03 15:37:36 +03:00
Sebastian Dröge
2903d4a66c fallbacksrc: Refactor some code to reduce code duplication 2020-07-03 09:53:55 +03:00
Sebastian Dröge
7945de32eb fallbackswitch: Report None as active-pad if we had no output yet
Instead of the main stream, pretending all to be ok.
2020-07-02 14:46:59 +03:00
Sebastian Dröge
44ad0a2f52 fallbacksrc: Differentiate between fallback and restart timeout
This also fixes the bug that the source wouldn't be restarted another
time if we switched to the fallback stream before and didn't at least
shortly switch to the normal stream. There was no timeout for this.

Based on a patch by Mathieu Duponchelle <mathieu@centricular.com>
2020-07-02 14:46:59 +03:00
Mathieu Duponchelle
f7fc5bb0a3 fallbacksrc: add missing assignment to source_pending_timeout
b3138ad041 added the field for
that purpose, let's also use it!
2020-07-02 11:51:16 +03:00
Sebastian Dröge
2192c9d3b4 fallbacksrc: Unset ghost pad targets before removing from the element
Workaround for https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/553
2020-07-02 11:38:01 +03:00
Sebastian Dröge
a28455f0ce Update for Element::post_message() signature change 2020-06-30 21:28:02 +00:00
Sebastian Dröge
48c20471d5 Fix compilation after flags cleanup 2020-06-30 12:04:50 +03:00
Sebastian Dröge
d03c6cb26a Update various dependencies 2020-06-30 10:49:27 +03:00
Sebastian Dröge
86e983ef11 fallbacksrc: Try setting imagefreeze to live mode
Otherwise we would start outputting at running time 0, which is going to
be wrong if the pipeline was already running for a while.

Requires https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/653
2020-06-29 12:03:57 +03:00
Sebastian Dröge
f62c11f851 Update for functions returning a Builder being renamed to builder() instead of new()
And new video event APIs.
2020-06-25 19:49:07 +03:00
Sebastian Dröge
392bfc0b1e fallbacksrc: Create an identity sync=true if the new clocksync element can't be found 2020-06-25 13:58:22 +03:00
Sebastian Dröge
2e13e4ce73 fallbacksrc: Mark internal source property for custom sources as write/construct-only
It's only used during construction of the internal bin after all.
Keeping it readable would cause e.g. creating a pipeline graph trying to
read it, which is not implemented.
2020-06-25 13:47:45 +03:00
François Laignel
e40267e95d event,message,query: update instantiation
See https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/532
2020-06-25 11:26:32 +02:00
Sebastian Dröge
fe274ac6e7 fallbacksrc: Use new proxy_pad_chain_function() support when building pads
Less unsafe code.
2020-06-23 10:01:27 +03:00
Sebastian Dröge
9bb3e75fb9 Update to use the new pad builders for safely setting pad functions
Only two uses of unsafely setting the pad functions is left:
- fallbacksrc for overriding the chain function of the proxy pad of a
  ghost pad
- threadshare for overriding the pad functions after creationg, which
  probably needs some fixing at some point
2020-06-22 11:28:19 +03:00
Sebastian Dröge
60321edb8c Update for new_with_XXX/new_from_XXX function renaming 2020-06-16 11:56:48 +03:00
Guillaume Desmottes
e85799b9d6 use new constructor names 2020-06-11 13:07:01 +02:00