Commit graph

196 commits

Author SHA1 Message Date
Jan Alexander Steffens (heftig) 97601e49cb input-selector: Use proper segments when cleaning cached buffers
We need to use the segment associated with the cached buffer, not the
current segment of the pad, otherwise we miscalculate the running time
of cached buffers from before a segment change.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/859>
2021-07-28 09:47:03 +00:00
Stéphane Cerveau 783e19b04c coreelements: allow per features registration
Split plugin into features including
dynamic types which can be indiviually
registered during a static build.

More details here:

https://gitlab.freedesktop.org/gstreamer/gst-build/-/merge_requests/199
https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/661

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/661>
2020-12-10 12:45:16 +01:00
Sebastian Dröge 5bab6154aa input-selector: Wake up blocking pads when releasing them
Otherwise deactivating them will cause a deadlock as they're blocking
inside the streaming thread.

Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/601

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/606>
2020-09-09 06:53:00 +00:00
Thibault Saunier 9d195da36c inputselector: Push event on selected pad only when one is selected
Calling `gst_input_selector_get_active_sinkpad` triggers sinkpad
selection but won't notify about it, leading  to breaking code that
relying on it. This new code added as part of
63ccf45395 was thought to be triggered only
when a pad was already selected and not change the behavior otherwise
so this commit makes sure it is actually the case.

Fixes https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/issues/766

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/522>
2020-06-15 17:33:22 +00:00
Mathieu Duponchelle 0c1ce6e8c4 utils: expose GstPluginAPIFlags
These can be passed to gst_type_mark_as_plugin_api, to inform
plugin cache generation.

For now a single flag is specified, "IGNORE_ENUM_MEMBERS", it
can be used for dynamically generated enums to avoid documenting
environment-specific enumeration members. An example is
GstX265EncTune.
2020-06-06 00:38:29 +02:00
Edward Hervey f2478618b5 inputselector: Avoid deadlock when requesting pads
The deadlock was the following:
* One thread requests a new pad, the internal lock is kept while adding the pad
* Another thread (or the same one) requests the internal links of a pad (could
be that pad)... which also requires that lock.

That internal lock is not required when adding the pad to the element (which is
the last action when requesting a new pad). The fact it will be actually used
will be *after* the request pad function is released.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/512>
2020-06-05 09:59:15 +00:00
Sebastian Dröge 5bdbde32da plugins: Use gst_type_mark_as_plugin_api() for all non-element plugin types 2020-06-04 15:49:24 -04:00
Thibault Saunier 24d789a9b5 input-selector: Ensure events are forwarded only once per pad
The code was prepared to do it but was missing to fill the pushed_pads
list.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/485>
2020-05-15 13:51:43 +00:00
Thibault Saunier 63ccf45395 inputselector: Ensure that events are pushed first on active pad
Making it less random and fixing a race in a GES test where we have
as pipeline:

```
videotestsrc ! output-selector name=s ! input-selector name=i s. ! timecodestamper ! i.
```

which we seek, leading to the seek reaching the video testsrc
without going through the timecodestamper and generating a buffer
even before timecodestamper gets the seek which means that its internal
state is wrong compared to the datastream it gets and attaches wrong
timecode metas.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/485>
2020-05-15 13:51:43 +00:00
Thibault Saunier 9f2e9ccd7e inputselector: Never reset active pad set from the user
This was leading to interesting races in a GES test.
Related to: https://gitlab.freedesktop.org/gstreamer/gst-editing-services/-/issues/108

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/481>
2020-05-14 22:15:12 +00:00
Philippe Normand 9f5e65f0a2 input-selector: Let context queries pass through
By doing so GL source elements can successfully reuse the GL context and display
of downstream elements. This change fixes an issue in playbin when using
gltestsrc where the context query made by the source element would fail and the
source element would create a second (useless) GLDisplay.
2018-11-28 11:00:21 +00:00
Sebastian Dröge 95fcced84d input-selector: Bring latency handling in sync with GstPad code 2018-08-31 12:16:43 +03:00
Sebastian Dröge 7c179e3f58 input-selector: Apply GstPad default latency handler fixes here too 2018-08-31 11:47:03 +03:00
Sebastian Dröge ef9619200b inputselector: Forward LATENCY query to all sinkpads
Otherwise downstream will consider the pipeline not live if the active
pad is live, even though some inactive pads might be live and might
require a non-zero latency configuration.

https://bugzilla.gnome.org/show_bug.cgi?id=796901
2018-08-01 14:23:04 +03:00
luz.paz 4a402c1c7d Fix typos in comments and docs
Found via `codespell`

https://bugzilla.gnome.org/show_bug.cgi?id=795610
2018-05-01 11:18:03 +01:00
Tim-Philipp Müller 21decc643b multiqueue, inputselector: show pad properties in gst-inspect-1.0 2018-04-17 18:57:20 +01:00
Tim-Philipp Müller 65e0907798 inputselector, outputselector: add guards for wrong pads being set as active pads
Catch users wrongly setting foreign pads or wrong pads as
the selector's active pad, which leads to all kinds of
other issues. It's a programming error so handle it just
like we would if we had direct API.

https://bugzilla.gnome.org/show_bug.cgi?id=795309
2018-04-17 18:57:17 +01:00
Seungha Yang 89082272f8 inputselector: Always proxy position/duration query
active-pad switch causes reconfigure event with lock taken,
and upstream element might query the current position or duration
before returning the reconfigure event.
Meanwhile, gst_input_selector_get_linked_pad() is used to get srcpad
inside of default query handle, and it takes also lock.
Since inputselector is still locked by active-pad switch, and so the query
cannot be handled further.

https://bugzilla.gnome.org/show_bug.cgi?id=775445
2017-03-07 12:48:47 +02:00
Thibault Saunier a87b4551a6 Port gtk-doc comments to their equivalent markdown syntax
Modernizing our documentation and preparing a possible move to hotdoc.
This commits also adds missing @title metadatas to all SECTIONs
2017-01-27 16:36:38 -03:00
Jan Schmidt b50a12b8ac inputselector: Handle stream-group-done
Handle the new stream-group-done message to unblock pads which
are waiting for the running time to advance on that group.

https://bugzilla.gnome.org/show_bug.cgi?id=768995
2016-07-25 20:22:20 +10:00
Jan Schmidt 4981e09bc7 inputselector: Wake other pads when selected goes EOS
Other pads that are waiting for the stream on the selected
pad to advance before they finish waiting themselves
should be given the chance to do so when the selected pad
goes EOS. Fixes problems where input streams can end up
waiting forever if the active stream goes EOS earlier than
their own end time.
2016-07-25 19:34:52 +10:00
Tim-Philipp Müller cf0680017e elements: use new gst_element_class_add_static_pad_template()
https://bugzilla.gnome.org/show_bug.cgi?id=762778
2016-02-28 13:10:07 +00:00
Eunhae Choi ebd2748cd0 inputselector: Fix buffer leak in sync_streams & cache_buffers mode
After doing gst_pad_push() in case of sync_streams and cache_buffers,
if the buffer can not be kept in cache, it should be unreffed to avoid
memory leackage.

https://bugzilla.gnome.org/show_bug.cgi?id=755141
2015-09-21 10:33:55 +02:00
Luis de Bethencourt c635f38cdc inputselector: remove always-true check
event can't be NULL, it has been dereferenced by GST_EVENT_TYPE (), and no
case frees the pointer. Remove unnecessary check which will always be True.

CID #1308955
2015-07-02 15:10:58 +01:00
Song Bing e9c9a1e3e2 inputselector: Handle different duration track selection
Support track switch from EOS track to non-EOS one.

https://bugzilla.gnome.org/show_bug.cgi?id=750761
2015-06-23 15:28:13 +02:00
Thiago Santos 88a898080a inputselector: Only try to push the first EOS received
Subsequent EOS will push on the source pad that already received
EOS and that will make the event function return FALSE. It needs
only to push the first one and only return TRUE for the subsequent
ones.
2015-04-24 17:19:49 -03:00
Guillaume Desmottes b15e6f4bf0 inputselector: fix cached buffer leak in chain function
gst_selector_pad_chain() was popping cached buffers out of the queue without
freeing those. Make sure we don't steal the GstBuffer as the cached buffer ref
has been passed to the pad chain function.

This can be reproduced by running the
validate.file.playback.switch_subtitle_track_while_paused.test5_mkv scenario
with Valgrind.

https://bugzilla.gnome.org/show_bug.cgi?id=747611

Signed-off-by: Guillaume Desmottes <guillaume.desmottes@collabora.co.uk>
2015-04-10 09:27:30 -03:00
Jan Alexander Steffens (heftig) 27644a6bd2 input-selector: Rename _activate_sinkpad to _get_active_sinkpad
Removes the now unused 'pad' parameter and renames the function
to something more appropriate.

https://bugzilla.gnome.org/show_bug.cgi?id=739620
2015-03-24 10:34:27 -03:00
Jan Alexander Steffens (heftig) bf8a71104c input-selector: Remove pad's 'active' field
This is now never read.

https://bugzilla.gnome.org/show_bug.cgi?id=739620
2015-03-24 10:34:27 -03:00
Jan Alexander Steffens (heftig) 6f24f4917d input-selector: Use segment-presence for running_time check
When determining whether the running_time of a pad can be
calculated, check if the segment is in TIME format instead
of using the 'active' field.

Since the latter is set through *any* activity, it's not a
reliable indicator of segment presence.

https://bugzilla.gnome.org/show_bug.cgi?id=739620
2015-03-24 10:34:27 -03:00
Jan Alexander Steffens (heftig) 0a3ded1932 input-selector: Remove 'blocked' flag
With the disappearance of the 'block' signal, this
flag cannot be set to TRUE.

gst_input_selector_wait disappears as it never waits
and just returns self->flushing.

https://bugzilla.gnome.org/show_bug.cgi?id=736891
2015-03-24 09:42:14 -03:00
Jan Alexander Steffens (heftig) 7a1ebbe0e3 input-selector: Remove obsolete 'block' signal
This signal blocks the input-selector with no means of unblocking
other than a state change back to READY. It seems this signal was
part of an old way of synchronously switching the selector,
together with the already-removed 'switch' signal.

Removing the signal is safe, as attempting to use it could only
end in deadlocks. Attempting to emit an unknown signal just causes
g_criticals.

https://bugzilla.gnome.org/show_bug.cgi?id=736891
2015-03-24 09:42:14 -03:00
Jan Alexander Steffens (heftig) ce663311e1 input-selector: Fix waiting on EOS
This apparently got broken by bc1ec4e. Since self->blocked is always
FALSE, gst_input_selector_wait never actually waits.

Using (!self->eos || self->blocked) && ... as the loop condition would
be incorrect as well, because then the other call to the function in
_chain would block until EOS, so the functions cannot be merged trivially.

Since blocking is obsolete, gst_input_selector_wait will get removed anyway.
As such, just inline the loop.

https://bugzilla.gnome.org/show_bug.cgi?id=746518
2015-03-24 09:28:44 -03:00
Arun Raghavan 49a4951a0c input-selector: Drop custom latency query handling
The default latency query handler now implements this logic
2015-02-27 00:49:06 +05:30
Sebastian Dröge 66e8d3b9a0 inputselector: Use a separate query for upstream pads and let it fail if one upstream query fails 2015-02-19 01:16:52 +02:00
Sebastian Dröge 29d8b9df8b inputselector: Don't dereference NULL pointer
CID 1262286
2015-01-12 16:03:31 +01:00
Tim-Philipp Müller 3390b70d78 inputselector: fix silly GQueue iteration code
Not active by default though.
2015-01-05 00:22:11 +00:00
Sebastian Dröge bc1ec4ec5f inputselector: Use the same waiting function for EOS and non-EOS waiting 2014-12-24 13:46:28 +01:00
Sebastian Dröge a1c183417f inputselector: Wake up all waitings pads directly if we forward the EOS event
Otherwise they might wait a bit longer unnecessarily.

Also do some minor cleanup.
2014-12-24 13:44:09 +01:00
Song Bing 11e4b744f5 inputselector: Block when receiving an EOS event on a deactivated pad
... and only unblock when either a) the pad becomes active and the event
should be forwarded or b) the active pad went EOS itself.

Otherwise it can happen that we switch from a longer track that is not EOS yet
to a shorter track that already is EOS, but the shorter track won't have any
possibility to send its EOS event downstream anymore.

https://bugzilla.gnome.org/show_bug.cgi?id=740949
2014-12-24 13:33:12 +01:00
Sebastian Dröge 12a905929f inputselector: Keep a ref of the currently active sinkpad around
Otherwise we can't be sure that the pointer points to a still existing
pad instance after releasing the lock.
2014-12-23 12:54:50 +01:00
Song Bing 3137043c3a inputselector: Get the active sinkpad again after taking the lock when handling events
It might have changed in the meantime.

https://bugzilla.gnome.org/show_bug.cgi?id=741893
2014-12-23 12:53:58 +01:00
Sebastian Dröge 154eefecc9 Don't compare booleans for equality to TRUE and FALSE
TRUE is 1, but every other non-zero value is also considered true. Comparing
for equality with TRUE would only consider 1 but not the others.

Also normalize booleans in a few places.
2014-12-01 09:51:37 +01:00
Tim-Philipp Müller 64a0abb0f4 inputselector: fix compilation 2014-10-03 14:04:58 +01:00
Stefan Sauer e3dc7366bd input-selector: extract some common code into helpers 2014-10-03 14:44:48 +02:00
Stefan Sauer 8285002693 input-selector: small code cleanups
Rename TIMESTAMP -> PTS. Move a var down to the scope where it is used. Use
g_queue_free_full().
2014-10-03 14:22:01 +02:00
Stefan Sauer d8bee3c769 inputselector: fix printf format
The padcount is uint. Also add comments to the instance vars.
2014-10-03 13:47:42 +02:00
Tim-Philipp Müller 49c6f923de coreelements: mark properties with MUTABLE_PLAYING 2014-09-14 16:08:07 +01:00
Thiago Santos 3001f3b433 inputselector: always proxy caps query
Otherwise it would only be proxied for the active pad which can lead
upstream to use an incompatible caps for the downstream element.

Even if a reconfigure event is sent upstream when the pad is activated, this
will save the caps reconfiguration if it is already using an acceptable caps.
2014-08-14 19:16:43 -03:00
Jan Schmidt a89789366f input-selector: Hold pad object lock when changing tags
Avoid spurious crashes when tags are retrieved just as
new ones arrive.
2014-04-11 22:39:36 +10:00