Commit graph

174 commits

Author SHA1 Message Date
Thibault Saunier 2fd28195ca Move files from gst-plugins-base into the "subprojects/gst-plugins-base/" subdir 2021-09-24 16:13:26 -03:00
Seungha Yang 87327110c2 videoaggregator: Don't try to return void
warning C4098: 'gst_video_aggregator_parallel_convert_pad_finalize':
'void' function returning a value

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1155>
2021-05-19 16:23:43 +09:00
Matthew Waters 8a5e5ddeeb video/aggregator: add parallel convert pad class
Each required conversion will be performed concurrently

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1129>
2021-05-17 19:20:57 +10:00
Matthew Waters 3d9e705621 videoaggregator: allow selecting an alpha output from non-alpha inputs
e.g. if we have:

video-x/raw,format=I420 ! compositor ! video/x-raw,format=BGRA

This will currently produce a warning as the alpha-ness of the chosen
'best' format (I420) will be different from the value restricted by the
downstream caps filter.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1059>
2021-03-31 01:55:17 +00:00
Matthew Waters 98249a57db 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

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1073>
2021-03-19 04:20:19 +00:00
Edward Hervey 65b6994df6 videoaggregator: Pop out old buffers on timeout
This situation happens in the situation where an input stream has a framerate
exceeding the timeout latency (Ex: 1fps with a latency of 500ms) and an input
stream greater than output framerate (ex: 60fps in, 30 fps out).

The problem that would happen is that we would timeout, but then buffers from
the fast input stream would only be popped out one by one.... until a buffer
reaches the low-framerate input stream at which point they would quickly be
popped out/used. The resulting output would be "slow ... fast ... slow ... fast"
of that input fast stream.

In order to avoid this situation, whenever we detect a late buffer, check if
there's a next one and re-check with that one.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/990>
2020-12-30 16:03:13 +01:00
Fabrice Fontaine d86cf6314f gst-libs/gst/video/gstvideoaggregator.c: fix build with gcc 4.8
Fix the following build failure with gcc 4.8 which has been added with
d268c193ad:

../gst-libs/gst/video/gstvideoaggregator.c: In function 'gst_video_aggregator_init':
../gst-libs/gst/video/gstvideoaggregator.c:2762:3: error: 'for' loop initial declarations are only allowed in C99 mode
   for (gint i = 0; i < gst_caps_get_size (src_template); i++) {
   ^

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/974>
2020-12-14 16:42:01 +00:00
Seungha Yang a4ba868225 video: Make use of gst_video_chroma_site_{from,to}_string() API
Replace deprecated gst_video_chroma_{from,to}_string()
to newly added gst_video_chroma_site_{from,to}_string()

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/927>
2020-12-08 07:21:28 +00:00
Mathieu Duponchelle c50f4477ec video-converter: switch to using a task pool ..
.. and make use of that API in videoaggregator.

When setting certain properties, such as cropping or the scaled
size of pads, a new converter is created by videoaggregator.

Before that patch, this implied spawning new threads, potentially
at each aggregate cycle when interpolating pad properties. This
is obviously wasteful, and re-using a task pool removes that
overhead.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/896>
2020-11-12 17:38:34 +00:00
Jan Alexander Steffens (heftig) b3fe2d3623 videoaggregator: Fix locking around vagg->info
Take `GST_OBJECT_LOCK` when writing `vagg->info`, so that reading in
subclasses is protected against races, as documented in the struct.

    /*< public >*/
    /* read-only, with OBJECT_LOCK */
    GstVideoInfo                  info;

`gst_video_aggregator_default_negotiated_src_caps` should take the
`GST_VIDEO_AGGREGATOR_LOCK` to avoid racing with
`gst_video_aggregator_reset` called by
`gst_video_aggregator_release_pad` of the last sinkpad. Otherwise it can
happen that `latency = gst_util_uint64_scale (...` gets called with a
zero framerate.

There doesn't seem to be any reason not to use the local `info` instead
of `vagg->info`, so do that.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/915>
2020-11-09 16:04:06 +00:00
Thibault Saunier d268c193ad videoaggregator: Guarantee that the output format is supported
In the case `videoaggregator` is set as allowing format conversions,
and as we convert only on the sinkpads, we should ensure that the
chosen format is usable by the subclass. This in turns implies
that the format is usable on the srcpad.

When doing conversion *any* format can be used on the sinkpads, and this
is the only way that we can avoid race conditions during renegotiations
so we can not change that fact, we just need to ensure that the chosen
intermediary format is usable, which was not actually ensured before
that patch.

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

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/909>
2020-11-03 00:10:31 +00:00
Thibault Saunier 69b5cb8a10 video-aggregator: Fix renegotiation when using convert pads
Since 23189c60f4 we started using the
useless result of `modified_caps` which, was never used since it was
introduced 7 years ago (in videomixer2). The intersection is useless and
we should just avoid doing it at all (which was always the case before)
as it can end up failing renegotiation for bad reasons.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/905>
2020-10-29 23:40:21 +00:00
Mathieu Duponchelle eb216e3865 videoaggregator: document and fix locking in convert pad
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/897>
2020-10-28 15:59:14 +00:00
Jan Alexander Steffens (heftig) 23189c60f4 videoaggregator: Limit accepted caps by template caps
This seems like an obvious mistake, since `modified_caps` was created
but not used.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/868>
2020-10-13 15:41:38 +02:00
Jan Alexander Steffens (heftig) 77c327f356 videoaggregator: Log the format name instead of index
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/868>
2020-10-13 15:41:37 +02:00
Matthew Waters b4ea8332f5 videoaggregator: ensure peek_next_sample() uses the correct caps
gst_pad_get_current_caps() may be wrong when there is a renegotiation in
progress for the pad and we have not yet received or selected the buffer
with different caps yet.

Fix by storing the caps through in a similar way to the existing code
for buffer/video-info selection machinery.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/813>
2020-09-11 22:08:30 +10:00
Sebastian Dröge f54ef6c74e videoaggregator: Don't require any pads to be configured for negotiating source pad caps
This is not actually required (anymore?). Source pad caps can be
negotiated at any time regardless of any configured (or existing) sink
pads and videoaggregator comes up with some fixated caps based on the
downstream caps.

Subclasses can override this behaviour as needed by overriding
update_src_caps().

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/793>
2020-09-09 11:35:02 +00:00
Sebastian Dröge 61064257ef videoaggregator: Update for additional info parameter to the "samples-selected" signal
See https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/590

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/780>
2020-08-07 09:34:37 +03:00
Mathieu Duponchelle 1de8af6f8b videoaggregator: update to new samples selection API
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/778>
2020-08-05 20:09:52 +02:00
Mathieu Duponchelle 2faeb7d394 videoaggregator: implement samples selection API
Call gst_aggregator_selected_samples() after filling the queues
(but before preparing frames).

Implement GstAggregator.peek_next_sample.

Add an example that demonstrates usage of the new API in combination
with the existing buffer-consumed signal.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/728>
2020-07-31 07:54:56 +00:00
Sebastian Dröge 637bbac622 videoaggregator: Don't crash when setting pad properties after the aggregator was finalized
The application might still have a strong reference to a pad and change
properties, which should work without crashing.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/649>
2020-05-01 10:41:29 +00:00
Matthew Waters 476eaf9425 videoaggregator: fix gir warning about invalid doc comment
[38/1301] Generating GstVideo-1.0.gir with a custom command.
../subprojects/gst-plugins-base/gst-libs/gst/video/gstvideoaggregator.c:231: Error: GstVideo: identifier not found on the first line:
   *
    ^
2020-04-01 20:05:06 +11:00
Mathieu Duponchelle fb1c284026 gstvideoaggregator: expose max-last-buffer-repeat property on pads
This can be used to have compositor display either the background
or a stream on a lower zorder after a live input stream freezes
for a certain amount of time, for example because of network
issues.
2020-03-31 18:24:45 +02:00
Mathieu Duponchelle 54cc985810 videoaggregator: handle gap buffers properly
This simply implies not trying to "prepare" those buffers,
as mapping an empty buffer to a video frame does not make
much sense.

This also adds a simple test in compositor that performs
some trivial checking of the handling of gap events, the test
was not failing before, but an error was logged, this is
no longer the case.

Fixes #717
2020-01-30 19:02:44 +01:00
Sebastian Dröge 72cb0c0641 videoaggregator: Don't configure NULL chroma-site/colorimetry
If there's no known value in the best caps then the functions to convert
them to strings will return NULL. Having the fields not in the caps is
not a problem, having them with a NULL value however will cause
negotiation failures.
2020-01-28 22:07:44 +02:00
Mathieu Duponchelle 64d2e6b70d gstvideoaggregator: always update converter when needed
In prepare_frame, it is not enough for the target info
(conversion_info) to not have changed to decide not to update
the converter, as the vpad info may have changed as well.

Fixes #714
2019-12-27 11:57:22 +00:00
Mart Raudsepp 65f2bb8fa2 videoaggregator: don't let a repeat-after-eos pad prevent EOS
.. if there are pads present that are not repeating after EOS.

Fixes #664
2019-11-27 22:21:14 +02:00
Sebastian Dröge 5ebf6c2fac videoaggregator: We can only convert the format if a GstVideoAggregatorConvertPad is used
Otherwise assume that we can at least support any framerate.
2019-07-18 08:43:14 +03:00
Thibault Saunier 287897e465 doc: Fix some gtk-doc comments 2019-05-13 11:34:08 -04:00
Mathieu Duponchelle a35d500eae videoaggregator: fix buffer skipping with pad offsets
The ->skip_buffer implementation in videoaggregator replicates
the behaviour of the aggregate method to determine whether a
buffer can be skipped
(https://bugzilla.gnome.org/show_bug.cgi?id=781928).

This fixes a typo that made it so the start time of the buffer
was calculated against the output segment, not the segment of
the relevant sinkpad, which caused buffers to be skipped when
for example a sinkpad had received a segment which base had
been modified by a pad offset somewhere along the way.

This simply makes the calculation of the buffer start time
identical to the calculation in aggregate()
2019-03-08 07:40:25 +00:00
Olivier Crête 6a8c15f3bd video-aggregator: Sync property values to output timestamp
The properties need to be change at every output frame based on the output
time because they may change even though the input frame is not changing.
2019-03-07 14:43:06 -05:00
George Kiagiadakis 358ed9f9b4 videoaggregator: remove broken rate adjustment
The start_time and end_time in this context have already
been adjusted for the input's rate by converting them to running
time above. What is needed afterwards is to compare these
with the output's start/stop running time, which also takes
into account the rate, so we are comparing equal things.

Multiplying these with the output's rate here is only breaking
this logic. In most cases the input and output rate is the same,
so this multiplication effectively reverses the rate adjustment
that happened while converting to running time, which is why
we see the video playing with the original rate in tests.

Fixes #541
2019-01-18 11:33:33 +01:00
Sebastian Dröge 8430e47006 videoaggregator: Make sure to hold object lock while iterating sink pads
They might otherwise just change while we iterate.
2018-08-16 10:03:19 +03:00
Tim-Philipp Müller b342955a64 videoaggregator: Update for g_type_class_add_private() deprecation in recent GLib 2018-06-24 01:47:29 +02:00
Seungha Yang 5934fb1bb6 videoaggregator: Fix string leak
gst_video_colorimetry_to_string() returns allocated memory which
must be freed.

https://bugzilla.gnome.org/show_bug.cgi?id=796596
2018-06-15 10:17:14 -04:00
Tim-Philipp Müller ecd58f2775 videoaggregator: log an ERROR if we're going to return a flow error 2018-06-11 13:48:09 +01:00
Olivier Crête 91692122d3 videoaggregator: Remove custom get_next_time implementation
GstAggregator now has the same thing in the simple implementation.

https://bugzilla.gnome.org/show_bug.cgi?id=795486
2018-05-16 22:24:18 +02:00
Sebastian Dröge c43bae0a42 videoaggregator: Set video-meta option on buffer pool configuration correctly
CID 1435451
2018-05-07 17:53:32 +03:00
Sebastian Dröge 4291ee94c4 videoaggregator: First override set/get_property vfuncs, then install properties
Gives assertions otherwise.
2018-05-07 09:17:16 +02:00
Mathieu Duponchelle 1492fb4ef9 videoaggregator: expose converter-config on convert pads
This in order to allow users control over the conversion
process, for example the scaling method.
2018-05-06 16:45:43 +02:00
Sebastian Dröge 049877e5d0 videoaggregator: Fix up documentation some more 2018-05-06 16:43:32 +02:00
Sebastian Dröge 9d6d46f4cb videoaggregator: Clean up header and update docs a bit 2018-05-06 16:22:01 +02:00
Sebastian Dröge dbb21615c4 videoaggregator: Rename get_output_buffer() to create_output_buffer()
For consistency with GstAudioAggregator.
2018-05-06 16:05:28 +02:00
Sebastian Dröge 429e6c8532 videoaggregator: Validate pool configuration and create a new pool if it just does not work
Also pass the given allocator to the pool if one is set.
2018-05-06 15:49:36 +02:00
Sebastian Dröge 33a8e28207 videoaggregator: Switch to a GstVideoAggregatorConvertPad subclass
This moves all the conversion related code to a single place, allows
less code-duplication inside compositor and makes the glmixer code less
awkward. It's also the same pattern as used by GstAudioAggregator.
2018-05-06 15:22:51 +02:00
Sebastian Dröge b73b7230d2 videoaggregator: Remove sink_non_alpha_caps class field
This is only used for caching reasons and should never actually be in
the public API. If this is ever a bottleneck later, caching around a
class private struct could be implemented.
2018-05-05 16:32:19 +02:00
Sebastian Dröge 233ee9f077 videoaggregator: Move needs_alpha pad field to the private struct
And also trigger renegotiation if the value has changed.

https://bugzilla.gnome.org/show_bug.cgi?id=795836
2018-05-05 16:32:19 +02:00
Sebastian Dröge 1c8110ab17 videoaggregator: Move aggregated_frame and the pad buffer into the private struct
The aggregated_frame is now called prepared_frame and passed to the
prepare_frame and cleanup_frame virtual methods directly. For the
currently queued buffer there is a method on the video aggregator pad
now.
2018-05-05 16:32:19 +02:00
Sebastian Dröge 8b231d502c videoaggregator: Move property storage to private pad struct 2018-05-04 17:18:12 +02:00
Sebastian Dröge 51c359dda6 videoaggregator: Rename ignore-eos pad property to repeat-after-eos
What it does is to repeat the last frame forever after EOS, it does not
literally ignore EOS.
2018-05-04 16:46:00 +02:00