platform/upstream/gstreamer.git
2 years agov4l2object: rename crop function to reflect its usage
Damian Hobson-Garcia [Thu, 30 Sep 2021 08:56:56 +0000 (17:56 +0900)]
v4l2object: rename crop function to reflect its usage

The gst_v4l2_object_set_crop() is used for removing buffer
alignment padding. Give it a name that better reflects
that usage.  This helps to distinguish from cropping of the
input image (e.g. cropping at the image sensor on a captre
device), which can be  unrelated to the memory buffer padding,
especially if scaling is involved.

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

2 years agoplaybin3: Remove stale code
Jan Schmidt [Tue, 1 Mar 2022 16:45:48 +0000 (03:45 +1100)]
playbin3: Remove stale code

Remove now-unused get_stream_type_for_event() function.

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

2 years agodecodebin3: Reset parsebin when new caps arrive
Edward Hervey [Fri, 21 Jan 2022 15:23:38 +0000 (16:23 +0100)]
decodebin3: Reset parsebin when new caps arrive

Check if parsebin can handle the new caps, and if not reset it so that it can
reconfigure itself for the new stream format.

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

2 years agodecodebin3: Convert checks to assertions
Edward Hervey [Wed, 9 Mar 2022 09:15:08 +0000 (10:15 +0100)]
decodebin3: Convert checks to assertions

"decodebin.input" is never resetted and should always be present, therefore make
it an assertion check

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

2 years agoparsebin: Implement ACCEPT_CAPS handling
Edward Hervey [Fri, 21 Jan 2022 13:52:07 +0000 (14:52 +0100)]
parsebin: Implement ACCEPT_CAPS handling

The default query handler would go through typefind, which by default accepts
any CAPS. But once configured, parsebin can't reconfigure itself, it should
therefore pass through the ACCEPT_CAPS query to the first element after
typefind (if any).

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

2 years agoplaybin3: Hold playbin lock on pad-added
Jan Schmidt [Mon, 17 Jan 2022 18:48:08 +0000 (05:48 +1100)]
playbin3: Hold playbin lock on pad-added

Take the playbin lock when accessing the combiner
to add a new pad to link to. Fixes races against
streams-selected messages triggering reconfiguration.

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

2 years agoplaybin3: Reconfigure on streams-selected message.
Jan Schmidt [Mon, 17 Jan 2022 15:52:47 +0000 (02:52 +1100)]
playbin3: Reconfigure on streams-selected message.

Don't reconfigure outputs when the select-streams
event is sent from the app, as the selection may
not take effect for some time. Instead, wait
for the pipeline to confirm the new set of
selected streams when it sends the message.

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

2 years agoplaysink: Fix reconfiguration after removing text_sink
Jan Schmidt [Wed, 10 Nov 2021 16:20:23 +0000 (03:20 +1100)]
playsink: Fix reconfiguration after removing text_sink

If we previously had subtitles coming in, the video
may be chained through a text overlay block. Before,
the code would end up trying to link pads that were
already linked and video would not get reconnected
properly.

To fix that, make sure that the candidate
pads are actually unlinked first. If a textoverlay
is present and no longer needed, it will be cleaned
up later in the reconfiguration sequence.

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

2 years agoplaysink: Complete reconfiguration on pad release.
Jan Schmidt [Fri, 6 Aug 2021 09:27:02 +0000 (19:27 +1000)]
playsink: Complete reconfiguration on pad release.

Requesting a new pad can start a reconfiguration cycle, where
playsink will block all input pads and wait for data on them
before doing internal reconfiguration. If a pad is released,
that reconfiguration might never trigger because it's now waiting
for a pad that doesn't exist any more.

In that case, complete the reconfiguration on pad release.

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

2 years agoh264decoder: Fix invalid memory access
Seungha Yang [Fri, 11 Mar 2022 10:32:59 +0000 (19:32 +0900)]
h264decoder: Fix invalid memory access

gst_h264_dpb_needs_bump() can be called with null picture
in case of live

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

2 years agortponviftimestamp: add support for using reference timestamps
Branko Subasic [Thu, 10 Feb 2022 07:01:02 +0000 (08:01 +0100)]
rtponviftimestamp: add support for using reference timestamps

Make it posible to configure the element to obtain the timestamps from
reference timestamp meta data instead of using the ntp-offset property,
or estimating its own offset. Currently the only time format supported
is "timestamp/x-unix", i.e. UTC time expressed in the unix time epoch.

In addition the custom event GstNtpOffset has been renamed to
GstOnvifTimestamp, to reflect that it is not necessarily used to convey
the ntp-offset. As a consequence we had to modify a couple of files in
the rtsp-server as well.

Fixes #984

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

2 years agopbutils: Add function to parse RFC 6381 codecs field
Edward Hervey [Tue, 8 Mar 2022 08:46:33 +0000 (09:46 +0100)]
pbutils: Add function to parse RFC 6381 codecs field

This is the opposite of `gst_codec_utils_caps_get_mime_codec()`, which allows
elements to get the `GstCaps`

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

2 years agosdpdemux: add media attributes to caps to fix ptp clock handling
Tim-Philipp Müller [Thu, 10 Mar 2022 18:40:12 +0000 (18:40 +0000)]
sdpdemux: add media attributes to caps to fix ptp clock handling

Those are needed by rtpjitterbuffer to do the right thing, e.g.

a=ts-refclk:ptp=IEEE1588-2008:00-**-**-**-**-**-**-**:0
a=mediaclk:direct=1266592257

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

2 years agortpvp8depay: Fix crash when making 'GstRTPPacketLost' custom event
Sangchul Lee [Thu, 10 Mar 2022 09:43:45 +0000 (18:43 +0900)]
rtpvp8depay: Fix crash when making 'GstRTPPacketLost' custom event

This patch fixes a seg.fault in gst_structure_new() with warnings as below.

GLib-GObject-WARNING **:
 ../gobject/gtype.c:4330: type id '0' is invalid
GLib-GObject-WARNING **:
 can't peek value table for type '<invalid>' which is not currently referenced

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

2 years agocudamemorycopy: add D3D11 resource support
Corentin Damman [Tue, 8 Mar 2022 15:20:27 +0000 (16:20 +0100)]
cudamemorycopy: add D3D11 resource support

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

2 years agocudacontext: find associated DXGI Adapter LUID
Corentin Damman [Wed, 9 Mar 2022 08:35:16 +0000 (09:35 +0100)]
cudacontext: find associated DXGI Adapter LUID

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

2 years agocudautils: add support of D3D11 resource as Cuda graphics resource type
Corentin Damman [Mon, 28 Feb 2022 13:40:51 +0000 (14:40 +0100)]
cudautils: add support of D3D11 resource as Cuda graphics resource type

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

2 years agocudaloader: add D3D11 API
Corentin Damman [Mon, 28 Feb 2022 10:24:31 +0000 (11:24 +0100)]
cudaloader: add D3D11 API

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

2 years agompegts: Handle glib < 2.58
Edward Hervey [Thu, 10 Mar 2022 09:33:56 +0000 (10:33 +0100)]
mpegts: Handle glib < 2.58

By using a workaround to the lack of g_ptr_array_steal_index.

Fixes #1078

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

2 years agowebrtcbin: fix ulpfecenc passthrough pt
Matthew Waters [Thu, 10 Mar 2022 04:36:00 +0000 (15:36 +1100)]
webrtcbin: fix ulpfecenc passthrough pt

ulpfecenc uses a value of pt=255 for passthrough.

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

2 years agonvh264dec,nvh265dec: Fix broken key-unit trick and reverse playback
Seungha Yang [Wed, 9 Mar 2022 17:28:11 +0000 (02:28 +0900)]
nvh264dec,nvh265dec: Fix broken key-unit trick and reverse playback

On GstVideoDecoder::{drain,flush}, we send null packet with
CUVID_PKT_ENDOFSTREAM flag to drain out decoder. Which will
reset CUVID parser as well.
To continue decoding after the drain, the next input buffer
should include sequence headers otherwise CUVID parser will
not report any decodeable frame.

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

2 years agortpbasepayload: Remove dead twcc code
Nirbheek Chauhan [Wed, 9 Mar 2022 10:32:06 +0000 (16:02 +0530)]
rtpbasepayload: Remove dead twcc code

This feature was removed in 7a53fbad68d702ca4905f7da223f4d2884548edc,
but this code was left behind.

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

2 years agortpbin: allow FEC elements with Always pads
Tomasz Andrzejak [Fri, 4 Mar 2022 17:58:56 +0000 (18:58 +0100)]
rtpbin: allow FEC elements with Always pads

This patch enable picking up FEC decoder or enocder that have
static repair packets pad.

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

2 years agosoup: Load the runtime library, not the development library
Nirbheek Chauhan [Wed, 9 Mar 2022 06:47:11 +0000 (12:17 +0530)]
soup: Load the runtime library, not the development library

libsoup-2.4.so / libsoup-3.0.so are symlinks installed by development
packages, they are not available at runtime.

Also eliminate G_MODULE_SUFFIX since it's not useful for us, and is
actually incorrect on macOS anyway.

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

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

2 years agosubparse: Handle GAP events before buffers
Edward Hervey [Tue, 14 Dec 2021 15:14:56 +0000 (16:14 +0100)]
subparse: Handle GAP events before buffers

Make sure we did initial negotiation and segment pushing if we get GAP events
before buffers.

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

2 years agotagdemux: Properly propagate sequence numbers
Edward Hervey [Wed, 17 Nov 2021 14:30:38 +0000 (15:30 +0100)]
tagdemux: Properly propagate sequence numbers

If we received a time segment from upstream, we need to make sure we propagate
it downstream with the same sequence number.

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

2 years agotsbase: Handle more program updates
Edward Hervey [Tue, 2 Nov 2021 08:20:55 +0000 (09:20 +0100)]
tsbase: Handle more program updates

There could be a case where the new program has the same program number as the
previous one ... but is actually located on a PID previously used for elementary
stream. In that case the program is guaranteed to not be an update of the
previous program but a completely new one.

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

2 years agompegtsbase: Use an array to track programs
Edward Hervey [Tue, 2 Nov 2021 08:18:57 +0000 (09:18 +0100)]
mpegtsbase: Use an array to track programs

We need to be able to look for programs by their PID also. Using a hash table
was a bit sub-par (and overkill) for storing a range of programs.

This is needed because there could potentially be two programs with the same
program id but different PMT PID (while one is being deactivated the new one
would "exist").

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

2 years agomultiqueue: Fix interleave calculation for data before segment start
Edward Hervey [Wed, 2 Mar 2022 16:07:37 +0000 (17:07 +0100)]
multiqueue: Fix interleave calculation for data before segment start

This commit modifies the interleave calculation to allow growing when incoming
data is before the segment start.

The rationale is that there is no requirement whatsoever for data before the
segment start to be "coherent" on all streams.

For example, a demuxer could rightfully send data from the video stream from the
previous keyframe (potentially quite a bit before the segment start) and the
audio from just before the segment start.

This will activate the same logic as growing the interleave when some streams
haven't received buffers yet.

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

2 years agomultiqueue: Improve interleave calculation at startup and EOS
Edward Hervey [Fri, 6 Aug 2021 06:30:39 +0000 (08:30 +0200)]
multiqueue: Improve interleave calculation at startup and EOS

* When a stream receives EOS, it will no longer change, we shouldn't take that
  stream into account for interleave calculation.

* When streams (re)appear, we do not want to grow the initial interleave values
  to excessive values. Instead of setting it to a default of 5s, progressively
  grow it to that maximum.

* When the status of input streams change (i.e. going to/from "some haven't
received data yet" and "all have received data"), update the interleave
immediately instead of waiting for (potentially) 5s of data before updating
it.

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

2 years agogst-python: gstmodule.c: fix build with 3.11
Mathieu Duponchelle [Fri, 4 Feb 2022 14:53:45 +0000 (15:53 +0100)]
gst-python: gstmodule.c: fix build with 3.11

https://docs.python.org/fr/3.10/whatsnew/3.10.html

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

2 years agoqtdemux: Propagate stick events downstream when creating pads
Edward Hervey [Wed, 10 Jul 2019 15:21:01 +0000 (17:21 +0200)]
qtdemux: Propagate stick events downstream when creating pads

If upstream provided a stream collection event before any pads were created,
make sure it's propagated downstream when pads are created.

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

2 years agortprtxsend: if no rtx is present, don't expose a rtx-ssrc in caps
Havard Graff [Mon, 1 Feb 2021 15:07:08 +0000 (16:07 +0100)]
rtprtxsend: if no rtx is present, don't expose a rtx-ssrc in caps

The point here is that rtpsession will create a new rtpsource when
the field "rtx-ssrc" is present, and when not doing rtx, that means
a random ssrc will create a new rtpsource that will be included in RTCP
messages for the current session.

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

2 years agovah264enc: Invert video codec frame dependency.
Víctor Manuel Jáquez Leal [Fri, 4 Mar 2022 12:19:17 +0000 (13:19 +0100)]
vah264enc: Invert video codec frame dependency.

Instead of using GstMiniObject to hold H264 frame, now it uses a plain
structure. Besides, instead of holding a reference to
GstVideoCodecFrame, the H264 frame structure is set as a
GstVideoCodecFrame user data.

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

2 years agovaapih265dec: fixed st_rps_bits setting in h265 decoding.
GuYanjie [Tue, 8 Mar 2022 06:54:34 +0000 (14:54 +0800)]
vaapih265dec: fixed st_rps_bits setting in h265 decoding.

According to va_dec_hevc.h, pic_param->st_rps_bits should be set
for accelorater to skip parsing the *short_term_ref_pic_set
(num_short_term_ref_pic_sets) structure.
Also modified fill_picture to get parser info as a parameter,
in order to get slide_hdr->short_term_ref_pic_set_size.

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

2 years agortprtxsend: don't process or warn if no map is set
Havard Graff [Wed, 22 Jun 2016 12:48:59 +0000 (14:48 +0200)]
rtprtxsend: don't process or warn if no map is set

This makes it more gentle when doing "pass-through"

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

2 years agocudamemorycopy: Fix GL resource leak
Seungha Yang [Tue, 8 Mar 2022 17:14:50 +0000 (02:14 +0900)]
cudamemorycopy: Fix GL resource leak

Clear GL resources on stop()

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

2 years agoplaybin3: Add lock to protect buffering messages
Jan Schmidt [Tue, 1 Mar 2022 16:43:00 +0000 (03:43 +1100)]
playbin3: Add lock to protect buffering messages

Fix a small race where a group can receive stream-start
and post a pending buffering message just as another
thread posts a different buffering message, causing them
to be received by the application out of order. In the
worst case, this leads the application receiving a
stale 99% buffering message and going back to buffering
right after the 100% buffering message.

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

2 years agogstreamer-sharp: Add test checking AppSrc and AppSink constructors work properly
Jakub Adam [Tue, 7 Jul 2020 13:21:24 +0000 (15:21 +0200)]
gstreamer-sharp: Add test checking AppSrc and AppSink constructors work properly

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

2 years agogstreamer-sharp: Fix App{Src,Sink} constructors
Jakub Adam [Mon, 6 Jul 2020 21:15:22 +0000 (23:15 +0200)]
gstreamer-sharp: Fix App{Src,Sink} constructors

Apparently GtkSharp expects each object has only one ToggleRef at any
time. Assigning element.Handle into Raw has a consequence that second
ToggleRef attempts to get created but fails on g_object_unref () that
breaks a GObject assertion:

  toggle_refs_notify: assertion failed: (tstack.n_toggle_refs == 1)

This is because toggle references should be removed with
g_object_remove_toggle_ref(), not a simple unref().

In order to avoid duplicate toggle references, introduce
ElementFactory.MakeRaw(), which creates a GstElement without its
accompanying C# object. The returned raw pointer can be assigned into
another GLib.Object without trouble.

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

2 years agompegtsmux: Start last_ts with GST_CLOCK_TIME_NONE
Jan Alexander Steffens (heftig) [Mon, 7 Mar 2022 17:46:55 +0000 (18:46 +0100)]
mpegtsmux: Start last_ts with GST_CLOCK_TIME_NONE

And use the output segment position for the outgoing timestamp while it
is. This is needed to delay the calculation of `output_ts_offset` until
we actually have a usable timestamp, as tsmux will output a few initial
packets while `last_ts` is still unset.

Without this, the calculation would use the initial `0` value, which did
not have the intended effect of making VBR mode behave like CBR mode,
but always calculated an offset equal to the selected start time.

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

2 years agompegtsmux: Use GST_CLOCK_STIME_NONE for output_ts_offset
Jan Alexander Steffens (heftig) [Mon, 7 Mar 2022 17:46:08 +0000 (18:46 +0100)]
mpegtsmux: Use GST_CLOCK_STIME_NONE for output_ts_offset

It's a GstClockTimeDiff, thus GST_CLOCK_TIME_NONE isn't appropriate.

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

2 years agodecklink: Update SDK version to 12.2.2
Seungha Yang [Mon, 7 Mar 2022 16:26:50 +0000 (01:26 +0900)]
decklink: Update SDK version to 12.2.2

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

2 years agortprtxreceive: fix crash when RTX payload has zero length
Mikhail Fludkov [Tue, 23 Aug 2016 17:06:49 +0000 (19:06 +0200)]
rtprtxreceive: fix crash when RTX payload has zero length

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

2 years agocheck: Fix valgrind suppression for debug function list
sergei.kovalev [Mon, 20 Dec 2021 16:31:17 +0000 (17:31 +0100)]
check: Fix valgrind suppression for debug function list

Fix suppression to support release and debug builds.

Here is the debug build call stack:
```
==10707==    by 0x48B5520: g_malloc (gmem.c:106)
==10707==    by 0x48D19DC: g_slice_alloc (gslice.c:1069)
==10707==    by 0x48D3947: g_slist_copy_deep (gslist.c:619)
==10707==    by 0x48D38B8: g_slist_copy (gslist.c:567)
==10707==    by 0x4ADC90B: gst_debug_remove_with_compare_func (gstinfo.c:1504)
```

In release build `g_slist_copy (gslist.c:567)` got inlined:
```
==15419==    by 0x48963E0: g_malloc (gmem.c:106)
==15419==    by 0x48AA382: g_slice_alloc (gslice.c:1069)
==15419==    by 0x48AB732: g_slist_copy_deep (gslist.c:619)
==15419==    by 0x4A39B8F: gst_debug_remove_with_compare_func (gstinfo.c:1504)
```

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

2 years agortprtxreceive: allow passthrough and non-rtp buffers
Havard Graff [Sun, 26 Jun 2016 20:25:46 +0000 (22:25 +0200)]
rtprtxreceive: allow passthrough and non-rtp buffers

To avoid mapping rtp buffers when RTX is not in use, and to not
do a full error on receiving a non-rtp buffer, since you have no control
of what a rouge sender might send you.

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

2 years agortprtx: don't access type-system per buffer
Havard Graff [Mon, 8 Feb 2021 20:40:19 +0000 (21:40 +0100)]
rtprtx: don't access type-system per buffer

When doing only a single stream of audio/video this hardly matters,
but when doing many at the same time, the fact that you have to get
a hold of the glib global type-system lock every time you process a buffer,
means that there is a limit to how many streams you can process in
parallel.

Luckily the fix is very simple, by doing a cast rather than a full
type-check.

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

2 years agortprtx: signed/unsigned and style fixes
Havard Graff [Mon, 10 Feb 2020 13:37:30 +0000 (14:37 +0100)]
rtprtx: signed/unsigned and style fixes

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

2 years agocudamemorycopy: Remove texture-target caps field
Seungha Yang [Mon, 7 Mar 2022 18:45:01 +0000 (03:45 +0900)]
cudamemorycopy: Remove texture-target caps field

It's GL specific field, and we can remove it unconditionally

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

2 years agocudaupload,cudadownload: Add support for dGPU NVMM
Seungha Yang [Fri, 4 Mar 2022 17:30:24 +0000 (02:30 +0900)]
cudaupload,cudadownload: Add support for dGPU NVMM

Implement NVMM <-> CUDA, GL, SYSTEM memory conversion. Jetson is
not supported yet. Note that NVMM <-> GL interop on Jetson platform
is supported by GstGL

Some example pipelines are:
- Convert NVMM to GstGL memory
  nvv4l2decoder ! "video/x-raw(memory:NVMM)" ! cudadownload ! "video/x-raw(memory:GLMemory)" ! glimagesink

- Upload system memory to NVMM and encode
  video/x-raw,format=NV12 ! cudaupload ! "video/x-raw(memory:NVMM)" ! nvv4l2h264enc

- Convert NVMM to GstCUDA memory and encode
  nvvideoconvert ! "video/x-raw(memory:NVMM)" ! cudaupload ! "video/x-raw(memory:CUDAMemory)" ! nvh264enc

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

2 years agoUpdate wrap files from latest wrapdb version
Xavier Claessens [Mon, 7 Mar 2022 13:49:43 +0000 (08:49 -0500)]
Update wrap files from latest wrapdb version

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

2 years agova: encoder: Don't preallocate reconstruct buffers.
Víctor Manuel Jáquez Leal [Thu, 3 Mar 2022 14:06:00 +0000 (15:06 +0100)]
va: encoder: Don't preallocate reconstruct buffers.

It's not required by VA to register the reconstruct buffers at context
creation, just as in decoders.

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

2 years agov4l2bufferpool: Fix race condition between qbuf and pool streamoff
Hou Qi [Thu, 3 Mar 2022 05:47:05 +0000 (13:47 +0800)]
v4l2bufferpool: Fix race condition between qbuf and pool streamoff

There is a chance that pool->buffers[index] sets BUFFER_STATE_QUEUED, but
it has not been queued yet which makes pool->buffers[index] still NULL.
At this time, if pool_streamff release all buffers with BUFFER_STATE_QUEUED
state regardless of whether the buffer is NULL or not, it will cause segfault.

To fix this, also check buffer when streamoff release buffer.

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

2 years agogst-rtsp-server: Plug a few memory leaks in tests
Branko Subasic [Fri, 18 Feb 2022 15:05:53 +0000 (16:05 +0100)]
gst-rtsp-server: Plug a few memory leaks in tests

Found and fixed a few memory leaks in the gst_rtspserver, gst_onvif and
gst_stream tests by running the tests in valgrind.

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

2 years agoflvmux: Add protection when unref GstFlvMuxPad
Hou Qi [Thu, 3 Mar 2022 06:22:10 +0000 (14:22 +0800)]
flvmux: Add protection when unref GstFlvMuxPad

This is to avoid gst_object_unref: assertion 'object != NULL' failed.

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

2 years agogstplay: tests: Keep track of errors/warnings
Philippe Normand [Mon, 7 Mar 2022 10:19:53 +0000 (10:19 +0000)]
gstplay: tests: Keep track of errors/warnings

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

2 years agogstplay: Do not error out on message parsing failures
Philippe Normand [Mon, 7 Mar 2022 10:16:36 +0000 (10:16 +0000)]
gstplay: Do not error out on message parsing failures

Specially when parsing errors and warnings, the details field can be NULL and
the gst_structure_get() call would return FALSE in such cases, triggering false
positive errors.

Follow-up for #1063

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

2 years agogstplay: Fix warning parsing API
Philippe Normand [Mon, 7 Mar 2022 10:14:43 +0000 (10:14 +0000)]
gstplay: Fix warning parsing API

The GError is an out parameter, so should be a ** parameter, like the details
parameter.

See also #1063

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

2 years agocudamemorycopy: Fix build when gl is disabled
Seungha Yang [Mon, 7 Mar 2022 09:59:37 +0000 (18:59 +0900)]
cudamemorycopy: Fix build when gl is disabled

Fixes: https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/issues/1707
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1868>

2 years agogst-rtsp-server: fix race in rtsp-client
Branko Subasic [Mon, 7 Mar 2022 08:14:46 +0000 (09:14 +0100)]
gst-rtsp-server: fix race in rtsp-client

When tunneling over HTTP, if connection on the second channel happens
before the control timer is created we may trigger an assert in
rtsp_ctrl_timeout_remove(). Avoid that by taking the priv->lock before
attaching the client thread to the context.

Fixes #1025

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

2 years agomsdkdec: Fix to not trigger SFC scaling when vpp at downstream
Mengkejiergeli Ba [Wed, 2 Mar 2022 01:15:12 +0000 (09:15 +0800)]
msdkdec: Fix to not trigger SFC scaling when vpp at downstream

When there is vpp scaling downstream, we need to make sure SFC is not
triggered because vpp may fall into passthrough mode which causes
the decoder negotiation to create src caps with vpp scaled width/height.

This patch includes bitstream's original size in first query with
downstream in gst_msdkdec_src_caps, which is the same for what we do for
color format in this query. This is to ensure SFC scaling starts to
work only when downstream directly asks for a different size instead of
through vpp.

Note that here SFC scaling follows the same behavior as msdkvpp:
if user only changes width or height, e.g. dec ! video/x-raw,width=xx !,
the height will be modified to the value which fits the original DAR.

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

2 years agoencodebasebin: Use GST_DEBUG instead of GST_ERROR when skipping muxer
Hou Qi [Wed, 2 Mar 2022 04:15:19 +0000 (12:15 +0800)]
encodebasebin: Use GST_DEBUG instead of GST_ERROR when skipping muxer

_get_muxer() skips the muxers that do not satisfy the requirement and select
the desired one. It should not print error log, so use debug log instead.

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

2 years agonvcodec: Add missing null check in context sharing code
Seungha Yang [Sun, 6 Mar 2022 10:18:20 +0000 (19:18 +0900)]
nvcodec: Add missing null check in context sharing code

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

2 years agonvcodec: Refactor cudaupload/download and add support for GL memory
Seungha Yang [Thu, 3 Mar 2022 18:33:41 +0000 (03:33 +0900)]
nvcodec: Refactor cudaupload/download and add support for GL memory

* Implement new baseclass GstCudaMemoryCopy to remove duplicated
  cudaupload/download code
* Add support for CUDA <-> GL memory conversion via cudaupload/download

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

2 years agonvcodec: Refactor GstCudaMemory abstraction
Seungha Yang [Wed, 2 Mar 2022 18:25:47 +0000 (03:25 +0900)]
nvcodec: Refactor GstCudaMemory abstraction

* Hide GstCudaMemory member variables
* Make GstCudaAllocator object GstCudaContext independent
* Set offset/stride of memory correctly via video meta
* Drop GST_BUFFER_POOL_OPTION_VIDEO_ALIGNMENT support.
  This implementation actually does not support custom alignment
  because we allocate device memory via cuMemAllocPitch
  of which alignment is almost uncontrollable

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

2 years agonvcodec: Refactor basetransform subclasses
Seungha Yang [Wed, 2 Mar 2022 13:03:54 +0000 (22:03 +0900)]
nvcodec: Refactor basetransform subclasses

* cudaupload/download
  - Specify only formats actually we can deal with
    nvcodec elements, not all video formats
  - Supports CUDA output for download and input for upload in order
    to make passthrough possible, like other upload/download elements.
* cudabasetransform
  - Reset conversion element if upstream CUDA memory
    holds different CUDA context and the element can accept it.
    This is the same behavior as corresponding d3d11 filter elements.

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

2 years agocudabufferpool: Move GstCudaContext object to public member
Seungha Yang [Wed, 2 Mar 2022 11:55:29 +0000 (20:55 +0900)]
cudabufferpool: Move GstCudaContext object to public member

... so that plugins can understand assosicated cuda context with the
pool.

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

2 years agocudacontext: Require explicit gpu id instead of auto (-1)
Seungha Yang [Wed, 2 Mar 2022 17:48:17 +0000 (02:48 +0900)]
cudacontext: Require explicit gpu id instead of auto (-1)

Sync up with GstD3D11Device implementation. The auto stuff should
be handled in context sharing step, not device creation.

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

2 years agonvcodec: Indent update
Seungha Yang [Wed, 2 Mar 2022 18:24:14 +0000 (03:24 +0900)]
nvcodec: Indent update

... to prevent gnu indent version dependent diffs.

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

2 years agocudacontext: Remove unnecessary cuInit() call
Seungha Yang [Tue, 1 Mar 2022 20:01:42 +0000 (05:01 +0900)]
cudacontext: Remove unnecessary cuInit() call

It's already called at plugin init time

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

2 years agoav1parse: Add a comment when the detection of TU fails.
He Junyan [Sat, 5 Mar 2022 03:35:29 +0000 (11:35 +0800)]
av1parse: Add a comment when the detection of TU fails.

Also update the print message.

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

2 years agocamerabin: Remove drain query
Nicolas Dufresne [Fri, 4 Mar 2022 21:48:54 +0000 (16:48 -0500)]
camerabin: Remove drain query

This was to support very old V4L2 kernel. As we moved to DMABuf and can now
detach buffers on renegotiation, the buffer it tries to fix no longer exist.
The risk to blocking indefinitly the application does still exist though.

Fixes #1070

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

2 years agodoc: AV1 demuxers now expose their alignment
Nicolas Dufresne [Fri, 4 Mar 2022 19:57:30 +0000 (14:57 -0500)]
doc: AV1 demuxers now expose their alignment

Update the chache accordingly.

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

2 years agoav1parse: check the error return when parse_alignment_from_caps()
He Junyan [Thu, 3 Mar 2022 15:00:41 +0000 (23:00 +0800)]
av1parse: check the error return when parse_alignment_from_caps()

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

2 years agoav1parse: Use the intersected caps to decide the alignment.
He Junyan [Thu, 3 Mar 2022 14:38:56 +0000 (22:38 +0800)]
av1parse: Use the intersected caps to decide the alignment.

When we negotiate with downstream, We should use the intersected
caps of input and output to decide the alignment and stream format.
The current code just uses the input caps which may lack the stream
format.

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

2 years agoivfparse: Set the alignment to tu for AV1 stream.
He Junyan [Thu, 3 Mar 2022 13:30:00 +0000 (21:30 +0800)]
ivfparse: Set the alignment to tu for AV1 stream.

Just do the same as other demux.

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

2 years agoav1parse: Only detect the stream format when input alignment is tu.
He Junyan [Thu, 3 Mar 2022 09:51:11 +0000 (17:51 +0800)]
av1parse: Only detect the stream format when input alignment is tu.

The demux now outputs the AV1 stream in "tu" alignment, so we do not need
to detect the input alignment. But the annex b stream format is not recognized
by the demux, we still need to detect that stream format for the first input.

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

2 years agomatroska: Fix AV1 alignment to TU
Nicolas Dufresne [Wed, 2 Mar 2022 21:31:24 +0000 (16:31 -0500)]
matroska: Fix AV1 alignment to TU

Matroska stores AV1 in temporal unit, so that all OBU sharing the same
timestamp are put together. This was previously just assumed, which isn't
safe now that we have more alignments.

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

2 years agoisomp4: Fix AV1 default alignment
Nicolas Dufresne [Wed, 2 Mar 2022 21:24:38 +0000 (16:24 -0500)]
isomp4: Fix AV1 default alignment

ISOMP4 store TU (temporal units) worth of AV1. Expose this in the
caps to reduce overhead in the parser, and in the muxer to avoid
storing frames split in the wrong way.

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

2 years agoav1parse: Save the default alignment
Nicolas Dufresne [Wed, 2 Mar 2022 21:22:25 +0000 (16:22 -0500)]
av1parse: Save the default alignment

Otherwise the transformation is not applied and decoders may not
get the appropriate format despite the caps being negotiated
correctly.

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

2 years agoav1parse: Remove duplicated check
Nicolas Dufresne [Wed, 2 Mar 2022 21:20:31 +0000 (16:20 -0500)]
av1parse: Remove duplicated check

The case of both strings being empty is already checked in the
helper function. No functional changes.

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

2 years agovp9parse: Fix auto-plugging of HW frame decoder
Nicolas Dufresne [Fri, 4 Mar 2022 15:02:56 +0000 (10:02 -0500)]
vp9parse: Fix auto-plugging of HW frame decoder

Decoders that required frame aligmment and didn't have an associated
alpha decoder were skipped. This is because the parser was constructing
caps based on the software alpha decoder, which specify super-frame
alignment.

Iterate over the caps to filter the one that have a matching codec-alpha, with
the semantic the no codec-alpha field means codec-alpha=false. Then if
everything was removed, callback to the original, so that the first non-alpha
decoder will be picked.

Fixes #820

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

2 years agomatroskamux: allow width+height caps changes for VP8/9
Tristan Matthews [Mon, 7 Feb 2022 22:51:39 +0000 (17:51 -0500)]
matroskamux: allow width+height caps changes for VP8/9

For VP8 and VP9, width+height changes are signalled inband.

Refs https://github.com/Kurento/bugtracker/issues/535 and
https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/1047/diffs?commit

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

2 years agomatroskamux: allow width + height changes for avc3|hev1
Tristan Matthews [Mon, 7 Feb 2022 21:41:40 +0000 (16:41 -0500)]
matroskamux: allow width + height changes for avc3|hev1

For avc3 and hev1, the intent was to allow more flexibility for caps changes
(see https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/1047/diffs?commit_id=9bd8d608d5bae27ec5ff09e733f76ca32b17420c)
however width and resolution were previously omitted.

avc3 and hev1 specifically support changing stream-parameters on the fly, whereas avc1/hvc1 disallow in-band SPS.

This commit allows for changes to width and height for these which is in line with matroskamux's behaviour prior to 1.14.0.

Practically speaking, one use case where this is commonly seen is when capturing a WebRTC stream, as the browser will adapt the resolution live.

Suggested-by: Mathieu Duponchelle "<mathieu@centricular.com>"
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1657>

2 years agodeinterlace: Prevent race between _set_method and latency query
Jan Alexander Steffens (heftig) [Fri, 4 Mar 2022 14:36:20 +0000 (15:36 +0100)]
deinterlace: Prevent race between _set_method and latency query

It's possible that the method is being manipulated while downstream
queries our latency, leading to crashes.

Prevent that from happening.

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

2 years agotsdemux: Handle PES headers bigger than a mpeg-ts packet
Edward Hervey [Fri, 4 Mar 2022 13:17:47 +0000 (14:17 +0100)]
tsdemux: Handle PES headers bigger than a mpeg-ts packet

While the actual PES header parser could notify us that it needed more data, we
would never actually act on it.

This commit will accumulate incoming packets in such situation and re-attempt
the header parsing.

Fixes #1027

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

2 years agova: basetransform: Add device-path read-only property.
Víctor Manuel Jáquez Leal [Thu, 3 Mar 2022 10:32:23 +0000 (11:32 +0100)]
va: basetransform: Add device-path read-only property.

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

2 years agova: basedec: Add device-path read-only property.
Víctor Manuel Jáquez Leal [Thu, 3 Mar 2022 10:05:36 +0000 (11:05 +0100)]
va: basedec: Add device-path read-only property.

And elements will notify the used device-path if display is DRM.

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

2 years agogldisplay: Reorder GST_GL_WINDOW check for egl-device
Seungha Yang [Fri, 4 Mar 2022 13:21:13 +0000 (22:21 +0900)]
gldisplay: Reorder GST_GL_WINDOW check for egl-device

"egl-device" should be checked before the "egl", otherwise unexpected egl will be picked

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

2 years agovah264enc: Remove GST_PARAM_CONDITIONALLY_AVAILABLE.
Víctor Manuel Jáquez Leal [Fri, 4 Mar 2022 12:34:50 +0000 (13:34 +0100)]
vah264enc: Remove GST_PARAM_CONDITIONALLY_AVAILABLE.

Since it's used only when the property is conditionally installed, and
these parameters are always installed.

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

2 years agova: encoder: Clean dead code.
He Junyan [Fri, 4 Mar 2022 08:15:42 +0000 (09:15 +0100)]
va: encoder: Clean dead code.

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

2 years agova: encoder: Fix error code path when open.
Víctor Manuel Jáquez Leal [Thu, 3 Mar 2022 13:08:16 +0000 (14:08 +0100)]
va: encoder: Fix error code path when open.

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

2 years agovah264enc: Remove preferred_output_delay.
Víctor Manuel Jáquez Leal [Thu, 3 Mar 2022 12:57:35 +0000 (13:57 +0100)]
vah264enc: Remove preferred_output_delay.

In the current state of the encoder it's just dead code.

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

2 years agovah264enc: Avoid mapping coded buffer twice.
Víctor Manuel Jáquez Leal [Thu, 3 Mar 2022 08:59:28 +0000 (09:59 +0100)]
vah264enc: Avoid mapping coded buffer twice.

Currently for copying the coded buffer onto a GStreamer buffer, the
coded buffer is mapped two times: one for getting the size, and later
for do the actual copy. We can avoid this by doing directly in the
element rather than in the general encoder object.

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

2 years agovah264enc: Single parameter array per picture.
Víctor Manuel Jáquez Leal [Wed, 2 Mar 2022 19:53:16 +0000 (20:53 +0100)]
vah264enc: Single parameter array per picture.

There's no need, at least in H.264, to hold a global parameter array,
since there's no need to submit SPS, trellis, hdr or quality in every
buffer, but only on IDR ones.

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

2 years agova: Fix log message
Víctor Manuel Jáquez Leal [Wed, 2 Mar 2022 19:06:01 +0000 (20:06 +0100)]
va: Fix log message

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

2 years agoplay: Fix error parsing API
Philippe Normand [Fri, 4 Mar 2022 09:57:02 +0000 (09:57 +0000)]
play: Fix error parsing API

The GError is an out parameter, so should be a ** parameter, like the details
parameter.

Fixes #1063

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

2 years agowebrtc: support renegotiating adding/removing RTX
Matthew Waters [Tue, 3 Aug 2021 02:14:49 +0000 (12:14 +1000)]
webrtc: support renegotiating adding/removing RTX

We need to always add the RTX/RED/ULPFEC elements as rtpbin will only
call us once to request aux/fec senders/receivers.

We also need to regenerate the media section of the SDP instead of
blindly copying from the previous offer.

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

2 years agomsdkenc: Change default ref frames number as 0
Mengkejiergeli Ba [Tue, 1 Mar 2022 03:43:09 +0000 (11:43 +0800)]
msdkenc: Change default ref frames number as 0

When user does not set ref-frames in pipeline, we should let MediaSDK
decide the reference frame number via setting default value as 0 at
gstreamer side.

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

2 years agomeson: wic: Fix typo
Seungha Yang [Thu, 3 Mar 2022 19:18:06 +0000 (04:18 +0900)]
meson: wic: Fix typo

Should check WIC build option, not MediaFoundation

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