platform/upstream/gstreamer.git
2 years agovapostproc: Append featured caps rather than merge.
Víctor Manuel Jáquez Leal [Tue, 16 Nov 2021 09:40:03 +0000 (10:40 +0100)]
vapostproc: Append featured caps rather than merge.

So it would be possible to honor upstream preference.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1369>

2 years agovapostproc: Remove dead code.
Víctor Manuel Jáquez Leal [Mon, 25 Oct 2021 17:22:05 +0000 (19:22 +0200)]
vapostproc: Remove dead code.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1369>

2 years agova: filter: Validate input parameter in internal function.
Víctor Manuel Jáquez Leal [Mon, 25 Oct 2021 17:22:19 +0000 (19:22 +0200)]
va: filter: Validate input parameter in internal function.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1369>

2 years agova: allocator: log drm modifier
Víctor Manuel Jáquez Leal [Mon, 15 Nov 2021 09:15:38 +0000 (10:15 +0100)]
va: allocator: log drm modifier

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1369>

2 years agova: vpp: Fix the memory leak in fixate_caps().
He Junyan [Mon, 22 Nov 2021 09:34:22 +0000 (17:34 +0800)]
va: vpp: Fix the memory leak in fixate_caps().

For the BaseTransform class, the function of fixate_caps(), takes
the ownership of "othercaps". So we should clear it in our subclass.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1372>

2 years agoid3v2mux: Map GST_TAG_MUSICBRAINZ_RELEASETRACKID
Jean Felder [Fri, 12 Nov 2021 12:54:59 +0000 (13:54 +0100)]
id3v2mux: Map GST_TAG_MUSICBRAINZ_RELEASETRACKID

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1342>

2 years agoid3v2mux: Map GST_TAG_MUSICBRAINZ_RELEASEGROUPID
Jean Felder [Fri, 12 Nov 2021 12:51:56 +0000 (13:51 +0100)]
id3v2mux: Map GST_TAG_MUSICBRAINZ_RELEASEGROUPID

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1342>

2 years agoci: fix minor comment typo
Marc-André Lureau [Mon, 22 Nov 2021 08:46:15 +0000 (12:46 +0400)]
ci: fix minor comment typo

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1371>

2 years agoplayer: Ensure the GstPlay is created before the wrapped renderer
Philippe Normand [Sat, 13 Nov 2021 12:22:36 +0000 (12:22 +0000)]
player: Ensure the GstPlay is created before the wrapped renderer

The GstPlayerWrappedVideoRenderer implicitely depends on GstPlay.

Fixes #878

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1345>

2 years agoplay: Allow runtime configuration of video-renderer
Philippe Normand [Sat, 13 Nov 2021 12:17:23 +0000 (12:17 +0000)]
play: Allow runtime configuration of video-renderer

This is a requirement for GstPlayer when using the default overlay interface
provided by the pipeline. The GstPlayerWrappedVideoRenderer requires a valid
pipeline, but that's available only after the GstPlay thread has successfully
started.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1345>

2 years agomeson: Disable symlink to gst modules
Seungha Yang [Tue, 28 Sep 2021 16:30:46 +0000 (01:30 +0900)]
meson: Disable symlink to gst modules

Symlink to directory usually makes IDE be confused,
and also any git command to the symlink would not work.
Disable the symlink since we don't see any advantage of the use case
at the moment.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/949>

2 years agova: decoder: Also ref the display when duplicating pictures.
He Junyan [Fri, 19 Nov 2021 11:02:20 +0000 (19:02 +0800)]
va: decoder: Also ref the display when duplicating pictures.

The _destroy_buffers() will check the display handle using the
g_return_val_if_fail. we should not generate the invalid pointer
warning.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1368>

2 years agodocs: Update doc cache for Windows specific plugins
Seungha Yang [Wed, 17 Nov 2021 13:51:00 +0000 (22:51 +0900)]
docs: Update doc cache for Windows specific plugins

Updating doc cache for d3d11, mediafoundation and wasapi2 plugins

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1360>

2 years agowasapi2: Fix typo in doc
Seungha Yang [Wed, 17 Nov 2021 15:16:41 +0000 (00:16 +0900)]
wasapi2: Fix typo in doc

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1360>

2 years agomediafoundation: Skip doc for non-default encoder elements
Seungha Yang [Wed, 17 Nov 2021 13:46:17 +0000 (22:46 +0900)]
mediafoundation: Skip doc for non-default encoder elements

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1360>

2 years agod3d11: Stop doc for non-default decoder and deinterlacer elements
Seungha Yang [Thu, 21 Oct 2021 10:41:15 +0000 (19:41 +0900)]
d3d11: Stop doc for non-default decoder and deinterlacer elements

Just skip doc for non-default decoder/deinterlacer elements
since there are multiple element in case that system has
multiple GPUs.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1360>

2 years agogst: Add APIs to allow documentation for element to be skipped
Seungha Yang [Thu, 21 Oct 2021 10:04:43 +0000 (19:04 +0900)]
gst: Add APIs to allow documentation for element to be skipped

Dynamically registered elements (hardware element in most cases)
may or may not be available on a system and properties may be different
per system.
This new API will make documentation skipping possible in programmable way.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1360>

2 years agod3d11: Fix deadlock while doing unprepare
Wonchul Lee [Fri, 19 Nov 2021 04:27:54 +0000 (13:27 +0900)]
d3d11: Fix deadlock while doing unprepare

ShowWindow() could be blocked while doing gst_d3d11_window_win32_unprepare
when external window handle provided to d3d11videosink in multi-threaded
environment.
The condition that issue happened is, UI thread is waiting for a
background thread that changes d3d11videosink state to NULL, and the
background thread would try to send a window message to the queue.
The queue is already occupied by the UI thread, so the background
thread will be blocked.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1366>

2 years agotcp: fix build on Solaris
Thomas Klausner [Thu, 18 Nov 2021 23:09:03 +0000 (00:09 +0100)]
tcp: fix build on Solaris

Add missing header.

From Claes Nästén via http://gnats.netbsd.org/56509

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1364>

2 years agoshout2: Add compatibility for libshout >= 2.4.2
Tobias Reineke [Thu, 18 Nov 2021 16:27:17 +0000 (16:27 +0000)]
shout2: Add compatibility for libshout >= 2.4.2

In libshout >=2.4.2 shout_open() can return SHOUTERR_RETRY in addition
to SHOUTERR_BUSY.

The nonblocking example in libshout fixes the problem in a similar
way, as mentioned by the author in this issue:
https://gitlab.xiph.org/xiph/icecast-libshout/-/issues/2316

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

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1363>

2 years agovaapi: libs: Use unsized arrays as parameters.
Víctor Manuel Jáquez Leal [Tue, 16 Nov 2021 16:18:28 +0000 (17:18 +0100)]
vaapi: libs: Use unsized arrays as parameters.

Instead of defining a sized array for function signature, use it
unsized (a pointer alias, basically). In this way clang warning is
silenced:

warning: ‘fill_profiles’ accessing 64 bytes in a region of size 12 [-Wstringop-overflow=]

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1357>

2 years agovaapi: meson: Fail if static build.
Víctor Manuel Jáquez Leal [Tue, 16 Nov 2021 16:21:52 +0000 (17:21 +0100)]
vaapi: meson: Fail if static build.

And initialize the plugin array.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1357>

2 years agoenv: Fix deprecations from python 3.10
Thibault Saunier [Wed, 17 Nov 2021 02:39:43 +0000 (23:39 -0300)]
env: Fix deprecations from python 3.10

distutils is now deprecated and strtobool is simple enough for us to just
vendor.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1358>

2 years agopython: Avoid treating float as int
Thibault Saunier [Wed, 17 Nov 2021 02:36:10 +0000 (23:36 -0300)]
python: Avoid treating float as int

Since python 3.10 implicit conversion to integers using `__int__` as
been completely removed (was deprecated behavior in 3.9) so we need
to cleanly handle it now.

See https://gitlab.gnome.org/GNOME/pitivi/-/issues/2589

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1358>

2 years agovaapipostproc: fix mising metadata when using system
Ung, Teng En [Mon, 15 Nov 2021 08:38:34 +0000 (16:38 +0800)]
vaapipostproc: fix mising metadata when using system

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1325>

2 years agoqmlglsink: fix another resize case
Matthew Waters [Mon, 15 Nov 2021 03:39:14 +0000 (14:39 +1100)]
qmlglsink: fix another resize case

If qt asks us to redraw before we have both set a buffer and caps we
would attempt to use the new caps with the old buffer which could result
in bad things happening.

Only update caps from new_caps once the buffer has actually been set.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1346>

2 years agowpevideosrc: Fix frame stuttering in GL rendering path
Philippe Normand [Tue, 16 Nov 2021 12:56:38 +0000 (12:56 +0000)]
wpevideosrc: Fix frame stuttering in GL rendering path

Make sure the EGLImage we're rendering to the GL memory stays alive long enough,
until the the GL memory has been destroyed.

This change fixes tearing and black flashes artefacts that were happening
because the EGLImage was sometimes destroyed before the sink actually rendered
the associated texture.

Fixes #889

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1354>

2 years agowpevideosrc: Run through gst-indent
Philippe Normand [Tue, 16 Nov 2021 12:53:35 +0000 (12:53 +0000)]
wpevideosrc: Run through gst-indent

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1354>

2 years agogstinfo: Add gst_debug_log_literal() function
Sebastian Dröge [Tue, 16 Nov 2021 16:05:09 +0000 (18:05 +0200)]
gstinfo: Add gst_debug_log_literal() function

This takes a plain message string and not a format string, and as a
result doesn't have to be passed through vasprintf() and lead to further
unnecessary allocations. It can also contain literal `%` because of
that.

The new function is mostly useful for bindings that would have to pass a
full string to GStreamer anyway and would do formatting themselves with
language-specific functionality.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1356>

2 years agov4l2: Update fmt if padded height is greater than fmt height
Trung Do [Mon, 1 Nov 2021 03:08:32 +0000 (10:08 +0700)]
v4l2: Update fmt if padded height is greater than fmt height

If padded height is greater, buffer bytesused could be larger than plane length,
and cause VIDIOC_QBUF failure.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1355>

2 years agouridecodebin3: Nullify current item after all play items are freed.
Víctor Manuel Jáquez Leal [Tue, 16 Nov 2021 12:14:25 +0000 (13:14 +0100)]
uridecodebin3: Nullify current item after all play items are freed.

There's a potential race condition with this sort of pipelines on
certain systems (depends on the processing load):

GST_DEBUG_DUMP_DOT_DIR=/tmp \
gst-launch-1.0 uridecodebin3 uri=file://stream.mp4 ! glupload ! \
glimagesink --gst-debug=*:4

Right after the pipeline passes from PAUSED to READY, bin_to_dot_file
dumps uridecodebin3 properties, but current uri and suburi might be
already freed, causing a potential use-after-freed.

This patch makes NULL the current item right after all the play items
are freed.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1353>

2 years agogst: Fix license headers and add SPDX
Thibault Saunier [Tue, 16 Nov 2021 01:09:28 +0000 (22:09 -0300)]
gst: Fix license headers and add SPDX

Fixes https://gitlab.freedesktop.org/gstreamer/gst-python/-/issues/57

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1351>

2 years agocaps: fix type of return value if string is null in gst_caps_from_string
Daniel Knobe [Mon, 15 Nov 2021 10:04:25 +0000 (11:04 +0100)]
caps: fix type of return value if string is null in gst_caps_from_string

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1348>

2 years agortpfunnel: don't enforce twcc during upstream negotiation
Mathieu Duponchelle [Tue, 9 Nov 2021 18:41:14 +0000 (19:41 +0100)]
rtpfunnel: don't enforce twcc during upstream negotiation

A previous patch has caused rtpfunnel to output twcc-related
information downstream, however this leaked into upstream
negotiation (through funnel->srccaps), causing payloader to
negotiate twcc caps even when not prompted to do so by the user.

Fix this by only enforcing that upstream sends us application/x-rtp
caps as was the case originally.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1278>

2 years agortptwcc: complete bufferlist fix
Mathieu Duponchelle [Fri, 29 Oct 2021 23:18:18 +0000 (01:18 +0200)]
rtptwcc: complete bufferlist fix

When dealing with bufferlists, we need to store one "SentPacket"
structure per buffer, not one per buffer list!

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1278>

2 years agoqtdemux: Log cslg_shift that was determined
Sebastian Dröge [Fri, 12 Nov 2021 15:59:22 +0000 (17:59 +0200)]
qtdemux: Log cslg_shift that was determined

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1294>

2 years agoqtdemux: Use a composition time offset of 0 for "no decode samples" for the time...
Sebastian Dröge [Fri, 12 Nov 2021 11:00:56 +0000 (13:00 +0200)]
qtdemux: Use a composition time offset of 0 for "no decode samples" for the time being

This needs codec-specific handling, but using 0 instead of G_MININT32 at
least gives somewhat reasonable behaviour.

See https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/883

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1294>

2 years agoqtdemux: Always check ctts for unreasonably large offsets
Sebastian Dröge [Fri, 12 Nov 2021 10:46:56 +0000 (12:46 +0200)]
qtdemux: Always check ctts for unreasonably large offsets

If this happens then ignore the whole ctts. Previously we only did this
if the PTS/DTS shift was determined from the ctts instead of the cslg.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1294>

2 years agoqtdemux: Dump composition time offsets in trun as signed integers
Sebastian Dröge [Fri, 12 Nov 2021 10:39:17 +0000 (12:39 +0200)]
qtdemux: Dump composition time offsets in trun as signed integers

Just like we do for ctts without regard of the version of the box.
Huge offsets are interpreted as negative offsets by qtdemux so this
works.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1294>

2 years agoqtdemux: Add a comment why only positive cslg shifts are considered
Sebastian Dröge [Fri, 12 Nov 2021 09:36:31 +0000 (11:36 +0200)]
qtdemux: Add a comment why only positive cslg shifts are considered

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1294>

2 years agoqtdemux: Only adjust segment.stop by cslg_shift if stop is not -1
Sebastian Dröge [Tue, 2 Nov 2021 16:38:39 +0000 (18:38 +0200)]
qtdemux: Only adjust segment.stop by cslg_shift if stop is not -1

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1294>

2 years agoqtdemux: Handle negative composition offsets in the trun box the same way as for...
Sebastian Dröge [Tue, 2 Nov 2021 16:29:53 +0000 (18:29 +0200)]
qtdemux: Handle negative composition offsets in the trun box the same way as for non-fragmented streams

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1294>

2 years agoqtdemux: Parse ctts version
Sebastian Dröge [Tue, 2 Nov 2021 15:43:17 +0000 (17:43 +0200)]
qtdemux: Parse ctts version

Negative composition time offsets are only allowed with version 1 of the
box, however we parse it as a signed value also for version 0 boxes as
unfortunately there are such files out there and it's unlikely to have
(valid) huge composition offsets.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1294>

2 years agoqtdemux: Add support for version 1 cslg boxes
Sebastian Dröge [Tue, 2 Nov 2021 15:41:01 +0000 (17:41 +0200)]
qtdemux: Add support for version 1 cslg boxes

They use 64 bit fields instead of 32 bit.

Also parse offset as a signed integer (in both versions) and clamp it to
a positive value as negative values don't really interest us here.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1294>

2 years agoqtdemux: Don't free cslg data that we don't own on corrupt files
Sebastian Dröge [Tue, 2 Nov 2021 15:54:46 +0000 (17:54 +0200)]
qtdemux: Don't free cslg data that we don't own on corrupt files

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1294>

2 years agoaudio-resampler: Fix segfault when we can't output any frames
Nirbheek Chauhan [Fri, 12 Nov 2021 12:56:58 +0000 (18:26 +0530)]
audio-resampler: Fix segfault when we can't output any frames

Sometimes the resampler has enough space to store all the incoming
samples without outputting anything. When this happens,
gst_audio_resampler_get_out_frames() returns 0.

In that case, the resampler should consume samples and just return.
Otherwise, we get a segfault when gst_audio_resampler_resample() tries
to resample into a NULL 'out' pointer.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1343>

2 years agomatroska: Ref index table when updating track info
Rafał Dzięgiel [Fri, 7 May 2021 08:44:15 +0000 (10:44 +0200)]
matroska: Ref index table when updating track info

Track index table array was being lost during track info update.
Ref it over to updated info, so it can be used for finding
nearest seek points.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1203>

2 years agomatroska: Use g_array_unref everywhere
Rafał Dzięgiel [Fri, 12 Nov 2021 10:28:23 +0000 (11:28 +0100)]
matroska: Use g_array_unref everywhere

Instead of using g_array_free which is not thread safe use g_array_unref instead

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1203>

2 years agodocs: fix unnecessary ampersand, < and > escaping in code blocks
Tim-Philipp Müller [Thu, 11 Nov 2021 19:11:25 +0000 (19:11 +0000)]
docs: fix unnecessary ampersand, < and > escaping in code blocks

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1340>

2 years agost2022-1-fecdec: fix packet trimming
Mathieu Duponchelle [Fri, 12 Nov 2021 02:17:44 +0000 (03:17 +0100)]
st2022-1-fecdec: fix packet trimming

g_sequence_remove_range's end iter is exclusive, so if one
wants to remove that item as well, it should be called with
the next iter.

This could in theory fix an issue where:

* The sequence isn't entirely trimmed, with an old item lingering

* Following FEC packets are immediately discarded because they
  arrived later than corresponding media packets, long enough for
  seqnums to wrap around

* We now try to reconstruct a media packet with a completely obsolete
  FEC packet, chaos ensues.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1341>

2 years agoqmlsink: support caps changes better
Matthew Waters [Thu, 11 Nov 2021 04:49:19 +0000 (15:49 +1100)]
qmlsink: support caps changes better

We need to hold onto the last buffer until the next buffer arrives.
Before, if a caps change comes we would remove the currently rendering
buffer.  if Qt asks use to render something, we would render the dummy
black texture.

Fixes a period of black output when upstream is e.g. changing resolution
as in hls adaptive bitrate scenarios.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1338>

2 years agov4l2: Record buffer states in pool to fix dequeue race
James Cowgill [Mon, 27 Sep 2021 15:52:22 +0000 (16:52 +0100)]
v4l2: Record buffer states in pool to fix dequeue race

The `gst_v4l2_buffer_pool_dqbuf` function contains this ominous comment:

    /* get our GstBuffer with that index from the pool, if the buffer was
     * outstanding we have a serious problem.
     */
    outbuf = pool->buffers[group->buffer.index];

Unfortunately it is common for buffers in _output_ buffer pools to be
both queued and outstanding at the same time. This can happen if the
upstream element keeps a reference to the buffer, or in an encoder
element itself when it keeps a reference to the input buffer for each
frame.

Since the current code doesn't handle this case properly we can end up
with crashes in other elements such as:

    (gst-launch-1.0:32559): CRITICAL **: 17:33:35.740: gst_video_frame_map_id: assertion 'GST_IS_BUFFER (buffer)' failed

and:

    (gst-launch-1.0:231): GStreamer-CRITICAL **: 00:16:20.882: write map requested on non-writable buffer

Both these crashes are caused by a race condition related to releasing
the same buffer twice from two different threads. If a buffer is queued
and outstanding this situation is possible:

**Thread 1**
- Calls `gst_buffer_unref` decrementing the reference count to zero.
- The core GstBufferPool object marks the buffer non-outstanding.
- Calls the V4L2 release buffer function.
- If the buffer is _not_ queued:
  - Release it back to the free pool (containing non-queued buffers).

**Thread 2**
- Dequeues the queued output buffer.
  - Marks the buffer as not queued.
- If the buffer is _not_ outstanding:
  - Calls the V4L2 release buffer function.
  - Release it back to the free pool (containing non-queued buffers).

If both of these threads run at exactly the same time there is a small
window where the buffer is marked both not outstanding and not queued
but before it has been released. In this case the buffer will be freed
twice causing the above crashes.

Unfortunately the variable recording whether a buffer is outstanding is
part of the core `GstBuffer` object and is managed by `GstBufferPool` so
it's not as straightforward as adding a mutex. Instead we can fix this
by additionally recording the buffer state in `GstV4l2BufferPool`, and
handle "internal" and "external" buffer release separately so we can
detect when a buffer becomes not outstanding.

In the new solution:
- The "external" buffer pool release and the "dqbuf" functions
  atomically update the buffer state and determine if a buffer is still
  queued or outstanding.
- Subsequent code and a new
  `gst_v4l2_buffer_pool_complete_release_buffer` function can proceed to
  release (or not) a buffer knowing that it's not racing with another
  thread.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1010>

3 years agogst-python: Add option to disable python plugin
Xavier Claessens [Wed, 10 Nov 2021 18:38:04 +0000 (13:38 -0500)]
gst-python: Add option to disable python plugin

It is not always needed, at least Ubuntu package it separately and don't
install it by default. Also when doing a static build there is an
unavoidable warning otherwise.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1337>

3 years agoavtp: crf: Process also local CRF streams
Timo Wischer [Thu, 5 Nov 2020 09:23:13 +0000 (10:23 +0100)]
avtp: crf: Process also local CRF streams

Without this patch locally generated CRF streams will be ignored.
Therefore the same network interface could not be CRF talker and
CRF listener.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1074>

3 years agowebrtc janus rust: Update extra dependencies
Olivier Crête [Wed, 10 Nov 2021 15:14:54 +0000 (09:14 -0600)]
webrtc janus rust: Update extra dependencies

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1332>

3 years agowebrtc multiparty rust: Upgrade all other deps
Olivier Crête [Wed, 10 Nov 2021 14:16:43 +0000 (08:16 -0600)]
webrtc multiparty rust: Upgrade all other deps

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1332>

3 years agowebrtc sendrecv rust: Upgrade all other deps
Olivier Crête [Wed, 10 Nov 2021 14:13:08 +0000 (08:13 -0600)]
webrtc sendrecv rust: Upgrade all other deps

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1332>

3 years agowebrtc multiparty rust: Port to bindings 0.17 version
Olivier Crête [Tue, 9 Nov 2021 21:18:19 +0000 (15:18 -0600)]
webrtc multiparty rust: Port to bindings 0.17 version

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1332>

3 years agowebrtc sendrecv rust: Port to bindings 0.17 version
Olivier Crête [Tue, 9 Nov 2021 21:04:47 +0000 (15:04 -0600)]
webrtc sendrecv rust: Port to bindings 0.17 version

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1332>

3 years agoglcontext/egl: add missing unref
Jiri Uncovsky [Tue, 9 Nov 2021 12:10:50 +0000 (12:10 +0000)]
glcontext/egl: add missing unref

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1328>

3 years agortpbin: separate out the two fec decoder locations
Matthew Waters [Tue, 9 Nov 2021 04:10:06 +0000 (15:10 +1100)]
rtpbin: separate out the two fec decoder locations

The pipeline flow for receiving looks like this:

rtpsession ! rtpssrcdemux ! session_fec_decoder ! rtpjitterbuffer ! \
  rtpptdemux ! stream_fec_decoder ! ...

There are two places where a fec decoder could be placed.
1. As requested from the 'request-fec-decoder' signal: after rtpptdemux
   for each ssrc/pt produced
2. after rtpssrcdemux but before rtpjitterbuffer: added for the
   rtpst2022-1-fecenc/dec elements,

However, there was some cross-contamination of the elements involved and
the request-fec-decoder signal was also being used to request the fec
decoder for the session_fec_decoder which would then be cached and
re-used for subsequent fec decoder requests.  This would cause the same
element to be attempted to be linked to multiple elements in different
places in the pipeline.  This would fail and cause all kinds of havoc
usually resulting in a not-linked error being returned upstream and an
error message being posted by the source.

Fix by not using the request-fec-decoder signal for requesting the
session_fec_decoder and instead solely rely on the added properties for
that case.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1300>

3 years agoid3tag: Map GST_TAG_MUSICBRAINZ_RELEASETRACKID
Jean Felder [Tue, 9 Nov 2021 14:10:21 +0000 (15:10 +0100)]
id3tag: Map GST_TAG_MUSICBRAINZ_RELEASETRACKID

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1331>

3 years agoid3tag: Map GST_TAG_MUSICBRAINZ_RELEASEGROUPID
Jean Felder [Tue, 9 Nov 2021 14:04:59 +0000 (15:04 +0100)]
id3tag: Map GST_TAG_MUSICBRAINZ_RELEASEGROUPID

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1331>

3 years agoid3tag: Remove trailing whitespace
Jean Felder [Tue, 9 Nov 2021 14:04:00 +0000 (15:04 +0100)]
id3tag: Remove trailing whitespace

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1331>

3 years agoqtdemux: Fix can not demux Opus track made by qtmux
Zhao, Gang [Tue, 9 Nov 2021 13:20:19 +0000 (21:20 +0800)]
qtdemux: Fix can not demux Opus track made by qtmux

Opus stream info is read from dOps box [1]. The offset of dOps box in Opus box is different in mp4a version 1 and 0 [2]. Calculate the offset of dOps box according to mp4a version.

[1] https://opus-codec.org/docs/opus_in_isobmff.html

[2] subprojects/gst-plugins-good/gst/isomp4/atoms.c:sample_entry_mp4a_copy_data:2146

Fixed: https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/issues/918
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1329>

3 years agodocs: app-dev: events: seeking: use CLOCK_TIME_NONE instead of -1 and fix parameter...
Ralf Sippl [Mon, 25 Mar 2019 10:01:32 +0000 (10:01 +0000)]
docs: app-dev: events: seeking: use CLOCK_TIME_NONE instead of -1 and fix parameter names

to match the parameter names in the gst_element_seek() declaration.

Closes https://gitlab.freedesktop.org/gstreamer/gst-docs/-/merge_requests/34/

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1324>

3 years agodocs: installing-on-macos: flesh out instructions what to download
wuchang li [Mon, 27 Jul 2020 14:18:38 +0000 (14:18 +0000)]
docs: installing-on-macos: flesh out instructions what to download

Closes https://gitlab.freedesktop.org/gstreamer/gst-docs/-/merge_requests/106/

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1324>

3 years agoplugin-development: basics-boilerplate: Remove unneeded meson.build edit step
Tyler Compton [Fri, 9 Jul 2021 23:01:42 +0000 (16:01 -0700)]
plugin-development: basics-boilerplate: Remove unneeded meson.build edit step

Closes https://gitlab.freedesktop.org/gstreamer/gst-docs/-/merge_requests/157/

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1324>

3 years agodocs: installing-on-windows: mention packages to download
Teh Yule Kim [Sat, 10 Jul 2021 06:09:05 +0000 (06:09 +0000)]
docs: installing-on-windows: mention packages to download

Closes https://gitlab.freedesktop.org/gstreamer/gst-docs/-/merge_requests/158/

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1324>

3 years agodocs: tutorials: add link to Rust version of the tutorials
Teh Yule Kim [Sat, 10 Jul 2021 09:26:26 +0000 (09:26 +0000)]
docs: tutorials: add link to Rust version of the tutorials

Closes https://gitlab.freedesktop.org/gstreamer/gst-docs/-/merge_requests/159/

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1324>

3 years agodocs: tutorials: playback-3: flesh out build instructions
fjmax [Tue, 17 Aug 2021 09:56:41 +0000 (09:56 +0000)]
docs: tutorials: playback-3: flesh out build instructions

Add information about how to compile this file. The code in this
tutorial also requires `gstreamer-audio-1.0`, so we cannot use
the commands from the previous tutorial.

Closes https://gitlab.freedesktop.org/gstreamer/gst-docs/-/merge_requests/164/

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1324>

3 years agodocs: plugin-dev: basics-boilerplate: fix typo in variable name
wngecn [Wed, 29 Sep 2021 05:46:12 +0000 (05:46 +0000)]
docs: plugin-dev: basics-boilerplate: fix typo in variable name

Closes https://gitlab.freedesktop.org/gstreamer/gst-docs/-/merge_requests/166/

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1324>

3 years agoavtpsrc: Use correct size for provided buffers
Timo Wischer [Wed, 6 Oct 2021 13:54:09 +0000 (15:54 +0200)]
avtpsrc: Use correct size for provided buffers

Without this patch the following pipeline would send packets containing
garbage in the data section.
$ gst-launch-1.0 avtpsrc ! avtpsink

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1077>

3 years agoappsrc: log when segment changes
Guillaume Desmottes [Tue, 9 Nov 2021 11:01:13 +0000 (12:01 +0100)]
appsrc: log when segment changes

We were logging when it does not change but not when it does, which is
confusing when reading logs.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1327>

3 years agoavtp: crfsync: Warn when CRF package not yet received
Timo Wischer [Thu, 15 Oct 2020 12:49:58 +0000 (14:49 +0200)]
avtp: crfsync: Warn when CRF package not yet received

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1075>

3 years agov4l2bufferpool: set video alignment of video meta
Haihua Hu [Tue, 9 Nov 2021 05:36:28 +0000 (13:36 +0800)]
v4l2bufferpool: set video alignment of video meta

need apply video alignment info on video meta, downstream
element can get buffer alignment from video meta

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1326>

3 years agotest: avtp: crf: Check for rounding errors
Timo Wischer [Wed, 3 Mar 2021 09:08:57 +0000 (10:08 +0100)]
test: avtp: crf: Check for rounding errors

on average period calculation.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1073>

3 years agoavtp: crf: Use double for average period calculation
Timo Wischer [Wed, 11 Nov 2020 15:50:28 +0000 (16:50 +0100)]
avtp: crf: Use double for average period calculation

to also support CRF intervals like every 1,333,333ns 64 events

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1073>

3 years agotests: avtp: crf: Test for timestamp_interval > 1
Timo Wischer [Tue, 12 Jan 2021 09:03:32 +0000 (10:03 +0100)]
tests: avtp: crf: Test for timestamp_interval > 1

in case of CRF AVTPDUs with single CRF timestamp.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1076>

3 years agoavtp: crf: Properly handling one timestamp per PDU
Timo Wischer [Wed, 16 Sep 2020 15:12:32 +0000 (17:12 +0200)]
avtp: crf: Properly handling one timestamp per PDU

The average_period should always represent the time between two
events. The specification defines the event time as the time
between audio samples, video frame sync, video line sync, etc.
In case of one timestamp per PDU the timestamp_interval identifies
the amount of events between the timestamp of one PDU and the
timestamp of the next PDU.
As described in IEEE 1722-2016 chapter
"10.4.12 timestamp_interval field" timestamp_interval shall be
nonzero.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1076>

3 years agoshm: NetBSD build fix
Thomas Klausner [Mon, 8 Nov 2021 19:18:51 +0000 (20:18 +0100)]
shm: NetBSD build fix

shm_unlink() and friends live in librt on NetBSD. Adapt build system.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1323>

3 years agobin: Don't check twice for adding a bin to itself or removing it from itself
Sebastian Dröge [Mon, 8 Nov 2021 13:28:06 +0000 (15:28 +0200)]
bin: Don't check twice for adding a bin to itself or removing it from itself

This is already covered by a `g_return_val_if_fail()` in the calling
function.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1320>

3 years agobin: Switch `g_warning()`s to `GST_WARNING_OBJECT()`s when adding/removing an element...
Sebastian Dröge [Mon, 8 Nov 2021 13:30:18 +0000 (15:30 +0200)]
bin: Switch `g_warning()`s to `GST_WARNING_OBJECT()`s when adding/removing an element to a bin fails

The failure conditions can be overidden by subclasses, and a boolean
return value is provided to the caller whether adding/removing the child
element has actually worked. The caller can then handle this
accordingly but flooding stderr with this is not very useful.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1320>

3 years agovpxdec: Skip check of key frame when open GOP
Zhao, Gang [Sat, 6 Nov 2021 08:48:20 +0000 (16:48 +0800)]
vpxdec: Skip check of key frame when open GOP

Valid stream [1] might has no key frame.

Fixed: https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/issues/890

[1] https://storage.googleapis.com/downloads.webmproject.org/test_data/libvpx/vp90-2-16-intra-only.webm

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1316>

3 years agogst-integration-tests: medias: update git module to latest commit
Tim-Philipp Müller [Mon, 18 Oct 2021 16:42:37 +0000 (17:42 +0100)]
gst-integration-tests: medias: update git module to latest commit

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1184>

3 years agoosxaudio: Increase max channels to 64
Joe Todd [Tue, 5 Oct 2021 17:07:06 +0000 (18:07 +0100)]
osxaudio: Increase max channels to 64

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1059>

3 years agogstinfo: Fix leak in generate_backtrace_trace
Nicolas Dufresne [Fri, 24 Sep 2021 12:19:51 +0000 (08:19 -0400)]
gstinfo: Fix leak in generate_backtrace_trace

Spotted by Laurent Pinchart.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/901>

3 years agoaom: Set fixed_qp_offsets to a deactivated value
Martin Reboredo [Fri, 21 May 2021 19:56:33 +0000 (16:56 -0300)]
aom: Set fixed_qp_offsets to a deactivated value

aom only uses fixed_qp_offsets with the
Constant Quality (Q) Rate Control mode,
previously this was locking any usage
with another Rate Control mode.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1198>

3 years agomeson:ges: Fix typo adding ges gir to libs list
Thibault Saunier [Mon, 8 Nov 2021 14:08:45 +0000 (11:08 -0300)]
meson:ges: Fix typo adding ges gir to libs list

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1322>

3 years agogst-ptp-helper: Do not disable multicast loopback
Nirbheek Chauhan [Thu, 4 Nov 2021 07:54:57 +0000 (13:24 +0530)]
gst-ptp-helper: Do not disable multicast loopback

Otherwise we cannot run gst-ptp-helper if the PTP master is on the
same device.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1306>

3 years agotests:ges: Take TIMEOUT_FACTOR into account
Thibault Saunier [Fri, 5 Nov 2021 14:36:11 +0000 (11:36 -0300)]
tests:ges: Take TIMEOUT_FACTOR into account

This env var is set in the CI so we grow the timeout as required
(when running in valgrind for example).

See https://gitlab.freedesktop.org/gstreamer/gstreamer/-/jobs/15449209

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1315>

3 years agomagicleap: update lumin_rt libraries names to the latest official version
Antonio Ospite [Fri, 5 Nov 2021 12:12:14 +0000 (13:12 +0100)]
magicleap: update lumin_rt libraries names to the latest official version

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1314>

3 years agocodecs: h264dec: Calculate the latency by its bump mode.
He Junyan [Mon, 4 Oct 2021 17:07:57 +0000 (01:07 +0800)]
codecs: h264dec: Calculate the latency by its bump mode.

The current latency calculation just uses the num_reorder_frames,
which is not very precise. We should consider the bump mode of the
DPB, the faster it bumps, the lower latency we will have.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1046>

3 years agodoc: Update nvdec documentation
Thibault Saunier [Thu, 4 Nov 2021 19:06:22 +0000 (19:06 +0000)]
doc: Update nvdec documentation

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

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1309>

3 years agoimagefreeze: Only set caps if they do not match current caps
Sanchayan Maity [Fri, 5 Nov 2021 09:47:20 +0000 (15:17 +0530)]
imagefreeze: Only set caps if they do not match current caps

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1311>

3 years agoh264parse: Don't insert extra AUD if exists in bitstream already
Seungha Yang [Wed, 3 Nov 2021 08:09:52 +0000 (17:09 +0900)]
h264parse: Don't insert extra AUD if exists in bitstream already

AUD nalu in packetized format is completely valid and therefore we should not
assume that we should insert AUD for packetized -> bytestream
conversion.

Fixes: https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/862
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1296>

3 years agotests: h264parse: Add test for AUD insertion
Seungha Yang [Wed, 3 Nov 2021 11:36:09 +0000 (20:36 +0900)]
tests: h264parse: Add test for AUD insertion

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1296>

3 years agov4l2: Support bools for setting extra-controls
Sebastian Dröge [Thu, 4 Nov 2021 14:04:30 +0000 (16:04 +0200)]
v4l2: Support bools for setting extra-controls

They're just mapped to 0 / 1 and can already be set as integers, but
being able to set them as booleans seems useful.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1308>

3 years agowasapi2ringbuffer: Fix client object leak
Seungha Yang [Thu, 4 Nov 2021 07:36:05 +0000 (16:36 +0900)]
wasapi2ringbuffer: Fix client object leak

Check whether ringbuffer is holding client object already since
open_device() may be called multiple times

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1307>

3 years agowebrtcbin: Clear errors from finding codec preferences before the next iteration
Sebastian Dröge [Thu, 4 Nov 2021 10:48:28 +0000 (12:48 +0200)]
webrtcbin: Clear errors from finding codec preferences before the next iteration

The media is just skipped and the error is not propagated to the caller,
so keeping it around here would cause assertions a bit later when trying
to set a new error over the old one.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1291>