Commit graph

1616 commits

Author SHA1 Message Date
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 7a53fbad68 rtp/basepayload: implement support for rtp header extensions
New signals are added for managing the internal list of rtp header
extension implementations read by a specific depayloader instance.

If the 'extmap-$NUM' field is present in the src caps, then an
extension implementation will be requested but is not required to be able
to negotiate correctly.  An extension will be requested using the
'request-extension' signal if none could be found internally.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/748>
2020-12-03 10:19:32 +00:00
Matthew Waters 092ea647bb rtp/basedepayload: implement support for rtp header extensions
New signals are added for managing the internal list of rtp header
extension implementations read by a specific depayloader instance.

If the 'extmap-$NUM' field is present in the sink caps, then an
extension implementation will be requested but is not requited to be
able to negotiate correctly.  An extension will be requested using the
'request-extension' signal if none could be found internally.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/748>
2020-12-03 10:19:32 +00:00
Matthew Waters 427c3f4442 rtp: add base object for reading/writing rtp header extensions (RFC5285)
Facilitates the creation of rtp header extension implementations that
can be reused across applications.

Implementations are registered into the GStreamer registry as elements
(idea from GstRTSPExtension) and can be retrieved by URI or filtered
manually.  RTP header extensions must have the classification
"Network/Extension/RTPHeader" to be considered as a RTP Header
extension.

Fixes: https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/issues/777
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/748>
2020-12-03 10:19:32 +00:00
Marijn Suijten 3ec795f613 audio: Move fill_silence into audio_format_info
With the function named gst_audio_format_fill_silence it would get
associated to the GstAudioFormat type in .gir which is incorrect and
confusing. See [1] for the discussion sparking this change.

https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/630#note_694795

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/940>
2020-11-25 19:18:25 +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
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
Nicolas Dufresne db4567152d tests: allocator: Fix FDMemory portability issue
This fixes few issues in the test but mainly some portability issue reported
on Ubutun. The test now uses a randomly name tempory file located into system
default tempory location and uses glib wrappers when available.

Fixes !895

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/901>
2020-10-29 09:45:25 +00:00
Tobias Ronge e2a1aa44df fdmemory: Allow for change of protection mode
After a memory has been unmapped, protection mode can now be changed
when mapping it again.

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

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/895>
2020-10-28 17:11:05 +00:00
Seungha Yang 615b1ac579 tests: appsrc: Fix unstable test case
Wait all buffers to be consumed before sending flush seek event,
so that checking timestamp and segment as expected.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/816>
2020-10-14 10:57:19 +00:00
Will Miller ac72a6adaa gstrtpbuffer: fix header extension length validation
We validate the header extensions length of an RTP buffer by comparing
it against the block size. Since we multiply the length in words by 4 to
get the length in bytes, a suitably large length could cause a wrapround
of the uint16, giving a lower length which erroneously passes the check
and allows the buffer to be mapped.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/864>
2020-10-12 15:01:22 +01:00
Matthew Waters 52793dbfca tests: add gl structs to abi check
Tested on x86, x86_64, armv7l, aarch64.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/854>
2020-10-09 06:12:30 +00: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
Sebastian Dröge 40a1e01740 glmixer: Fix unit test to actually work reliably
Don't run the harness in live mode, or otherwise it would output frames
already in the very beginning before a buffer was provided to it due to
timeout.

Also send EOS/a second buffer before pulling a buffer as videoaggregator
has one frame of latency.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/812>
2020-09-10 14:19:04 +03:00
Sebastian Dröge 91ec4e06d7 video: Rename gst_video_color_transfer_*() to gst_video_transfer_function_*() in new API
The type is called GstVideoTransferFunction so the function names should
match, otherwise gobject-introspection is keeping the functions as
global functions instead of methods on the type.

The same mistake was also made in lots of other APIs over the years, but
here we can at least fix it for 1.18 still.

Thanks to Marijn Suijten for noticing.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/807>
2020-09-07 13:04:20 +03: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
Guillaume Desmottes dd5f7f1bf9 gl: move each gl platform specific API to its own gir
With contributions from:
Thibault Saunier <tsaunier@igalia.com>
Matthew Waters <matthew@centricular.com>

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

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/661>
2020-08-06 04:09:09 +00: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
Jordan Petridis 66ff1eedca tests/check/elements/audioresample.c: avoid implict int ot float conversion
Also use doubles instead so the calculation won't overflow

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/773>
2020-08-04 17:32:31 +03: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
Matthew Waters a1e9f4e37b rtpbasepayload: place twcc-ext-id behind environment variable
Adding properties for each and every rtp header extension is not
scalable and a new interface will be implemented for the general case
(https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/issues/777).

Set the environment variable "GST_RTP_ENABLE_EXPERIMENTAL_TWCC_PROPERTY"
to any value to reenable the short-lived twcc-ext-id property.

Fixes https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/issues/761

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/756>
2020-07-21 11:57:55 +00:00
Olivier Crête cb6edaf6f8 videorate: Error out on streams with no way to guess framerate
This is better than going into an infinite loop.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/761>
2020-07-20 22:05:57 +00:00
Olivier Crête 323554a31a videorate: Add test that reproduces infinite loop
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/761>
2020-07-20 22:05:57 +00:00
Havard Graff 36fec290a3 test/rtp: use the proper _INIT for initializing rtp/rtcp buffer structs.
Fixes -Wmissing-field-initializers in Clang.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/757>
2020-07-15 16:57:01 +02:00
Havard Graff c488fd74a0 rtpbasedepayload: test warning fixes
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/757>
2020-07-15 16:57:01 +02:00
Nicolas Dufresne 98b44fdb46 video: Add support for linear 32x32 NV12 tiles
This adds linear 32x32 NV12 based tiles. This format is notably used by
Allwinner VCU and exposed in V4L2 as being "SUNXI Tiled" format. In this
patch we generalize the plane info calculation so we can share this part
with the 4L4 variant.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/754>
2020-07-14 21:43:56 -04:00
Nicolas Dufresne 7d1028424c video: Add NV12_4L4 tile format
This format is produced by Verisillicon VC8000D VPU decoder, it is a simple 4x4
tiling layout in a linear way.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/753>
2020-07-14 17:33:31 +00:00
Santiago Carot-Nemesio 93cb325fa1 rtcpbuffer: Notify error in case packet can not be added to an RTCP compound packet
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/476>
2020-07-10 14:16:10 +00:00
Seungha Yang cb34faaa17 tests: appsrc: Add unit test for custom segment
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/663>
2020-07-10 07:52:53 +00:00
Vivia Nikolaidou 1d0ccf8baa video-color: Add bt601 transfer function
Functionally the same as 709 but technically has a different value, and
external software (e.g. ffmpeg) finds "wrong" values produced by
GStreamer.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/724>
2020-07-03 11:57:49 +03:00
Hosang Lee f84f7a2cec tests: subparse: add test for webvtt without hour component
Test for webvtt without hour component.
mm:ss.000
2020-06-18 09:06:32 +09:00
Jan Schmidt 205bb066ed video-converter: Add checks for configuration sanity.
If the cropping or scaling input or output rects put us completely
outside the input/output frame respectively, we can't draw anything
except black safely. Check for those conditions and don't set up a
configuration that attempts to access out of bounds memory outside
the input/output framebuffers.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/696>
2020-06-12 06:49:56 +00:00
Jan Schmidt bf5d51c5da video-converter: Guard against invalid frame input
If the frames passed in to gst_video_converter_frame()
have a different layout than was configured for, the
conversion code might go out of bounds and crash.

Do a sanity check on each frame passed in, and in the
absence of a return value in the API, just
refuse the conversion in invalid cases and leave the
destination frame untouched so it's obvious to
users that it was broken.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/696>
2020-06-12 06:49:56 +00:00
Guillaume Desmottes 1b4ab9f033 tests: enforce I420 format
Tests are assuming video is I420 but are not actually enforcing it.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/689>
2020-06-09 08:09:58 +00:00
Edward Hervey 78444fc622 tests: Avoid hang with decodebin test
When adding elements dynamically to a pipeline one should never guess what the
curren/target state is, and instead use `gst_element_sync_state_with_parent()`.

Fixes racy hang when running within valgrind

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/692>
2020-06-08 08:11:00 +02:00
Sebastian Dröge 954a314ca8 videoencoder: Add test for min-force-key-unit-interval property
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/684>
2020-06-05 10:04:43 +00:00
Sebastian Dröge 76364ebfe7 videoencoder: Also don't request a new key-unit if we already got one after the requested running time
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/684>
2020-06-05 10:04:43 +00:00
Sebastian Dröge 931b5ad996 videoencoder: Add test for correct force-keyunit event handling
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/684>
2020-06-05 10:04:43 +00:00
Sebastian Dröge 01eecc69bd videoencoder: Fix force-keyunit handling in test
This now behaves according to the videoencoder API instead of some other
signalling.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/684>
2020-06-05 10:04:43 +00:00
Guillaume Desmottes 02fd2f12f9 audio: add gst_audio_make_raw_caps()
More binding friendly version of GST_AUDIO_CAPS_MAKE().

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/676>
2020-06-02 11:57:42 +00:00
Guillaume Desmottes 84e0689d58 video: add gst_video_make_raw_caps()
More binding friendly version of GST_VIDEO_CAPS_MAKE().

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/676>
2020-06-02 11:57:42 +00:00
Seungha Yang 7d7108f35d tests: audiosink: Test class extension struct
Test a vfunc which belongs to GstAudioSinkExtension struct.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/547>
2020-05-28 19:14:29 +09:00
Sebastian Dröge 8966083178 audioresample: Add new test that checks for downstream renegotiation
This test always consumes 48kHz and outputs different sample rates based
on downstream renegotiation. Previously this would produce completely
wrong timestamps and not output all samples.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/670>
2020-05-27 17:06:08 +00:00
Sebastian Dröge 71c937b565 audioresample: Fix up test_live_switch
Actually check that we get back all samples, which we didn't before
because no draining was happening. Also remove commented out 0.10 code
and related comments.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/670>
2020-05-27 17:06:08 +00:00
Thibault Saunier b46718b1a0 audiotestsrc: Fix the way we compute EOS in reverse playback
In reverse playback we were not taking into account the current buffer
samples to check if we had reached EOS which was leading to a buffer
with PTS = CLOCK_TIME_NONE containing too many frames followed by a
useless buffer with pts=0 duration=0, and a g_critical issue in
gst_object_sync_values.

Also add a validate based test case.
Without that patch this is how the expectation fails:

``` diff
--- log-asink-sink-expected       2020-05-22 23:22:42.654384579 -0400
+++ log-asink-sink-actual  2020-05-22 23:29:35.671586380 -0400
@@ -27,5 +27,6 @@
 buffer: pts=0:00:00.058820861, due=0:00:00.023219955, flags=discont
 buffer: pts=0:00:00.035600907, due=0:00:00.023219954, flags=discont
 buffer: pts=0:00:00.012380952, due=0:00:00.023219955, flags=discont
-buffer: pts=0:00:00.000000000, due=0:00:00.012380952, flags=discont
+buffer: due=0:00:00.012380953, flags=discont
+buffer: pts=0:00:00.000000000, flags=discont
 event eos: (no structure)
 ```

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/667>
2020-05-25 08:19:02 +00:00
Edward Hervey 9280d4b8f5 check: verify gst_gl_display_add_context()
As is done almost everywhere else. Doesn't cost anything.

CID #1462817

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/657>
2020-05-09 07:31:04 +02:00
Matthew Waters 6fc33560e1 tests/gl: add test for GL context removal
Tests functionality fixed by:

https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/654

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/656>
2020-05-08 15:10:17 +10:00
Tim-Philipp Müller 01265c10cd tests: fix meson test env setup to make sure we use the right gst-plugin-scanner
If core is built as a subproject (e.g. as in gst-build), make sure to use
the gst-plugin-scanner from the built subproject. Without this, gstreamer
might accidentally use the gst-plugin-scanner from the install prefix if
that exists, which in turn might drag in gst library versions we didn't
mean to drag in. Those gst library versions might then be older than
what our current build needs, and might cause our newly-built plugins
to get blacklisted in the test registry because they rely on a symbol
that the wrongly-pulled in gst lib doesn't have.

This should fix running of unit tests in gst-build when invoking
meson test or ninja test from outside the devenv for the case where
there is an older or different-version gst-plugin-scanner installed
in the install prefix.

In case no gst-plugin-scanner is installed in the install prefix, this
will fix "GStreamer-WARNING: External plugin loader failed. This most
likely means that the plugin loader helper binary was not found or
could not be run. You might need to set the GST_PLUGIN_SCANNER
environment variable if your setup is unusual." warnings when running
the unit tests.

In the case where we find GStreamer core via pkg-config we use
a newly-added pkg-config var "pluginscannerdir" to get the right
directory. This has the benefit of working transparently for both
installed and uninstalled pkg-config files/setups.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/582>
2020-05-06 14:02:28 +00:00
Tim-Philipp Müller b82c8f5854 tests: don't look for plugins in -base installdir for tests
-base plugins will always be found in the build directory, and
core plugins will be found either also via the build directory
(if both core and -base are a subproject) or by getting the
pluginsdir via pkg-config if core is installed.

The GST_PLUGIN_LOADING_WHITELIST env var will make sure we only
pick up plugins from core/base and base plugins only from the
builddir.

There is no reason to look for -base plugins in the install dir.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/582>
2020-05-06 14:02:28 +00:00
He Junyan 5bb8bdf90d test: pbutils: Add check for high throughput scc.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/645>
2020-04-28 21:27:36 +08:00