Commit graph

466 commits

Author SHA1 Message Date
Víctor Manuel Jáquez Leal 83e73a2f59 vulkan: find memory type index with requirements
The specification says:

VUID-vkAllocateMemory-pAllocateInfo-01713

must pAllocateInfo->allocationSize be less than or equal to
VkPhysicalDeviceMemoryProperties::memoryHeaps[memindex].size where memindex =
VkPhysicalDeviceMemoryProperties::memoryTypes[pAllocateInfo->memoryTypeIndex].heapIndex
as returned by vkGetPhysicalDeviceMemoryProperties for the VkPhysicalDevice that
device was created from.

Though this can be catch by the validation layer, the requested frame size
depends on the use case so it's better to check this restriction by our code.

This patch also makes use of this new function to find memory type index,
 and removes the unused function to find memory type index, which, as GstVulkan is
considered unstable, we can do it.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4351>
2023-05-19 04:26:29 +00:00
Víctor Manuel Jáquez Leal 4dd0fd6797 vkimagebufferpool: use gst_vulkan_format_from_video_info_2()
To get the number of images and its Vulkan formats for the GStreamer format.
Also it gets the basic image usage by default if it's not defined. It fails if the
video format is not supported.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4351>
2023-05-19 04:26:29 +00:00
Víctor Manuel Jáquez Leal 35dbd9f92c vkformat: add gst_vulkan_format_from_video_info_2()
The purpose of this function is to get more info about the mapped Vulkan format
from the GStreamer format, since they can be multiple Vulkan formats for one
GStreamer format.

Also a Vulkan format may have certain usage and aspects that must be verified.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4351>
2023-05-19 04:26:29 +00:00
Víctor Manuel Jáquez Leal 14dd6aac16 vkformat: move gst_vulkan_format_from_video_info()
Moved gst_vulkan_format_from_video_info() from gstvkimagememory to gstvkformat
in order to centralize the video format operations in a single source file.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4351>
2023-05-19 04:26:29 +00:00
Víctor Manuel Jáquez Leal b1c166b53c vkimagebufferpool: pass usage and memory properties
Pass, in config structure, usage and memory properties, assigning proper
defaults if they aren't set. This parameters are used in image memory
allocation.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4351>
2023-05-19 04:26:29 +00:00
Víctor Manuel Jáquez Leal 7b62c26139 vkdevice: add gst_vulkan_device_queue_family_indices()
This method will return a GArray with all the queue family indices created by
the device when it's opened. This array will be used by VkImageCreateInfo to
allocate a new Vulkan image.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4351>
2023-05-19 04:26:29 +00:00
Víctor Manuel Jáquez Leal ea2bd1882f vkdevice: add programming parameters verification
To `gst_vulkan_device_foreach_queue()`.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4351>
2023-05-19 04:26:29 +00:00
Víctor Manuel Jáquez Leal 1e2ff519c6 vkbuffermemory: add gst_vulkan_buffer_memory_alloc_with_buffer_info()
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4351>
2023-05-19 04:26:29 +00:00
Víctor Manuel Jáquez Leal 64ba7fb2eb vkimagememory: gst_vulkan_image_memory_alloc_with_image_info()
This new method instead of passing a bunch of variables which will fill
`VkImageCreateInfo`, the method accepts this whole structure, so the caller can
customize it as much as they want.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4351>
2023-05-19 04:26:29 +00:00
Víctor Manuel Jáquez Leal 5f5249cf73 vkimagememory: look up for Vulkan format using a static table
Replace the switch structure with explicit and extendable static table.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4351>
2023-05-19 04:26:29 +00:00
Víctor Manuel Jáquez Leal 1458c31031 vkdevice: enable multiple queues per device
Originally the opened device only created one queue of one family queue, to say
graphics one. This approach felt short when other queue family is required not
shared with the graphics queue family, for example video decoding.

This new approach proposes to create those queues with supported families. For
now, only video decoding and encoder are created, if they are available.

In order to hold multiple queues opened, an array of VkDeviceQueueCreateInfo is
held along the live the device object, because it's used to traverse or get the
opened queues.

The algorithm to choose which queues create (or open) is to look for the queue
with more family bits, which also supports the one we are requesting, thus
minimizing the number of global queues of a certain family to create.
Nonetheless, the number of queues to open per family is set to be all of them,
widening the possibility of parallelism.

Also, this commit do a cosmetic refactor the assigning the physical device
nearer where it's used.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4351>
2023-05-19 04:26:29 +00:00
Víctor Manuel Jáquez Leal 25140499fc vkdevice: enable features from physical device
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4351>
2023-05-19 04:26:29 +00:00
Víctor Manuel Jáquez Leal 9e807b58a0 vkphysicaldevice: add gst_vulkan_physical_device_get_features()
gst_vulkan_physical_device_get_features() is a private function to access to the
available features in the device.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4351>
2023-05-19 04:26:28 +00:00
Víctor Manuel Jáquez Leal 83160fb47c vkphysicaldevice: fetch queue family video codec operations
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4351>
2023-05-19 04:26:28 +00:00
Víctor Manuel Jáquez Leal dde60fab37 vkdebug: add video queue flags strings
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4351>
2023-05-19 04:26:28 +00:00
Víctor Manuel Jáquez Leal d03df074f7 vulkan: detect vulkan video extensions
Also adds a meson option to enable them.

The symbol GST_VULKAN_HAVE_VIDEO_EXTENSIONS is an alias of
defined(VK_VERSION_1_4) || (defined(VK_VERSION_1_3) && VK_HEADER_VERSION >= 238
if the option is allowed.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4351>
2023-05-19 04:26:28 +00:00
Haihua Hu 78d9d8478d gstplay: fix critical log when enable playbin3
when play rtsp stream with playbin3 enabled, there are some critical logs:

g_object_get_is_valid_property: object class 'GstPlayBin3' has no property named 'n-video'
g_object_get_is_valid_property: object class 'GstPlayBin3' has no property named 'n-audio'
g_object_get_is_valid_property: object class 'GstPlayBin3' has no property named 'n-text'

self->collection could be NULL when READY->PAUSED if the pipeline
is live, then it will fallback to query playbin2's property,
we can call gst_play_streams_info_create_from_collection
directly, it will check self->collection internal.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4460>
2023-05-18 10:27:29 +00:00
Seungha Yang e9d8bf7532 h264parser: Define level enum values
... and stop duplicating it

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4595>
2023-05-17 21:29:25 +00:00
Elliot Chen f722d9c428 gstplay: avoid getting property of playbin2 if subtitle_sid is null
There is a probability of getting "current-text" property
 when play with playbin3, and this property is available
 only in playbin2.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4106>
2023-05-17 15:24:29 +08:00
Piotr Brzeziński f60c87769f macos: Remove old NSApp workaround related code
This is no longer needed since the introduction of `gst_macos_main()` in 1.22.
Before that existed, we had a patch for GLib in Cerbero, which did work but made it
impossible to update GLib at all. The code being removed was a fail-safe in case of
running without said patch being applied. It's no longer needed, since for macOS
we just wrap our GStreamer with an NSApplication using `gst_macos_main()`.

Warnings will be displayed if no NSApp/NSRunLoop is found wherever needed,
pointing the user towards using the new API.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4366>
2023-05-11 20:30:19 +02:00
Seungha Yang 74b7493fd3 h264decoder: Drop nonexisting picture silently without error
If end_picture() was not successful, we do drop corresponding
GstVideoCodecFrame and therefore gst_video_decoder_get_frame()
will return nullptr which is expected behavior.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4561>
2023-05-09 17:02:48 +00:00
Matthew Waters 8ca6547f49 webrtc/nice: support consent-freshness RFC7675
As is supported by libwebrtc already.  This allows ICE components to
transition to failed if consent to send from the peer is revoked or if
multiple consent packets are lost.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4542>
2023-05-08 13:50:44 +00:00
Seungha Yang 7b6f7e6e36 d3d11memory: Don't clear wrapped texture memory
The external texture may hold already rendered scene and therefore
it should not be cleared in alloc method

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4554>
2023-05-05 13:18:06 +00:00
Víctor Manuel Jáquez Leal 6258914b1d vkdebug: fix type compilation warning
Since VkMemoryHeapFlagBits is an enum, while VkMemoryHeapFlags is the expected
alias of VkFlags.

This issue is spotted by warning of gcc 13.1.1

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4547>
2023-05-05 10:05:40 +00:00
Philippe Normand d9c853f165 dtlstransport: Keep strong ref of dtls encoder/decoder
Otherwise get_property() calls for the client, certificate and/or
remote-certificate properties might access moved objects, since the encoder and
decoder are added to the transportsendbin.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4519>
2023-05-02 03:54:53 +00:00
Nirbheek Chauhan 479f0175b5 meson: Add feature options for optional va deps libdrm and gudev
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4428>
2023-04-28 15:22:31 +05:30
Nirbheek Chauhan 55ee0635d3 meson: Fix libdrm and vaapi configure checks
We do not need fallback: for libdrm checks because the wrap file
already has a [provide] section.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4428>
2023-04-28 15:21:10 +05:30
Víctor Manuel Jáquez Leal 3a09e700e6 vkswapper: missing image barrier after vkCmdClearColorImage
After clear color image command the swapper image needs to add a barrier before
copying the buffer to display on it. Otherwise a potential synchronization
problem might occur.

Fixes #2403

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4501>
2023-04-28 00:59:57 +00:00
Víctor Manuel Jáquez Leal f12e052e54 vulkan: use VK_QUEUE_FAMILY_IGNORED in barriers
Instead of using the valid queue family 0 (zero) if there aren't queue transfers
there's no need to specify a not validated queue family, but just
VK_QUEUE_FAMILY_IGNORED.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4501>
2023-04-28 00:59:57 +00:00
Seungha Yang 4ed3c46de7 cudamemory: Fix for semi planar YUV memory size decision
UV plan of the semi planar format requires only half of Y plane size

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4502>
2023-04-27 20:55:53 +00:00
Thibault Saunier 6e305a471f meson: Add CameraBin and Va girs
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4479>
2023-04-25 02:57:55 +00:00
Martin Nordholts 2fed3bf6c4 webrtc: Plug leaks of resolved ICE addresses
The addresses we get from `resolve_host_finish()` (via
`resolve_host_async()`, `resolve_host_main_cb()`, `on_resolve_host()`,
`g_resolver_lookup_by_name_finish()`) must be freed. Otherwise we leak
memory.

Leak found and confirmed fixed with GCC AddressSanitizer.

Change-Id: If32d24452d626234f01b253b77a7d6d16eac1cee
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4469>
2023-04-24 06:23:30 +00:00
Thibault Saunier b14e675a27 gir: Checkout all .gir files and check that they are updated on the CI
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3010>
2023-04-22 09:32:32 -04:00
Seungha Yang c7c380abb1 d3d11memory: Remove redundant bind flag validation
It has been validated outside of each function already

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4455>
2023-04-20 18:05:27 +00:00
Seungha Yang bb5c151336 h264decoder: Enable low-latency bumping in case of pic_order_cnt_type 2
In case of POC type 2, output order is equal to decoding order
(no frame reordering)

Fixes: https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/2447
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4357>
2023-04-10 13:42:31 +00:00
Seungha Yang 73daa0e0ad h264decoder: Fix for latency report
The minimum latency answered by an element should be the maximum
latency from the element's perspective. Also consider max_reorder_frames
update as a sequence change

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4357>
2023-04-10 13:42:31 +00:00
Seungha Yang e0c2578f73 h264decoder: Ignore invalid max_num_reorder_frames in VUI
It's not fatal and can be ignored

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4357>
2023-04-10 13:42:31 +00:00
Seungha Yang f439481d8e h265decoder: Fix for latency report when src caps is not configured
Depending on subclass, negotiation might not happen on new_sequence()

Fixing regression introduced by the commit
4a4823b972

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4357>
2023-04-10 13:42:31 +00:00
Seungha Yang 560fd4834c h264decoder: Fix for latency report when src caps is not configured
Depending on subclass, negotiation might not happen on new_sequence()

Fixing regression introduced by the commit
4a4823b972

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4357>
2023-04-10 13:42:31 +00:00
Sebastian Dröge b90c0bd79b vulkan: Use new GLib APIs as suggested by comments
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4349>
2023-04-06 00:26:13 +00:00
Edward Hervey 8e51399334 mpegts: Fix include headers
<gst/mpegts/mpegts.h> is the unique header to use

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4336>
2023-04-04 20:54:50 +00:00
Matthew Waters 54acb36689 vulkan/wayland: use xdg_wm_base when available
wl_shell is deprecated and has been removed from some compositors.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4316>
2023-04-03 02:36:38 +00:00
Matthew Waters edffae31dd vulkan/wayland: provide a dummy registry global_remove function
Even if we don't care about any global objects being removed, wayland
will still error if globals are removed without a corresponding listener
set up for them.  e.g. wl_output hotplugging

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4316>
2023-04-03 02:36:38 +00:00
Matthew Waters 21cff6b134 vulkan/wayland: rename debug category to mention wayland instead of XCB
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4316>
2023-04-03 02:36:38 +00:00
Brad Hards 4e14bac1ff mpegts: implement metadata in PES packets
Co-authored-by: Andoni Morales Alastruey <ylatuya@gmail.com>
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1312>
2023-03-30 12:16:52 +00:00
Víctor Manuel Jáquez Leal e5c38003b8 gsth254picture: move internal API to private header
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4288>
2023-03-30 11:40:33 +02:00
Víctor Manuel Jáquez Leal 57e0bdb356 h264decoder: use last_output_poc from DPB
It seems that `last_output_poc` in `h264decoder` class is a left over of commit
5527cc4a2e.

This patch removes it but keeps the log message by fetching the `h264picture`'s
`last_output_pic`.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4288>
2023-03-30 09:38:47 +00:00
Víctor Manuel Jáquez Leal a31cd75c73 vkmemory: flush whole size
Running element_vkcolorconver test with Vulkan validation layer this error is
raised:

Code 0 : Validation Error: [ VUID-VkMappedMemoryRange-size-01390 ] Object 0:
handle = 0x100000000010, type = VK_OBJECT_TYPE_DEVICE_MEMORY;
| MessageID = 0xdd4e6d8b
| vkFlushMappedMemoryRanges: Size in pMemRanges[0] is 0x4, which is not a
multiple of VkPhysicalDeviceLimits::nonCoherentAtomSize (0x40) and offset +
size (0x0 + 0x4 = 0x4) not equal to the memory size (0xb). The Vulkan spec
states: If size is not equal to VK_WHOLE_SIZE, size must either be a multiple of
VkPhysicalDeviceLimits::nonCoherentAtomSize, or offset plus size must equal the
size of memory

The reason of is that the image size used in the test doesn't comply hardware
restrictions. In order to avoid juggling with image size and hardware
restrictions, this patch proposes to use VK_WHOLE_SIZE macro.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4296>
2023-03-30 00:03:05 +00:00
Víctor Manuel Jáquez Leal 3e194267d1 vkfullscreenquad: set enable_clear as TRUE by default
While using the validation layer with this pipeline:

gst-launch-1.0 videotestsrc num-buffers=10 ! vulkanupload ! vulkancolorconvert ! vulkansink

The validation layer throws this message:

Code 0 : Validation Error: [ VUID-VkAttachmentDescription-format-06699 ]
Object 0: handle = 0x5555562e9610, type = VK_OBJECT_TYPE_DEVICE; | MessageID = 0x52b3229e |
vkCreateRenderPass: pCreateInfo->pAttachments[0] format is
VK_FORMAT_B8G8R8A8_UNORM and loadOp is VK_ATTACHMENT_LOAD_OP_LOAD, but
initialLayout is VK_IMAGE_LAYOUT_UNDEFINED.
The Vulkan spec states: If format includes a color or depth aspect and loadOp is
VK_ATTACHMENT_LOAD_OP_LOAD, then initialLayout must not be VK_IMAGE_LAYOUT_UNDEFINED

When creating the render pass the loadOp can be either
`VK_ATTACHMENT_LOAD_OP_CLEAR` or `VK_ATTACHMENT_LOAD_OP_LOAD` depending on
`enable_clear`. While `enable_clear` is FALSE by default (which means
`VK_ATTACHMENT_LOAD_OP_LOAD`). Nonetheless, its value is explicitly changed by
`vkoverlaycompositor` to FALSE too!

This behavior was introduced in merge request #2470 where
`VK_ATTACHMENT_LOAD_OP_CLEAR` was a fixed value for loadOp. Thus, the bug
consists in a missing initialization of `enable_clear` to TRUE from that merge
request.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4296>
2023-03-30 00:03:04 +00:00
Matthew Waters 58d1ab4618 vulkanswapper: correctly handle force-aspect-ratio=false
It was simply ignored so actually handle it.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4278>
2023-03-27 11:58:46 +00:00
Víctor Manuel Jáquez Leal 746e81fccf vkinstance: register GStreamer version as engine version
Specification says:

"""
engineVersion is an unsigned integer variable containing the developer-supplied
version number of the engine used to create the application.
"""

Assuming the engine is GStreamer, it would be expected to set its version as
engine version.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4243>
2023-03-24 04:28:54 +00:00
Seungha Yang af6dccd6e6 d3d11bufferpool: Fix invalid access in debug print loop
Add missing condition check in for loop

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4255>
2023-03-23 18:15:03 +00:00
Víctor Manuel Jáquez Leal 1ace1a5275 vkinstance: enable GPU assisted validation
This allows to check for syncronization issues while using the validation layer.

https://vulkan.lunarg.com/doc/sdk/1.3.239.0/linux/synchronization_usage.html

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4245>
2023-03-23 16:46:34 +00:00
Stéphane Cerveau 23661f0446 vulkan: gl: change symbols to static
Change window_proc and subclass_proc to static to avoid symbols
duplication.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4246>
2023-03-23 00:56:04 +00:00
Víctor Manuel Jáquez Leal c159e40a9f vulkan: silence gobject-instrospection warnings
According with gi annotations [1] the "optional" annotation must be only
for (out) or (inout) parameters.

1. https://gi.readthedocs.io/en/latest/annotations/giannotations.html

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4244>
2023-03-22 14:19:13 +00:00
Aleksandr Slobodeniuk 1f834eaacb d3d11convert: add "method" property
It allows to select the sampling method, same
as "method" property of videoconvert.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4205>
2023-03-21 12:08:54 +00:00
Víctor Manuel Jáquez Leal e794fcaa1c va: add driver description in element metadata
In the same spirit of libva-win32 elements this patch shows the driver of each
element in gst-inspect, giving more information to the user. This driver
description is parsed from vaQueryVendorString from mesa and intel drivers,
while copied as is for others. Also appends the render node for multi gpu
systems.

Fixes #2349

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4204>
2023-03-20 15:27:25 +00:00
Edward Hervey ee759fb4bf plugins: Fix wrong enum usage
gcc 13 now detects conflicting enum usages. Fix the various cases where it was wrong

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4225>
2023-03-20 11:40:30 +00:00
Seungha Yang 0dc5d5ecb1 h264decoder: Fix DPB bumping process
As per spec C.4.5.3 "Bumping", if bumping is needed but DPB holds
no "output needed" picture, then a picture that has the smallest
POC should be considered first for output

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4211>
2023-03-18 08:28:05 +00:00
Nicolas Dufresne dacb2a2b51 h264parser: Fix return value parsing short header
The appropriate return value for incomplete NAL header should be
GST_H264_PARSER_NO_NAL_END. This tells the parser element to
gather more data. Previously, it would assume the NAL is corrupted
and would drop the data, potentially causing stream corruption.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3234>
2023-03-17 21:25:49 +00:00
Albert Sjölund d3f92b9760 webrtc: Fix segfault traversing ice transports
Previously, reassigning loop index l in nicestream.c
could cause a segfault if l->data was null, as it could
reassign l to a null variable, triggering the loop
postassignment l->next, which then segfaults due to
l now being null. It is instead moved into the loop.
_delete_transport already performs the reassignment
inline.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4192>
2023-03-17 14:11:52 +00:00
Tim-Philipp Müller 81716a1097 gst-plugins-bad: re-indent with GNU indent 2.2.12
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4182>
2023-03-17 03:18:54 +00:00
Seungha Yang e1a73a723f d3d11converter: Fix conversion backend selection
Intended behavior was selecting video processor only if pixel shader
is disabled, since we prefer shader over video processor

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4179>
2023-03-16 01:17:27 +00:00
Seungha Yang 63c854c64b vadisplay_win32: Query profiles and entry points on init
Depending on driver, display can be initialized but
fails on query calls.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4149>
2023-03-15 01:37:03 +00:00
Colin Kinloch 755bd9143e wlvideobufferpool: Add DRM Dumb buffer support
This allow the wayland buffer pool to use a GstDRMDumbAllocator
if it has been configured to do so.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3801>
2023-03-14 21:50:57 +00:00
Nicolas Dufresne a961838b0a wlvideoformat: Fix sign issue for DRM fourcc
DRM fourcc ared defined as 32bit unsigned in, but the format helper was passing
an int, while using a unsigned int internally. This is a API/ABI break, but
the API is still unstable.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3801>
2023-03-14 21:50:57 +00:00
Nicolas Dufresne 6ce1b484fd wllinuxdmabuf: Handle video meta inside the importer
This allow simplifying the GstVideoInfo handling in the sinks. Instead
of having to update a video info for the import, the sink can simply pass the
video info associated with the caps and rely on the VideoMeta in the GstBuffer
to obtain the appropriate offset and stride.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3801>
2023-03-14 21:50:57 +00:00
Alicia Boya García 85b6625150 cudaloader: Initialize logging category
gstcudaloader.cpp defines GST_DEBUG_CATEGORY (gst_cudaloader_debug);
but it wasn't initializing it anywhere.

This caused the following error to be logged by gst-plugin-scanner when
libcuda.so.1/nvcuda.dll couldn't be loaded, e.g. in systems without
CUDA:

(gst-plugin-scanner:39618): GStreamer-CRITICAL **: 14:40:22.346:
gst_debug_log_full_valist: assertion 'category != NULL' failed

This patch fixes the bug by initializing the category in
gst_cuda_load_library_once_func() before any logging occurs.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4154>
2023-03-14 03:07:50 +00:00
Seungha Yang 8fc77e5b3d va: Add Win32 backend GstVaDisplay implementation
... and disable derived image on Windows which does not seem to
work

Closes: https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/1750
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4114>
2023-03-10 13:57:47 +00:00
Tim-Philipp Müller 99ee8af782 webrtc: fix g-i annotations for allow-none
'allow none' doesn't exist, and 'allow-none' is now deprecated.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4146>
2023-03-10 13:09:25 +00:00
Seungha Yang bc8a862e20 h265decoder: Use gst_h265_parser_parse_decoder_config_record()
Stop duplicating code and use newly added parsing method instead

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2759>
2023-03-06 12:50:41 +00:00
Seungha Yang 5227b3c9a6 h265parser: Add an API for HEVCDecoderConfigurationRecord parsing
Add a method for HEVC configuration data parsing

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2759>
2023-03-06 12:50:41 +00:00
Seungha Yang 76d1257cd3 d3d11memory: Remove GstPoll from GstD3D11PoolAllocator
GstBufferPool implementation was referenced for this GstD3D11PoolAllocator,
for example GstAtomicQueue, various atomic operations, and GstPoll ones.
However, such combination seems to be almost pointless
since gst_poll_{read,write}_control() takes mutex and also
GstPoll uses Win32 event handle internally.
Use simple SRWLOCK and CONDITION_VARIABLE instead, and don't make things
complicated/inefficient.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2887>
2023-03-05 22:51:24 +09:00
Seungha Yang 69b2e1565c d3d11memory: Add support for keyed mutex
Non-zero mutex key held by application is not considered for now.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4081>
2023-03-01 14:13:14 +00:00
Philippe Normand 906b90287c webrtcbin: Relay add-ice-candidate errors from Ice implementation to Application
The `add_candidate` vfunc of the GstWebRTCICE interface gained a GstPromise
argument, which is an ABI break. We're not aware of any external user of this
interface yet so we think it's OK.

This change is useful in cases where the application needs to bubble up errors
from the underlying ICE agent, for instance when the agent was given an invalid
ICE candidate.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3960>
2023-02-27 09:09:47 +00:00
He Junyan 76585b3a05 av1decoder: fail early if no input caps have been provided
The av1decoder class does not implement the ->parse() virtual function,
and we always need to add the av1parse element before it. So we should
set_needs_format of the decoder to TRUE, then if no parse before it, it
can fail with a "not-negotiated" error early, rather than go on and
generate unexpected error.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4064>
2023-02-25 10:40:21 +08:00
He Junyan 30a05a3999 vp9decoder: fail early if no input caps have been provided
The vp9decoder class does not implement the ->parse() virtual function,
and we always need to add the vp9parse element before it. So we should
set_needs_format of the decoder to TRUE, then if no parse before it, it
can fail with a "not-negotiated" error early, rather than go on and
generate unexpected error.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4064>
2023-02-25 10:38:58 +08:00
He Junyan c8af9adcdc vp8decoder: fail early if no input caps have been provided
The vp8decoder class does not implement the ->parse() virtual function,
it can only accepts frame aligned data. If some element such as filesrc
feed it with unaligned data, the behaviour is undecided. So we should
set_needs_format of the decoder to TRUE, then it can fail with a
"not-negotiated" error early, rather than go on and generate unexpected
error.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4064>
2023-02-25 10:32:45 +08:00
He Junyan a965be8d96 mpeg2decoder: fail early if no input caps have been provided
The mpeg2decoder class does not implement the ->parse() virtual function,
and we always need to add the mpegvideoparse element before it. So we should
set_needs_format of the decoder to TRUE, then if no parse before it, it
can fail with a "not-negotiated" error early, rather than go on and
generate unexpected error.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4064>
2023-02-25 10:31:27 +08:00
He Junyan 13b36cd4e3 h264decoder: fail early if no input caps have been provided
The h264decoder class does not implement the ->parse() virtual function,
and we always need to add the h264parse element before it. So we should
set_needs_format of the decoder to TRUE, then if no parse before it, it
can fail with a "not-negotiated" error early, rather than go on and
generate unexpected error.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4064>
2023-02-25 10:30:37 +08:00
He Junyan b92a0a3e84 h265decoder: fail early if no input caps have been provided
The h265decoder class does not implement the ->parse() virtual function,
and we always need to add the h265parse element before it. So we should
set_needs_format of the decoder to TRUE, then if no parse before it, it
can fail with a "not-negotiated" error early, rather than go on and
generate unexpected error.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4064>
2023-02-25 10:27:24 +08:00
Seungha Yang 319f5f0760 cuda: Link libatomic if needed
Looks like C++ does not pull it automatically

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3997>
2023-02-21 16:00:32 +00:00
Nicolas Dufresne 9aa41aa35e h264bitwriter: Remove second_chroma_qp_index_offset cast
That API pps->second_chroma_qp_index_offset has been fixed to reflect
the sign of field in the spec.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3966>
2023-02-20 16:40:02 +00:00
Mengkejiergeli Ba bca3a3c923 h264parser: Fix the type of a parameter
From spec, the value of second_chroma_qp_index_offset is in the range of
-12 to +12 inclusive. Fix its type from guint8 to gint8.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3966>
2023-02-20 16:40:01 +00:00
Mengkejiergeli Ba 7278c31ea8 vaallocator: Check return value from va_sync_surface
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3919>
2023-02-20 16:02:38 +00:00
Seungha Yang 59f359eb99 cuda: Rename macro HAVE_NVCODEC_GST_GL -> HAVE_CUDA_GST_GL
... and always use #ifdef instead of #if

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3992>
2023-02-20 01:49:31 +09:00
Mengkejiergeli Ba b2fcc177f5 av1parser, h265parser: Fix some code defects
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3953>
2023-02-19 11:23:00 +00:00
Seungha Yang ff3120a38c cudamemory, d3d11memory: Add memory_{get,set}_token_data() methods
Similar to GstMiniObject qdata but new methods will use int64
token value and per object lock, instead of GQuark with global
mutex in qdata

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3884>
2023-02-16 17:49:54 +00:00
Seungha Yang f6defc0c5b cudamemory: Add gst_cuda_allocator_alloc_wrapped() method
... so that application can pass already allocated CUDA memory

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3884>
2023-02-16 17:49:54 +00:00
Seungha Yang e77e6fd4a7 cudamemory: Skip sync if no I/O operation happend on free()
Synchronization for unused memory is not required

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3884>
2023-02-16 17:49:54 +00:00
Seungha Yang f44cac1c9f cudamemory: Make CUtexObject object reusable
Create and hold CUtexObject objects in GstCudaMemory so that it can
be reusable

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3884>
2023-02-16 17:49:54 +00:00
Seungha Yang 992406cf4f cuda, nvcodec: Make GstD3D11 dependency mandatory
GstD3D11 build-time dependencies should be always available on Windows already
and runtime dependencies as well, since required external
(non-GStreamer) depends are all system DLLs

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3884>
2023-02-16 17:49:54 +00:00
Seungha Yang f212bd901b cuda: Port to C++
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3884>
2023-02-16 17:49:53 +00:00
Mengkejiergeli Ba 585d2d93f6 codecparsers: {h264,h265}bitwriter: Remove redundant condition checks
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3967>
2023-02-15 16:00:04 +08:00
Sebastian Dröge 5119ca25e4 av1parser: Don't consider unknown metadata OBUs a bitstream error
Just don't parse them.

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

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3898>
2023-02-09 14:52:58 +00:00
Seungha Yang 090d50e1a0 tests: Add CUDA memory allocator test
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3629>
2023-02-03 15:27:43 +00:00
Seungha Yang 7a8bb85523 cudaupload, cudadownload: Update for shared CUDA stream
Use CUDA stream of memory if exists

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3629>
2023-02-03 15:27:43 +00:00
Seungha Yang d409c35367 cudabufferpool: Add support for CUDA stream use in memory
* Use GstCudaPoolAllocator
* Pass configured GstCudaStream object to allocator

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3629>
2023-02-03 15:27:42 +00:00
Seungha Yang 30d06e03c2 cudamemory: Make GstCudaStream-aware
This will be used for CUDA stream sharing.

* Adding GstCudaPoolAllocator object. The pool allocator will
  control synchronization of allocated memory objects.
* Modify gst_cuda_allocator_alloc() API so that caller can specify/set
  GstCudaStream object for the newly allocated memory.
* GST_CUDA_MEMORY_TRANSFER_NEED_SYNC flag is added in addition to
  existing GST_CUDA_MEMORY_TRANSFER_NEED_{UPLOAD,DOWNLOAD}.
  The flag indicates that any GPU command queued in the CUDA stream
  may not be finished yet, and caller should take care of the
  synchronization.
  The flag is controlled by GstCudaMemory object if the memory holds
  GstCudaStream. (Otherwise, GstCudaMemory will do synchronization
  as before this commit). Specifically, GstCudaMemory object will set
  the new flag automatically when memory is mapped with
  (GST_MAP_CUDA | GST_MAP_WRITE) flags. Caller will need to unset
  the flag via GST_MEMORY_FLAG_UNSET() if it's already synchronized
  by client code.
* gst_cuda_memory_sync() helper function is added to perform synchronization
* Why not use CUevent object to keep track of synchronization status?
  CUDA provides fence-like interface already via CUevent object,
  but cuEventRecord/cuEventQuery APIs are not zero-cost operations.
  Instead, in this version, the status is tracked by using map and
  object flags.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3629>
2023-02-03 15:27:42 +00:00
Seungha Yang 9eaae61a44 cudamemory: Allow nullptr allocator object
The GstCudaAllocator object doesn't hold any device object.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3629>
2023-02-03 15:27:42 +00:00