platform/upstream/gstreamer.git
22 months agosamiparse: fix handling of self-closing tags
Tim-Philipp Müller [Wed, 29 Jun 2022 23:13:19 +0000 (00:13 +0100)]
samiparse: fix handling of self-closing tags

We would check the wrong string (rest of line rather than element)
for the / suffix of self-closing tags, which is not only wrong but
also has atrocious performance with certain strings like the garbled
nonsense clusterfuzz feeds us, which might cause discoverer to time
out when processing garbled SAMI files.

Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=47461

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

22 months agoRevert "glupload: Fix caps query with no filter"
Jan Schmidt [Fri, 1 Jul 2022 13:57:08 +0000 (23:57 +1000)]
Revert "glupload: Fix caps query with no filter"

This reverts commit 6f9ae5d7580763b5d18badb76f2166ff0012886a.

The _transform_caps() function can't tell the difference
between the caller wanting to know the output caps
for the current method, or all possible output caps. If
it includes caps for all possible methods, glupload can
end up negotiating and sending the wrong output caps
downstream.

Partially reverts !2687
Fixes #1310

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

22 months agodecklinkvideosink: Pass video frames directly to the Decklink SDK without copying
Sebastian Dröge [Tue, 28 Jun 2022 13:40:55 +0000 (16:40 +0300)]
decklinkvideosink: Pass video frames directly to the Decklink SDK without copying

If the video frame is stored in PBO memory then we need to copy anyway as
it might be stored in CPU-accessible GPU memory that can't be accessed
from the Decklink driver.

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

22 months agomsdkmjpegdec: Add support for error report
Vincent Cheah Beng Keat [Tue, 10 May 2022 06:11:06 +0000 (14:11 +0800)]
msdkmjpegdec: Add support for error report

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

22 months agoglvideomixer: Only consider property changes a geometry change if there as an actual...
Sebastian Dröge [Tue, 28 Jun 2022 06:38:34 +0000 (09:38 +0300)]
glvideomixer: Only consider property changes a geometry change if there as an actual change

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

22 months agoglvideomixer: Add crop-{left,right,top,bottom} pad properties for cropping inputs
Sebastian Dröge [Mon, 27 Jun 2022 18:28:07 +0000 (21:28 +0300)]
glvideomixer: Add crop-{left,right,top,bottom} pad properties for cropping inputs

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

22 months agonvencoder: Add support for dynamic GPU device selection
Seungha Yang [Wed, 22 Jun 2022 16:10:38 +0000 (01:10 +0900)]
nvencoder: Add support for dynamic GPU device selection

Adding nvautogpu{h264,h265}enc class which will accept upstream logical
GPU device object (GstCudaContext or GstD3D11Device) instead of
using pre-assigned GPU instance.

If upstream logical GPU device object is not NVENC compatible
(e.g., D3D11 device of non-NVIDIA GPU) or it's system memory,
then user specified "cuda-device-id" or "adapter-luid" property
will be used for GPU device selection.

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

22 months agocuda: Protect gst_cuda_ensure_element_context() with lock
Seungha Yang [Mon, 27 Jun 2022 11:50:15 +0000 (20:50 +0900)]
cuda: Protect gst_cuda_ensure_element_context() with lock

Serialize the order of context setup since it can be called
from multiple threads

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

22 months agocuda: Add YUY2 and UYVY formats for GL interop
Seungha Yang [Thu, 30 Jun 2022 07:45:46 +0000 (16:45 +0900)]
cuda: Add YUY2 and UYVY formats for GL interop

Those formats are not supported conversion formats by CUDA convert/scale elements
but would be useful for GL <-> CUDA interop use case.

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

22 months agocudadownload: Passthrough in case of CUDA -> SYSTEM
Seungha Yang [Thu, 30 Jun 2022 08:47:05 +0000 (17:47 +0900)]
cudadownload: Passthrough in case of CUDA -> SYSTEM

GstCudaMemory supports CPU access via CUDA pinned host memory already
and it would show faster memory transfer performance between
GPU and CPU than copying from/to normal system memory.
If downstream supports video meta, we can passthrough CUDA memory.

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

22 months agowebrtcbin: Reject caps that are not valid for creating an SDP media.
Sebastian Dröge [Thu, 30 Jun 2022 06:09:02 +0000 (09:09 +0300)]
webrtcbin: Reject caps that are not valid for creating an SDP media.

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

22 months agosdpmessage: Don't set SDP medias from caps without media/payload/clock-rate fields
Sebastian Dröge [Thu, 30 Jun 2022 06:02:00 +0000 (09:02 +0300)]
sdpmessage: Don't set SDP medias from caps without media/payload/clock-rate fields

Previously it would've silently failed reading the payload/clock-rate
and instead would've used some random value that happened to be on the
stack.

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

22 months agoglupload: Fix caps query with no filter
Jan Schmidt [Thu, 30 Jun 2022 02:50:17 +0000 (12:50 +1000)]
glupload: Fix caps query with no filter

If no filter caps are provided with a caps query, always
generate a full set of all caps from all upload methods,
not just the configured one. This is needed to handle
renegotiation when dealing with raw sysmem caps - as the upload
method might accept raw sysmem caps, but only the raw data
uploader adds those to the caps query.

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

22 months agoRevert "glupload: allow system memory for dmabuf in transform_caps"
Jan Schmidt [Thu, 30 Jun 2022 02:46:31 +0000 (12:46 +1000)]
Revert "glupload: allow system memory for dmabuf in transform_caps"

This reverts commit f3292dc1561a8d62812c3f1a2bb3de5c5bb6a807.

Only the raw data uploader should add sysmem caps to the
actual caps query, because we want them to be at the
lowest priority. If upstream does select to send raw
caps, then the correct upload method will still
be chosen because the accept_caps implementation
will accept them

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

22 months agogl: Don't use the full transform_caps() method for reconfiguration check
Jan Schmidt [Thu, 30 Jun 2022 08:41:01 +0000 (18:41 +1000)]
gl: Don't use the full transform_caps() method for reconfiguration check

When checking if we need to reconfigure when uploading, check
specifically the output caps of the current method will
result in compatible/incompatible caps, not the full set
of output caps from all upload methods.

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

22 months agocudaformat: add support for planar 4:2:2 YUV formats in CUDA D3D11 interop
Corentin Damman [Fri, 22 Apr 2022 14:37:34 +0000 (16:37 +0200)]
cudaformat: add support for planar 4:2:2 YUV formats in CUDA D3D11 interop

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

22 months agocudamemory: add support for planar 4:2:2 YUV formats
Corentin Damman [Fri, 22 Apr 2022 13:58:13 +0000 (15:58 +0200)]
cudamemory: add support for planar 4:2:2 YUV formats

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

22 months agovideo: Include new video-sei.h in video.h
Sebastian Dröge [Thu, 30 Jun 2022 05:42:43 +0000 (08:42 +0300)]
video: Include new video-sei.h in video.h

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

22 months agotracing: add hooks for gst_pad_chain() / gst_pad_chain_list()
Sebastian Dröge [Wed, 29 Jun 2022 05:57:42 +0000 (08:57 +0300)]
tracing: add hooks for gst_pad_chain() / gst_pad_chain_list()

This allows tracing buffers when they arrive in a pad instead of just
when they are pushed out of a pad.

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

22 months agov4l2videodec: replace multiple decoder bug warnings by a single warning
fduncanh [Sat, 28 May 2022 20:47:42 +0000 (16:47 -0400)]
v4l2videodec: replace multiple decoder bug warnings by a single warning
(warning due to incorrectly dropped frames at initial caps adjustment)

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

22 months agov4l2codecs: enumerate all possible formats
Benjamin Gaignard [Tue, 22 Jun 2021 12:43:29 +0000 (14:43 +0200)]
v4l2codecs: enumerate all possible formats

Some decoder may also allow to (down) scale the decoded video.
Use VIDIOC_ENUM_FRAMESIZES iotcl to enumerate the possible output
formats resolutions.

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

22 months agonvcodec: Add cuda-device-id read-only property to stateless decoders
Seungha Yang [Sun, 26 Jun 2022 13:26:29 +0000 (22:26 +0900)]
nvcodec: Add cuda-device-id read-only property to stateless decoders

... and remove unnecessary intermediate subclass from class hierarchy

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

22 months agonvcodec: Add cuda-device-id read-only property to CUVID decoders
Seungha Yang [Sun, 26 Jun 2022 12:09:50 +0000 (21:09 +0900)]
nvcodec: Add cuda-device-id read-only property to CUVID decoders

Similar to the other hardware decoder plugins, provides assigned
device id via property

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

22 months agoadaptivedemux2: Ignore stopped stream flow state
Jan Schmidt [Tue, 28 Jun 2022 14:51:28 +0000 (00:51 +1000)]
adaptivedemux2: Ignore stopped stream flow state

When calculating the combined stream flow state
for a period, don't consider stopped streams.

Fixes switching to the next period in DASH streams
with multiple video/audio/subtitle streams.

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

22 months agoadaptivedemux2: Clean up stream parsebins on finalize
Jan Schmidt [Tue, 28 Jun 2022 15:25:41 +0000 (01:25 +1000)]
adaptivedemux2: Clean up stream parsebins on finalize

Remove the parsebin for a stream from the overall
bin when cleaning up the stream, to avoid
keeping around old ones when moving between periods

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

22 months agoadaptivedemux2: Fix memory leaks and use-after-free
Jan Schmidt [Thu, 23 Jun 2022 16:54:22 +0000 (02:54 +1000)]
adaptivedemux2: Fix memory leaks and use-after-free

Fix various small memory leaks, and an invalid
access to GstEvent after giving away the ref
via gst_pad_push_event()

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

22 months agohlsdemux2: Fix potential segfault
Jan Schmidt [Thu, 23 Jun 2022 16:57:54 +0000 (02:57 +1000)]
hlsdemux2: Fix potential segfault

Fix a potential segfault if we receive a ISO-FF stream
with moof before moov.

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

22 months agohlsdemux2: Fix memory leaks
Jan Schmidt [Thu, 23 Jun 2022 16:57:03 +0000 (02:57 +1000)]
hlsdemux2: Fix memory leaks

Clean up various memory leaks

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

22 months agohlsdemux2: Free current_segment on finalize
Jan Schmidt [Thu, 23 Jun 2022 09:24:03 +0000 (19:24 +1000)]
hlsdemux2: Free current_segment on finalize

Avoid a memory leak by making sure to release the
current segment on exit if non-NULL

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

22 months agocoding style: allow declarations after statement
Tim-Philipp Müller [Wed, 29 Jun 2022 09:55:13 +0000 (10:55 +0100)]
coding style: allow declarations after statement

See https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1243/
and https://gitlab.freedesktop.org/gstreamer/gstreamer-project/-/issues/78

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

22 months agod3d11convert: Add support for GstVideoCropMeta
Seungha Yang [Tue, 28 Jun 2022 15:31:01 +0000 (00:31 +0900)]
d3d11convert: Add support for GstVideoCropMeta

Performs crop, scale, and color space conversion all in
a single render pipeline. Note that cropping related property is not
added in this element (which will make negotiation very complicated),
but user can configure videocrop element for crop meta to be attached
on each buffer.

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

22 months agod3d11videosink: Fix for force-aspect-ratio setting when rendering on shared texture
Seungha Yang [Tue, 28 Jun 2022 08:40:56 +0000 (17:40 +0900)]
d3d11videosink: Fix for force-aspect-ratio setting when rendering on shared texture

Set specified force-aspect-ratio value on window object
in case of shared texture rendering as well

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

22 months agomfvideoenc: Fix broken encoding when resolution is not an even number
Seungha Yang [Sat, 25 Jun 2022 21:39:54 +0000 (06:39 +0900)]
mfvideoenc: Fix broken encoding when resolution is not an even number

Width and height values of 4:2:0 subsampled YUV format should be even number,
and if it's not the case, there should be padding which is not a contiguous memory layout.
Do copy input frames to MediaFoundation's memory in that case for now.

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

22 months agovideorate: remove property-value quotes
James Hilliard [Thu, 16 Jun 2022 10:19:17 +0000 (10:19 +0000)]
videorate: remove property-value quotes

Fixes warnings like:
Received a structure string that contains '="0.5"'. Reading as a gdouble value, rather than a string value. This is undesired behaviour, and with GStreamer 1.22  onward, this will be interpreted as a string value instead because it is wrapped in '"' quotes. If you want to guarantee this value is read as a string, before this change, use '=(string)"0.5"' instead. If you want to read in a gdouble value, leave its value unquoted.

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

22 months agoadaptivedemux2: track: Fix buffering time calc before output
Jan Schmidt [Tue, 21 Jun 2022 17:35:03 +0000 (03:35 +1000)]
adaptivedemux2: track: Fix buffering time calc before output

Use the lowest track input time as the output
time when calculating track buffering levels
before anything has been dequeued.

Fixes multi-period DASH not advancing to the
next period in some cases.

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

22 months agoadaptivedemux2: track: Add period number to most debug statements
Jan Schmidt [Tue, 21 Jun 2022 17:34:19 +0000 (03:34 +1000)]
adaptivedemux2: track: Add period number to most debug statements

Store the period number the track belongs to, and
add it in various debug statements

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

22 months agoadaptivedemux2: stream: Don't take TRACKS_LOCK when sending EOS event
Jan Schmidt [Tue, 21 Jun 2022 17:30:16 +0000 (03:30 +1000)]
adaptivedemux2: stream: Don't take TRACKS_LOCK when sending EOS event

The stream tracks list can't change while we're
iterating it from the scheduling thread,
and the event handler immediately takes the
tracks lock, causing a deadlock.

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

22 months agohlsdemux2: Improve media playlist updates
Edward Hervey [Wed, 8 Jun 2022 09:17:09 +0000 (11:17 +0200)]
hlsdemux2: Improve media playlist updates

* When dealing with rendition streams, we attempt to synchronize the media
  playlist against the variant stream. This helps with speeding up the correct
  initial fragment search and avoids issues when streams at activated at a much
  later time.
* Also add checks for variant stream existence before attempting to use them

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

22 months agohlsdemux2: Only seek on selected streams
Edward Hervey [Wed, 8 Jun 2022 09:16:15 +0000 (11:16 +0200)]
hlsdemux2: Only seek on selected streams

When handling seeks, there is no need to seek on unselected streams. If they
later get activated they will be properly seek onto

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

22 months agotests: check: Update hlsdemux2 tests for playlist changes
Edward Hervey [Wed, 8 Jun 2022 07:33:22 +0000 (09:33 +0200)]
tests: check: Update hlsdemux2 tests for playlist changes

We no longer do auto-magic fallbacks when synchronizing a disconnected
playlist. It is handled at a higher level.

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

22 months agohlsdemux2: Fix debug return statement
Edward Hervey [Fri, 3 Jun 2022 08:25:34 +0000 (10:25 +0200)]
hlsdemux2: Fix debug return statement

Due to latest commits res could have been NULL.

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

22 months agohlsdemux2: No longer re-add segments from before the playlist
Edward Hervey [Thu, 2 Jun 2022 07:46:22 +0000 (09:46 +0200)]
hlsdemux2: No longer re-add segments from before the playlist

When updating playlists, there is a possibility that the playlists don't
perfectly align, but the last entry of the previous playlist is *just* before
the first entry of the new playlist.

In those cases, we still can transfer the timing information from one playlist
to another, but we do not want to return that segment as being the matching one.

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

22 months agohlsdemux2: Use variant stream as support for synchronizing playlists
Edward Hervey [Wed, 1 Jun 2022 13:45:23 +0000 (15:45 +0200)]
hlsdemux2: Use variant stream as support for synchronizing playlists

When matching playlists, there is a possibility that rendition streams will not
have been updated in time (for example because that stream started later, or
playback was paused). This would cause several playback failures and seeking
failures.

In order to still fall back on our feet, attempt to synchronize that rendition
playlist against the current variant playlist. This will attempt to match the
stream time using SN/DNS/PDT/...

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

22 months agohlsdemux2: Detect synchronization loss
Edward Hervey [Mon, 23 May 2022 13:51:23 +0000 (15:51 +0200)]
hlsdemux2: Detect synchronization loss

If we have been updating too slowly and have gone out of the current live
window, inform the baseclass accordingly.

This is different from the case where we have been updating quicker than what
the server provides.

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

22 months agohlsdemux2: More improvement/fixes to position tracking
Edward Hervey [Mon, 23 May 2022 13:48:16 +0000 (15:48 +0200)]
hlsdemux2: More improvement/fixes to position tracking

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

22 months agoadaptivedemux2: Handle loss of synchronization
Edward Hervey [Mon, 23 May 2022 13:43:04 +0000 (15:43 +0200)]
adaptivedemux2: Handle loss of synchronization

Add a new custom GstFlowReturn so that subclasses can notify that they have lost
live synchronization.

When that happens, do a flushing seek back to the live position

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

22 months agoadaptivedemux2: Fix SNAP seek handling
Edward Hervey [Mon, 23 May 2022 07:11:24 +0000 (09:11 +0200)]
adaptivedemux2: Fix SNAP seek handling

* Since only flushing seeks are allowed, the "current" position is always the
  global output position (and not "some" stream current position).

* In terms of figuring out to which stream to "snap" to, we can send it to any
  selected stream. Removes the requirement of this function to a specific output
  pad.

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

22 months agohlsdemux2: Fix position tracking
Edward Hervey [Tue, 17 May 2022 05:16:48 +0000 (07:16 +0200)]
hlsdemux2: Fix position tracking

Remove the "pending advance" hack and instead rely on the base stream current
position to track our position (instead of a potentially NULL "current
segment").

Also ensure the media playlists are always refreshed with valid stream time,
even if there is no current segment.

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

22 months agohlsdemux2: Add a new method to synchronize two media playlist
Edward Hervey [Tue, 17 May 2022 05:11:17 +0000 (07:11 +0200)]
hlsdemux2: Add a new method to synchronize two media playlist

This allows transfering the stream time of the playlist to an updated
variant/rendition.

This allows updating that information without having a "current segment"

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

22 months agoadaptivedemux2: Initialize and use stream start/current position
Edward Hervey [Tue, 17 May 2022 05:07:23 +0000 (07:07 +0200)]
adaptivedemux2: Initialize and use stream start/current position

The stream start and current position would be properly set when seeking or
activating a stream after playback started. But it would never be properly
initialized.

Set it to NONE initially to indicate to subclasses that no position has been
tracked yet. This will allow them to detect initial stream usage.

Futhermore, once the initial streams setup is done, make sure that it is set to
a valid initial value:
* The minimum stream time in live
* Or else the period start

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

22 months agov4l2videodec: Fix activation of internal pool
Nicolas Dufresne [Thu, 19 May 2022 19:51:03 +0000 (15:51 -0400)]
v4l2videodec: Fix activation of internal pool

If the driver does not support VIDIOC_CREATE_BUFS ioctl, the pool
configuration may get changed, which requires a validation. This would
fail to activate a pool in a case it shouldn't normally fail unless we
are out of memory.

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

22 months agodv, opusparse: fix duplicate symbols in static build
Tim-Philipp Müller [Tue, 28 Jun 2022 00:29:06 +0000 (01:29 +0100)]
dv, opusparse: fix duplicate symbols in static build

Fixes https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/issues/1262

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

22 months agod3d11: Enumerate devices via native DXGI API
Seungha Yang [Sun, 26 Jun 2022 19:07:04 +0000 (04:07 +0900)]
d3d11: Enumerate devices via native DXGI API

D3D11CreateDevice() can fail for some reason (e.g., buggy GPU driver)
and then gst_d3d11_device_new() will return nullptr.
Use DXGI API directly instead of relying on the gst_d3d11_device_new()

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

22 months agoexamples: Add an example for application texture sharing
Seungha Yang [Fri, 24 Jun 2022 16:15:17 +0000 (01:15 +0900)]
examples: Add an example for application texture sharing

This example shows GstD3D11BufferPool usage and a way of
D3D11 texture sharing between application and GStreamer via appsrc.

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

22 months agoexamples: Add d3d11decoder zero-copy rendering example
Seungha Yang [Thu, 23 Jun 2022 22:06:00 +0000 (07:06 +0900)]
examples: Add d3d11decoder zero-copy rendering example

This example code demonstrates D3D11 device sharing between
application and GStreamer. Application can access texture
using appsink and it can be rendered on application's window without
any copy operation.

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

22 months agod3d11: Add a helper method for GstContext creation
Seungha Yang [Fri, 24 Jun 2022 13:17:28 +0000 (22:17 +0900)]
d3d11: Add a helper method for GstContext creation

Add gst_d3d11_context_new() method for application to create
GstContext using GstD3D11Device.

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

22 months agod3d11memory: Add support for wrapping application texture
Seungha Yang [Thu, 23 Jun 2022 16:00:00 +0000 (01:00 +0900)]
d3d11memory: Add support for wrapping application texture

Add gst_d3d11_allocator_alloc_wrapped() method to support wrapping
application texture using GstD3D11Memory without copy.

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

22 months agod3d11: Install library headers
Seungha Yang [Thu, 23 Jun 2022 16:25:07 +0000 (01:25 +0900)]
d3d11: Install library headers

Our Direct3D11 abstraction layer has been improved and
it gained good shape from API point of view.
Also, On Windows, GstD3D11 has various advantages over GstGL
in terms of compatibility/stability/feature/performance.
Note that WGL implementation is known to be buggy for some
drivers/vendors/scenario (that's a reason why Google implemented ANGLE).
Moreover, GstGL is not fully optimized for Windows unfortunately.

It's the time to open this interface to application developers
for various optimized processing using our Direct3D11
infrastructure.

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

22 months agod3d11: Update gst_d3d11_allocation_params_new() interface
Seungha Yang [Thu, 23 Jun 2022 16:21:48 +0000 (01:21 +0900)]
d3d11: Update gst_d3d11_allocation_params_new() interface

Define GST_D3D11_ALLOCATION_FLAG_DEFAULT (0) value instead of
casting enum type everywhere. And pass D3D11_RESOURCE_MISC_FLAG value

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

22 months agova: postproc: add scale-method property
U. Artie Eoff [Mon, 27 Jun 2022 16:06:50 +0000 (12:06 -0400)]
va: postproc: add scale-method property

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

22 months agova: filter/postproc: move unconditional props to vavpp
U. Artie Eoff [Mon, 27 Jun 2022 15:54:28 +0000 (11:54 -0400)]
va: filter/postproc: move unconditional props to vavpp

Only conditional/dynamic properties should be installed/handled
by vafilter.  Thus, move and install the unconditional/static
properties in vavpp.

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

22 months agova: compositor/filter: use scale method setter
U. Artie Eoff [Thu, 23 Jun 2022 15:39:57 +0000 (11:39 -0400)]
va: compositor/filter: use scale method setter

Use the filter's scale method member instead of the sample's member.

Removes the filter_flags member from the composite sample.

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

22 months agova: filter: add scale method field and setter
U. Artie Eoff [Thu, 23 Jun 2022 15:11:16 +0000 (11:11 -0400)]
va: filter: add scale method field and setter

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

22 months agova: Add vajpegdec element.
Víctor Manuel Jáquez Leal [Fri, 21 Jan 2022 20:33:52 +0000 (21:33 +0100)]
va: Add vajpegdec element.

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

22 months agova: allocator: Add hack for no fourcc when surface creation.
Víctor Manuel Jáquez Leal [Fri, 24 Jun 2022 17:42:36 +0000 (19:42 +0200)]
va: allocator: Add hack for no fourcc when surface creation.

This patch adds general mechanism for handling specific hacks. In this
case for jpeg decoder in i965 driver, which cannot create surfaces
with fourcc specified.

From jpeg decoder to the allocator, which creates the surfaces,
there's a non-simple path: basedec pseudo-class adds a hacks guint32
which will be set by actual elements (vajpegdec, in this case) and
basedec will always set the hack to the allocator when the allocator
is instantiated.

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

22 months agova: Add RGBP format definition.
Víctor Manuel Jáquez Leal [Fri, 24 Jun 2022 17:54:51 +0000 (19:54 +0200)]
va: Add RGBP format definition.

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

22 months agova: caps: Add jpeg fields in coded caps.
Víctor Manuel Jáquez Leal [Thu, 28 Apr 2022 11:16:03 +0000 (13:16 +0200)]
va: caps: Add jpeg fields in coded caps.

Given the supported rt formats in a profile/entrypoint config it's
possible to know the supported JPEG colorspace and subsampling. This
patch adds this information in coded caps to a safer autoplugging
after jpegparser.

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

22 months agova: Add jpegdecoder base class.
Víctor Manuel Jáquez Leal [Mon, 17 Jan 2022 14:43:47 +0000 (15:43 +0100)]
va: Add jpegdecoder base class.

This base class is intented for hardware accelerated decoders, but since
only VA uses it, it will be kept internally in va plugin.

It follows the same logic as the others video decoders in the library but.
as JPEG are independet images, there's no need to handle a DBP so no need
of a picture object. Instead a scan object is added with all the structures
required to decode the image (huffman and quant tables, mcus, etc.).

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

22 months agova: build: Remove duplicated source.
Víctor Manuel Jáquez Leal [Mon, 27 Jun 2022 10:36:29 +0000 (12:36 +0200)]
va: build: Remove duplicated source.

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

22 months agocudamemorycopy: Make sure writable caps before removing fields
Seungha Yang [Mon, 27 Jun 2022 10:58:58 +0000 (19:58 +0900)]
cudamemorycopy: Make sure writable caps before removing fields

The caps to be modified may not be writable when D3D11/GL/NVMM
are all disabled.

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

22 months agotests: skip unit tests for dependency-less elements that have been disabled
Tim-Philipp Müller [Sat, 25 Jun 2022 18:50:10 +0000 (19:50 +0100)]
tests: skip unit tests for dependency-less elements that have been disabled

Fixes https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/issues/1136

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

23 months agoexamples: don't try and build jack examples if jack was disabled
Tim-Philipp Müller [Fri, 24 Jun 2022 11:10:02 +0000 (12:10 +0100)]
examples: don't try and build jack examples if jack was disabled

Fixes meson build ERROR: Unknown variable "libjack_dep".

Fixes #1301

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

23 months agova: allocator: Use always lseek to get dmabuf size.
Víctor Manuel Jáquez Leal [Thu, 23 Jun 2022 12:31:10 +0000 (14:31 +0200)]
va: allocator: Use always lseek to get dmabuf size.

Gallium drivers historically have reported strange dmabuf sizes, from always
zero to the whole frame (multiple fds). The simplest solution is to use lseek
SEEK_END to get the prime descriptor size.

Also the allocator raises a warning if both values differ in order to report
it to driver.

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

23 months agova: allocator: Fix translation of VADRMPRIMESurfaceDescriptor
Nicolas Dufresne [Wed, 8 Jun 2022 13:02:52 +0000 (09:02 -0400)]
va: allocator: Fix translation of VADRMPRIMESurfaceDescriptor

VADRMPRIMESurfaceDescriptor structure describes the offsets from the
point of view of the specific handle (DMABuf). While GstVideoInfo
(and the meta) describes offsets from the point of the view of the
GstBuffer, an aggregate of all the GstMemory (1 per handle).

This changes combined with [Mesa Fix](https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16813)
fixes decoding failure with AMD driver.

Fixes #1223

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

23 months agod3d11: Revert staging buffer pool implementation
Seungha Yang [Thu, 23 Jun 2022 12:43:11 +0000 (21:43 +0900)]
d3d11: Revert staging buffer pool implementation

The staging buffer pool implementation was added to improve
throughput performance since we can avoid per-frame
CPU copy operation via staging texture but it turned out that
we can not make it thread safe. See
https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/1182

Reverting the staging texture implementation as it does not show
any visible value.

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

23 months agoqsvdecoder: Fix system memory alignment
Seungha Yang [Thu, 23 Jun 2022 12:35:23 +0000 (21:35 +0900)]
qsvdecoder: Fix system memory alignment

Do right padding, not left

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

23 months agod3d11decoder: Fix texture download
Seungha Yang [Thu, 23 Jun 2022 12:41:24 +0000 (21:41 +0900)]
d3d11decoder: Fix texture download

Stride applied to src/dst was reversed

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

23 months agojpegparse: Add YUV440 sampling support.
Víctor Manuel Jáquez Leal [Thu, 16 Jun 2022 15:02:43 +0000 (17:02 +0200)]
jpegparse: Add YUV440 sampling support.

Found some samples with this sampling, so in order to support it,
JPEG2000 header cannot be used anymore, a this patch also adds the
enums for each supported colorspace and sampling, avoiding hacks.

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

23 months agogst: add missing define guard
Jonas Danielsson [Wed, 22 Jun 2022 07:43:02 +0000 (09:43 +0200)]
gst: add missing define guard

If compiled with -Dgstreamer:gst_debug=false and we have
GST_REMOVE_DISABLED defined we will get the following compiler error:

```
[...]/libgstreamer-1.0.so.0.2100.0.p/gst.c.o: in function `gst_deinit':
[...]/gst/gst.c:1258: undefined reference to `_priv_gst_debug_cleanup'
[...] hidden symbol `_priv_gst_debug_cleanup' isn't defined
```

Add the missing define guard to avoid this.

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

23 months agova: Use driver implementation macro rather than function.
Víctor Manuel Jáquez Leal [Thu, 16 Jun 2022 14:33:14 +0000 (16:33 +0200)]
va: Use driver implementation macro rather than function.

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

23 months agobin: Fix race conditions in tests
Sebastian Dröge [Tue, 21 Jun 2022 08:51:35 +0000 (11:51 +0300)]
bin: Fix race conditions in tests

The latency messages are non-deterministic and can arrive before/after
async-done or during state-changes as they are posted by e.g. sinks from
their streaming thread but bins are finishing asynchronous state changes
from a secondary helper thread.

To solve this, expect latency messages at any time and assert that we
receive one at some point during the test.

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

23 months agoh265parse: Fix uninitialized width and height when update src caps.
He Junyan [Sat, 18 Jun 2022 02:36:53 +0000 (10:36 +0800)]
h265parse: Fix uninitialized width and height when update src caps.

The commit b90d0274 introduces uninitialized width and height when we
consider to change the "pixel-aspect-ratio" for some interlaced stream.
We need to check the resolution in the src caps, and if no resolution
info found, there is no need to consider the aspect ratio.

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

23 months agod3d11: Fix some typos
Seungha Yang [Tue, 21 Jun 2022 11:04:15 +0000 (20:04 +0900)]
d3d11: Fix some typos

Fix up spelling and d3d11testsrc class meta.

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

23 months agoelement: Fix requesting of pads with string templates
Sebastian Dröge [Mon, 20 Jun 2022 13:45:19 +0000 (16:45 +0300)]
element: Fix requesting of pads with string templates

Previously it was only possible to request them with the exact template
name, e.g. 'src_%s', but not with "instantiated" names that would match
this template, e.g.'src_foo_bar'.

This is now possible and a test was added for this, in addition to
fixing a previously invalid test.

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

23 months agod3d11compositor: Performance optimization
Seungha Yang [Sat, 18 Jun 2022 11:14:22 +0000 (20:14 +0900)]
d3d11compositor: Performance optimization

Removing glvideomixer-like nuance (it was initially referenced)
and rewriting element since it's not an optimal design at all
from performance point of view.

* Remove wrapper bin (and internal conversion/upload/download elements)
  which will waste CPU/GPU resources. Conversion/blending can be done by the
  d3d11compositor element at once.
* Add support YUV blending without RGB conversion.
  The RGB <-> YUV conversion is completely unnecessary since YUV textures
  support blending as well.
* Remove complicated blending operation properties since it's hard
  to use from application point of view. Instead, adding "operator" property
  like what compositor element does.

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

23 months agod3d11converter: Fix alpha factor update
Seungha Yang [Sat, 18 Jun 2022 11:40:40 +0000 (20:40 +0900)]
d3d11converter: Fix alpha factor update

converter should set entire constant buffer values since it's mapped
with write-discard flag

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

23 months agogstwaylandsink: Add rotate-method property
Robert Mader [Thu, 2 Jun 2022 12:22:21 +0000 (14:22 +0200)]
gstwaylandsink: Add rotate-method property

Similar to and inspired by glimagesink and gtkglsink.

Using the Wayland buffer transform API allows to offload
rotate operations to the Wayland compositor. This can have
several advantages:
 - The Wayland compositor may be able to use hardware plane
   capabilities to do the rotation.
 - In case of pre-rotated content on rotated outputs the
   rotations may equal out, potentially allowing the
   compositor to use hardware planes even if they don't
   support rotate operations.

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

23 months agoAdd GstMemoryMapInfo to be used with g_auto()
Xavier Claessens [Tue, 17 May 2022 17:18:28 +0000 (10:18 -0700)]
Add GstMemoryMapInfo to be used with g_auto()

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

23 months agoGstVideoFrame: Add g_auto() support
Xavier Claessens [Fri, 13 May 2022 16:57:06 +0000 (12:57 -0400)]
GstVideoFrame: Add g_auto() support

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

23 months agoAdd GstBufferMapInfo to be used with g_auto()
Xavier Claessens [Fri, 13 May 2022 15:51:09 +0000 (11:51 -0400)]
Add GstBufferMapInfo to be used with g_auto()

We need a separate typedef for this feature because GstMapInfo itself
can be initialized by gst_memory_map() in which case info.memory should
not be unreffed.

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

23 months agogst-inspect: Fix inspection of third-party plugins
Philippe Normand [Mon, 20 Jun 2022 14:29:21 +0000 (15:29 +0100)]
gst-inspect: Fix inspection of third-party plugins

Since commit de57657de1d1916503b4ad451ac13a3e191465f8 inspecting a third-party
plugin would trigger a segfault (Address boundary error) due to the missing
sentinel in the list of GStreamer modules.

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

23 months agod3d11decoder: Check 16K resolution support
Seungha Yang [Fri, 17 Jun 2022 19:05:53 +0000 (04:05 +0900)]
d3d11decoder: Check 16K resolution support

16K decoding is supported by some GPUs

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

23 months agoges/gstframepositioner: don't create one compositor per frame meta
Mathieu Duponchelle [Thu, 16 Jun 2022 20:40:21 +0000 (22:40 +0200)]
ges/gstframepositioner: don't create one compositor per frame meta

Instead, cache the looked up operator property

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

23 months agod3d11decoder: Add support for non-zero crop-{x,y} position
Seungha Yang [Thu, 16 Jun 2022 20:11:08 +0000 (05:11 +0900)]
d3d11decoder: Add support for non-zero crop-{x,y} position

AVC and HEVC define crop rectangle and the x/y coordinates might
not be zero. This commit will address the non-zero x/y offset coordinates
via GstVideoCropMeta if downstream supports the meta and d3d11 memory.
Otherwise decoder will copy decoded texture into output frame.

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

23 months agod3d11converter: Implement filling border color
Seungha Yang [Thu, 16 Jun 2022 17:45:51 +0000 (02:45 +0900)]
d3d11converter: Implement filling border color

Equivalent to GST_VIDEO_CONVERTER_OPT_BORDER_ARGB and
GST_VIDEO_CONVERTER_OPT_FILL_BORDER options of GstVideoConverter

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

23 months agod3d11converter: Objectify converter
Seungha Yang [Wed, 15 Jun 2022 17:18:43 +0000 (02:18 +0900)]
d3d11converter: Objectify converter

... and set conversion options via property

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

23 months agod3d11shader: Remove GstD3D11Quad helper object
Seungha Yang [Wed, 15 Jun 2022 15:52:16 +0000 (00:52 +0900)]
d3d11shader: Remove GstD3D11Quad helper object

It's not very generic to be used for various scenario. Use native D3D11
APIs directly instead.

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

23 months agod3d11compositor: Don't use GstD3D11Quad
Seungha Yang [Wed, 15 Jun 2022 15:50:12 +0000 (00:50 +0900)]
d3d11compositor: Don't use GstD3D11Quad

The helper object will be removed

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

23 months agod3d11overlaycompositor: Fix HLSL compiler warning
Seungha Yang [Wed, 15 Jun 2022 14:46:27 +0000 (23:46 +0900)]
d3d11overlaycompositor: Fix HLSL compiler warning

warning X3206: 'Sample': implicit truncation of vector type

And don't use GstD3D11Quad since it will result in redundant API calls

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

23 months agocccombiner: expose output-padding property
Mathieu Duponchelle [Tue, 1 Feb 2022 22:46:43 +0000 (23:46 +0100)]
cccombiner: expose output-padding property

When schedule=true and output-padding=false, cccombiner will not
inject padding in the output closed caption meta stream.

The property has no effect when schedule=false.

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