Commit graph

1764 commits

Author SHA1 Message Date
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
Vivia Nikolaidou 1517b7043d video-converter: Don't upsample/downsample/dither invalid lines
This is a fallout from the conversion to support multiple threads.
convert->upsample_p is never NULL now, it's always an allocated array of
n_threads potentially-null pointers.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1043>
2021-02-23 03:40:12 +00:00
Alicia Boya García 29aeba639a videodecoder: Fix racy critical when pool negotiation occurs during flush
I found a rather reproducible race in a WebKit LayoutTest when a player
was intantiated and a VP8/9 video was loaded, then torn down after
getting the video dimensions from the caps.

The crash occurs during the handling of the first frame by gstvpxdec.
The following actions happen sequentially leading to a crash.

(MT=Main Thread, ST=Streaming Thread)

MT: Sets pipeline state to NULL, which deactivates vpxdec's srcpad,
    which in turn sets its FLUSHING flag.

ST: gst_vpx_dec_handle_frame() -- which is still running -- calls
    gst_video_decoder_allocate_output_frame(); this in turn calls
    gst_video_decoder_negotiate_unlocked() which fails because the
    srcpad is FLUSHING. As a direct consequence of the negotiation
    failure, a pool is NOT set.

    gst_video_decoder_negotiate_unlocked() still assumes there is a
    pool, crashing in a critical in gst_buffer_pool_acquire_buffer()
    a couple statements later.

This patch fixes the bug by returning != GST_FLOW_OK when the
negotiation fails. If the srcpad is FLUSHING, GST_FLOW_FLUSHING is
returned, otherwise GST_FLOW_ERROR is used.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1031>
2021-02-16 16:57:54 +00:00
Vivia Nikolaidou ca4240bd03 videoconvert: Support for alternate-field interlacing
Treat the data just like normal data with half the height. Also treat it
as progressive when converting from/to I420 because it requires
different handling for chroma subsampling.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1027>
2021-02-04 18:22:07 +02:00
Jakub Adam 11e6f8da92 video-hdr: Add API to check content light level equality
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/969>
2021-01-28 20:55:38 +01:00
Marijn Suijten abb026ec6a gl,video: Make ptrs to VideoInfo and (GL)AllocationParams immutable
These parameters are incorrectly regarded as mutable in G-IR making them
"incompatible" with languages that are explicit about mutability like
Rust. In order to clean up the code and expected API there, update the
signatures here, right at the source (instead of overriding them in
Gir.toml and hoping for the best).

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1005>
2021-01-14 11:53:10 +00:00
Marijn Suijten c70d263e48 video/video-frame: @frame in video_frame_map is out caller-allocates
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1005>
2021-01-14 11:53:10 +00:00
Marijn Suijten a263919f06 audio,video: Add out caller-allocates to init and from_caps
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1005>
2021-01-14 11:53:10 +00:00
Sebastian Dröge 7e16eed522 videosink: Add new GstVideoSink::set_info() virtual method
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/986>
2021-01-14 11:15:40 +00:00
Sebastian Dröge 198434e71a videosink: Implement more complete BaseSink::get_times() based on the framerate
This will only make use of the framerate if the subclass is chaining up
BaseSink::set_caps(). Otherwise it will have the same behaviour as the
basesink default.

Doing so is useful if video buffers don't contain a duration to
calculate a default duration, and various video sinks already implement
a custom version of this.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/986>
2021-01-14 11:15:40 +00:00
Marijn Suijten 1f06cf60e7 video: Convert info_to_caps to take self as const ptr
This requires a slight modification to the function itself because it
was overwriting a member locally.

However, now this side-effect cannot be observed outside the function
anymore.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1008>
2021-01-14 08:14:36 +00:00
Jakub Adam 2d198ff10b video-blend: fix blending 8-bit and 16-bit frames together
Replace hardcoded 255s with the correct max value for the given color
depth. Use 64-bit integer in calculations where overflow may occur.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1000>
2021-01-08 08:04:55 +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
Stéphane Cerveau f76b731cbf hdr: update doc
update GST_VIDEO_HDR10_PLUS_MAX_ROWS_MD_APL and
GST_VIDEO_HDR10_PLUS_MAX_COLS_MD_APL

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/979>
2020-12-15 23:50:12 +01:00
Stéphane Cerveau 9b852181d8 videodecoder: Forward hdr-format info downstream
By default the hdr-format detected by a parser should
be passed to the downstream element.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/650>
2020-12-15 16:37:46 +00:00
Stéphane Cerveau 631489de23 video-hdr: add hdr formats
Provide enum and helper method to set the hdr format
name in caps by example.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/650>
2020-12-15 16:37:46 +00:00
Stéphane Cerveau a1ed7a8f49 video-hdr: introduce HDR10+ parser
Video can now parse a HDR10+ data structure
coming from a SEI message.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/650>
2020-12-15 16:37:46 +00:00
Stéphane Cerveau 7d6f72e956 video-hdr: add HDR10+ structure
Provides structure and GstVideoMeta

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/650>
2020-12-15 16:37:46 +00: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
Seungha Yang 410efd196a video-chroma: Add support for any combination of chroma-site flags
We've been allowing only a few known chroma-site values such as
jpeg (not co-sited), mpeg2 (horizontally co-sited) and
dv (co-sited on alternate lines). That's insufficient for
representing all possible chroma-site values. By this commit,
we can represent any combination of chroma-site flags.
But, an exception here is that any combination with
GST_VIDEO_CHROMA_SITE_NONE will be considered as invalid value.

For any combination of chroma-site flags,
gst_video_chroma_to_string() method is deprecated in order to
return newly allocated string via a new gst_video_chroma_site_to_string()
method. And for consistent API naming, gst_video_chroma_from_string()
is also deprecated. Newly written code should use
gst_video_chroma_site_from_string() instead.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/927>
2020-12-08 07:21:28 +00:00
Matthew Waters d4ff62700d video/converter: increase the number of cache lines for resampling
The exising hardcoded max default does not account for the possible
-1 offset when retrieving lines for resampling.  As a result, when
another chain has the same number of cache lines (4), the resample
operation would be attempting to generate 5 lines with a cache size
of 4 and would overwrite the first cache line.

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

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/938>
2020-12-03 06:39:09 +00:00
Guillaume Desmottes 3ab2023ed8 videometa: gir annotate the size of plane array in new API
Fix #838

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/949>
2020-12-01 09:50:27 +01:00
Marijn Suijten 7565a0b997 video: Provide "deprecated in" version for gst_video_color_transfer fns
As requested in [1].

[1]: https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/940#note_706437

Fixes: d0f36c7e1 ("video: Rename video_color_transfer to video_transfer_function")
2020-11-25 20:19:39 +01: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
Guillaume Desmottes b005d472f7 video: fix doc warning
@mode has been renamed to
gst_video_decoder_set_interlaced_output_state() but not in the header
file, raising a doc warning.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/894>
2020-11-09 11:55:57 +00:00
Jan Schmidt cb9799e942 video-converter: Skip input lines where possible.
There is a case where there are no lines in the temp cache, and
it's possible to skip straight to the request line and not generate
intermediate ones. This is really only beneficial when doing
nearest-neighbour downscaling, as other methods generally require
all input lines sequentially to generate the output. In that case,
this change has no effect and all lines are generated and cached
as before.

As a side effect however, this fixes corruption when downscaling
using nearest-neighbour, as interactions with the pass_alloc flag
and reuse of temporary lines causes the unecessarily-generated
cache lines to overwrite the final output.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/919>
2020-11-05 07:14:20 +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
Seungha Yang 660b5e4a98 videodecoder: Don't assume GstVideoChromaSite and GstVideoColorimetry
Even if given GstVideoChromaSite and/or GstVideoColorimetry has unknown
value(s), assumption for an unknown value should be done by subclass or
downstream element, not a role of video decoder. And subclass might
want to output unknown value as is.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/910>
2020-11-02 14:11:52 +00:00
Seungha Yang 37255eb7dc videodecoder: Remove trailing whitespace
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/910>
2020-11-02 14:11:52 +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
Xavier Claessens a28a75652e Meson: Use pkg-config generator 2020-10-23 11:19:11 -04:00
Sebastian Dröge 6af87dee17 audio/videodecoder: Initialize max_errors in instance_init()
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/882>
2020-10-20 12:46:07 +03:00
Sebastian Dröge ed62e78c6e audio/videodecoder: Don't reset max-errors in reset()
Otherwise setting the property on the elements has no effect at all
because it's immediately reset during startup.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/881>
2020-10-20 11:52:07 +03:00
Stéphane Cerveau 967e650937 meson: update glib minimum version to 2.56
In order to support the symbol g_enum_to_string in various
project using GStreamer ( gst-validate etc.), the glib minimum
version should be 2.56.0.

Remove compat code as glib requirement
is now > 2.56

Version used by Ubuntu 18.04 LTS

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/874>
2020-10-15 18:20:37 +02: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
Guillaume Desmottes 44b1fb03fc video-info: clarify GST_VIDEO_INTERLACE_MODE_ALTERNATE doc
Fields really should alternate in this mode.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/852>
2020-10-09 12:02:14 +02:00
Guillaume Desmottes a3a2992bc8 videodecoder: fix output state interlace-mode
When user is passing the actual interlace-mode when calling
gst_video_decoder_set_interlaced_output_state() it should not be
overidden by the input interlace-mode.

Needed to fix #825 as we want to keep interlace-mode=interleaved from
parsers and have the OMX decoder producing interlace-mode=alternate.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/852>
2020-10-09 11:04:30 +02:00
Guillaume Desmottes a19a27a4ca videodecoder: add interlace-mode to debug output when setting output state
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/852>
2020-10-09 11:04:30 +02:00
Jan Alexander Steffens (heftig) aa89ae8beb audio: video: Fix in/outbuf confusion of transform_meta
There are three instances where in- and outbuf have been swapped. This
didn't affect the correctness of the libs *filter code, but the
videoscale implementation swapped the arguments of meta->transform_func.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/853>
2020-10-08 18:30:39 +02:00
Marijn Suijten d0f36c7e13 video: Rename video_color_transfer to video_transfer_function
Rename remaining `gst_video_color_transfer_{encode,decode}` functions on
the `GstVideoTransferFunction` enumeration to
`gst_video_transfer_function_{encode,decode}` permitting
gobject-introspection to turn these into associated functions and place
them under the respective `<enumeration>` block in gir XML files.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/805>
2020-09-12 09:46:44 +03: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
Stian Selnes eaedb5c2de videodecoder: Bump log level of marking a sync point
Sync points are often important when debugging and deserves DEBUG
level.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/730>
2020-09-10 20:31:10 +02:00
Sebastian Dröge d26eede464 videodecoder: Add API for subclasses to request a new sync point
This allows subclasses that notice missing reference frames to request a
new sync point to allow seamless decoding again. While doing so the
subclass can also signal whether it wants a) all following input frames
until the sync point to be discarded or b) all output frames until the
sync point to be marked as corrupt.

Sending of force-keyunit events for this can be throttled by the
application via the "min-force-keyunit-interval" property.

This replaces custom behaviour for the same in various decoders, for
example openh264dec.

Based on patches by Haakon Sporsheim <haakon@pexip.com> and
Stian Selnes <stian@pexip.com>.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/730>
2020-09-10 20:31:10 +02:00
Sebastian Dröge fdf79a786c videodecoder: Add API for subclasses to signal that they need the stream to start with a sync point
If the first frame(s) at the very beginning or after a flush are not a
sync point then the base class would discard them before passing them to
the subclass.

This also fixes the previously broken distance_from_sync handling: it
was never reset at sync points.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/730>
2020-09-10 17:22:14 +00:00
Sebastian Dröge 1afb145dc5 videodecoder: Add "discard-corrupted-frames" property
This can be used by applications to configure decoders so that corrupted
frames are directly discarded instead of being forwarded inside the
pipeline. It is a replacement for the "output-corrupt" property of the
ffmpeg decoders.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/730>
2020-09-10 17:22:14 +00:00
Sebastian Dröge 06bcf95ebf videodecoder: Add API for marking output frames as corrupted
This can be used by subclasses to mark output frames as known to be
corrupted, for example if reference frames were missing. ffmpeg's
decoders can signal this.

In addition this flag is propagated downstream if the input frame had it
set.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/730>
2020-09-10 17:22:14 +00:00