Commit graph

2890 commits

Author SHA1 Message Date
He Junyan a278137f7e tests: Add the av1 bit code writer test case
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3015>
2024-01-30 08:24:25 +00:00
He Junyan 040042113e codecparsers: Implement the AV1 bit code writer
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3015>
2024-01-30 08:24:25 +00:00
He Junyan e1d96d0669 codecparsers: av1: add ref_global_motion_params in frame header
In order to ease the AV1 bit writer to write the global_motion_params
when primary_ref_frame is enabled, we need to add this field to set
the global_motion_params of the reference frame.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3015>
2024-01-30 08:24:25 +00:00
He Junyan 14a5d936f8 codecparsers: av1: add expected_frame_id in frame header
We need it to ease the bit code writing of AV1 frame header.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3015>
2024-01-30 08:24:25 +00:00
Daniel Morin 73dedf9a51 h264parse: Remove un-needed check on SPS state
Fixes #3254
- Having SEI before SPS is not an issue anymore with AU boundary detection
based on backlog.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6004>
2024-01-30 01:22:32 +00:00
Robert Mader 9ee58825cc vaallocator: Allow non-linear modifiers for dummy mem_maps
A client may map dmabufs without the intention to either read or write
to the memory. One example is clients wanting to use the
`gst_video_frame_map()` helper function.

Thus, in order to make buffers from `GstVaDmabufAllocator` conveniently
usable, ignore the modifier check if the client specified neither
`GST_MAP_READ` nor `GST_MAP_WRITE`.

Also skip the `va_sync_surface()` call in that case, as it's likely only
needed for CPU reads/writes.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5965>
2024-01-29 17:10:50 +00:00
Nicolas Dufresne 0b38cb2320 vulkan: Fix clang compiler warning
clang does not like the array index assignment without the `=` sign in
it. This is a gnu extension I believe, and adding the sign is proper.
This fixes the following two warnings:

```
../subprojects/gst-plugins-bad/gst-libs/gst/vulkan/gstvkvideo-private.c:32:40:
warning: use of GNU 'missing =' extension in designator [-Wgnu-designator]
  [GST_VK_VIDEO_EXTENSION_DECODE_H264] {
                                       ^
                                       =
../subprojects/gst-plugins-bad/gst-libs/gst/vulkan/gstvkvideo-private.c:36:40:
warning: use of GNU 'missing =' extension in designator [-Wgnu-designator]
  [GST_VK_VIDEO_EXTENSION_DECODE_H265] {
                                       ^
                                       =
```

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5996>
2024-01-26 16:42:30 +00:00
Seungha Yang 1a7c85a261 qsvh264enc: Always specify field order
qsv runtime will report error when encoding interlaced stream
if session was initialized with unknown field order
but tff/bff is specified in per frame encoding parameter.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5835>
2024-01-25 14:25:16 +00:00
Jan Schmidt ef71c1319a webrtcbin: Improve SDP intersection for Opus
Remove optional sprop-stereo and sprop-maxcapture fields from Opus
remote offer caps before intersecting with local codec preferences.

According to https://datatracker.ietf.org/doc/html/rfc7587#section-7.1
those fields are sender-only informative, and don't affect
interoperability.

Fixes cases where the webrtc media will end up receive-only if the
local side wants to send stereo but the remote is sending mono, or
vice versa.

There may be other fields in other codecs, so the implementation
anticipates needing to add further fields and codecs in the future.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5993>
2024-01-25 13:37:21 +00:00
Seungha Yang 3855646f1d d3d12: Add MPEG-2 decoder
Most of code additions are just gluing already implemented
GstDxva and GstD3D12Decoder interfaces

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5979>
2024-01-25 11:45:23 +00:00
Jan Schmidt 5e4e57ddb3 timecodestamper: Improve error handling and don't crash
Post a bus message explaining that input buffers must
have timestamps and return GST_FLOW_ERROR, instead of
a confusing NOT-NEGOTIATED

Also remove an errant buffer unref in the error handling
that would lead to crashes after.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5935>
2024-01-25 01:38:08 +00:00
Jan Schmidt e3fe89aba8 timecodestamper: Don't do finalizing in dispose
Add a finalize method and release locks and things in there, instead
of in the dispose method. Dispose may be called multiple times,
at any time, and should just safely release references to other
memory that might reference it back.

In this case, timecodestamper would later crash in the element
dispose method trying to take the freed mutex from
gst_timecodestamper_release_pad().

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5935>
2024-01-25 01:38:08 +00:00
Ruben Gonzalez 5e3fafd025 SA: Remove extra check since libva min version is 1.12
The libva version was updated to 1.12 in PR 4781 [1]
[1] https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4781

NOTE: I also sort va_sources
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5978>
2024-01-25 00:45:55 +00:00
Philippe Normand 9a5ca61f87 vp9parse: Fix critical warning during caps negotiation
`gst_pad_get_allowed_caps()` returns a non-writable caps, so we need to make it
writable, otherwise the `gst_caps_remove_structure()` call below might trigger a
critical warning.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5975>
2024-01-25 00:01:14 +00:00
Seungha Yang 3991801d4a d3d12av1dec: Fix object type name on multi-gpu system
Fixing typo

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5964>
2024-01-24 22:35:17 +00:00
Stéphane Cerveau dd6fca1d02 vulkan video: add GST_VK_VIDEO_EXTENSIONS enum
To avoid using mysterious value, use an enum to
show the valid value in _vk_codec_extensions

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5922>
2024-01-24 17:00:47 +00:00
Matthew Waters f50b43c83b vulkan/format: also get features in the fallback case
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5576>
2024-01-24 13:54:41 +00:00
Matthew Waters 634fc913a6 vulkan/format: don't assign an uneeded boolean
We don't actually need the basics_primary/secondary boolean.  The
returned format is decided by the requested usage with fallbacks as
necessary.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5576>
2024-01-24 13:54:41 +00:00
Matthew Waters 420548a6c6 vulkan/format: there is no current need to use the 64-bit feature flags
All of our feature flags are currently covered by the first
VkFormatFeatureFlag enum so far.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5576>
2024-01-24 13:54:41 +00:00
Matthew Waters 080b25cbfe vulkan/format: correct fallback features in from_video_info_2
The features were not actually used and were written into a boolean
value.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5576>
2024-01-24 13:54:41 +00:00
Seungha Yang f368d63ecd av1parser: Fix potential stack overflow during tile list parsing
The tile_count_minus_1 must be less than or equal to 511 as specified
in spec "6.11.1 General tile list OBU semantics"

Fixes #3214 / CVE-2024-0444 / ZDI-CAN-22873

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5970>
2024-01-24 12:29:12 +00:00
Daniel Stone da9d4225b1 wayland: Actually use wayland-protocols version dep
Closes: #3242
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5962>
2024-01-23 13:11:23 +00:00
Daniel Stone 3a37778f69 gstwayland: Support wp_single_pixel_buffer_v1
This protocol does what it says on the box, avoiding the need for a 1x1
wl_shm buffer.

A wayland-projects wrap has been added for users who do not have v1.26
available.

This commit was partly authored by Robert Mader.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2662>
2024-01-22 16:51:36 -05:00
Seungha Yang 4fb284346e d3d12h264enc: Fix profile support check
Add missing CheckFeatureSupport() call, and remove unused field

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5952>
2024-01-22 20:10:24 +09:00
Seungha Yang f44d5d18f3 d3d12: Pass target rectangle to ClearRenderTargetView()
Some drivers seem to be crashing if ClearRenderTargetView() is called
for P010/P016 texture's second subresource (UV plane) without
specified target rectangle.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5952>
2024-01-22 19:40:08 +09:00
Seungha Yang 4e1bf149d0 d3d12: Add H.264 video encoder
Adding video encoder element

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5808>
2024-01-19 12:47:35 +00:00
Mengkejiergeli Ba b8cb0d1d7f msdkdec: Fix leaks
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5930>
2024-01-18 08:43:48 +00:00
Piotr Brzeziński 3f67e70f39 vtenc: Fix PAUSED->READY deadlock when output loop is running
Explicitly calls gst_vtenc_pause_output_loop when going PAUSED->READY to make sure GST_PAD_STREAM_LOCK is not taken.

Before this change, a deadlock would occur if pipeline got stopped right after one output buffer was generated by vtenc.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5933>
2024-01-18 07:37:58 +00:00
Seungha Yang e353fe8fcc h264decoder: Handle malformed avc/avc3 packets
Packetized stream format should not contain start-code prefix
in bitstream and each [nal-length-byte, nal-byte] unit should consist of
single nal unit. But there are malformed streams in the world.
Use newly added gst_h264_parser_identify_and_split_nalu_avc()
method to identify each nal unit.

Fixes: https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/3219
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5772>
2024-01-17 14:57:57 +00:00
Seungha Yang c737799900 h264parser: Add gst_h264_parser_identify_and_split_nalu_avc() method
Equivalent to _split_nalu_hevc() method in h265parser. This method
will scan start-code prefix and split into individual NAL units
if start-code prefix is detected

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5772>
2024-01-17 14:57:57 +00:00
Mengkejiergeli Ba a6ab4fa98b msdkdec: Let msdk base decoder maintain the output_state
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5929>
2024-01-17 10:04:03 +08:00
Chris Spencer 2388932767 vkmemory: don't map memory more than once
vkMapMemory may not be called on a memory object that is already
host-mapped. If the gstreamer memory object is mapped more than once then
reuse the existing Vulkan mapping.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5917>
2024-01-16 17:44:48 +01:00
Mengkejiergeli Ba 2c61fd92e2 msdkvpp: Fix dma caps negotiation
Modify the fix_output_format in vpp to directly generate caps with
negotiated src caps, and we have the correct dma caps negotiation in
fix_output_format function. And thus, we can remove the redundant
negotiation of using function pad_accept_memory in vpp.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5845>
2024-01-16 14:04:05 +08:00
Seungha Yang 495390f63a h264parse: Fix AU collection
If remaining NALUs are expected to be drained in the current
process_frame() loop, do not adjust offsets. Otherwise NALU data
will point to random byte position and it would be broken data.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5911>
2024-01-15 21:53:11 +00:00
Seungha Yang 0cceb6f68f d3d12memory: Don't use persistent staging buffer map
Persistent map is not recommended in case of readback

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5919>
2024-01-14 13:10:56 +00:00
Seungha Yang 077470913d d3d12decoder: Use D3D12_HEAP_FLAG_CREATE_NOT_ZEROED flag
Since the first access to a texture is always write, zero initialization
is unnecessary

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5919>
2024-01-14 13:10:56 +00:00
Olivier Crête b1ac114ca5 onnxinference: Return caps based on model preference when possible
This should enable zero-copy when the model has the right type

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5885>
2024-01-13 22:29:41 +00:00
Olivier Crête 83c2d30438 onnx: Use the element pointer for debug message
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5885>
2024-01-13 22:29:41 +00:00
Olivier Crête 54b361c554 onnx: Extract data type from the model itself
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5885>
2024-01-13 22:29:41 +00:00
Chris Spencer 865227b750 vkimagebufferpool: allow specifying initial image layout
The pool currently defaults to performing a layout transition to
VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, with some special exceptions for
video usages. This may not be a legal transition depending on the usage.
Provide an API to explicitly control the initial image layout.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5881>
2024-01-13 05:54:00 +00:00
Scott Moreau f0d15f335d gst-launch: accept option to set program name
The option --prog-name="PROGRAM-NAME" can be passed to set the program name.
The program name is used by gtk and gstreamer to set the class or app-id.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5263>
2024-01-12 17:11:11 +00:00
Víctor Manuel Jáquez Leal 05d239f631 jpegparse: bump to primary rank
Also updates medias modules for CI.

Fixes: #1775
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3983>
2024-01-12 11:04:07 +01:00
Ratchanan Srirattanamet facb000afe androidmedia: add NDK implementation of Android MediaCodec
This reduces the amount of Java <-> native calls, which should reduce
overhead a bit. It also paves a way to share the code between Android
and a libhybris-based backend (where GNU/Linux system uses Android
driver) in the future.

Bug: https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/issues/1242
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4115>
2024-01-11 19:00:13 +00:00
Ratchanan Srirattanamet a50ce9c6b0 androidmedia: allow multiple implementations of codec and format
When implementing NDK media support, it would be useful to also have JNI
implementation in the same binary as NDK media compatibility is lower.
As such, implement a rudimentary vtable system for gstamc-codec and
gstamc-format, and allow choosing the implementation at static_init()
time.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4115>
2024-01-11 19:00:13 +00:00
Ratchanan Srirattanamet d0ffcb46df androidmedia: call all static_init() functions from single entry point
This allows the implementations to do custom logic behind the hood. For
example, when NDK implementation is added, the entrypoint can chooses to
statically initialize the NDK implementations or the JNI one.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4115>
2024-01-11 19:00:13 +00:00
Stéphane Cerveau f337d37d6d codecparsers: add slice type name for h265
Add a method to convert the slice type to a descriptive
name.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5908>
2024-01-11 13:17:43 +01:00
Stéphane Cerveau 9c250179c6 codecparsers: add helper methods for h264
Add two helper methods to convert profile
and slice types

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5908>
2024-01-11 13:17:43 +01:00
Mengkejiergeli Ba 0d04660c5d msdk: Fix memory leaks
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5819>
2024-01-11 14:52:45 +08:00
Olivier Crête 745197d386 analytics: Implement scale meta transform for Object detection meta
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5863>
2024-01-10 18:35:17 -05:00
Olivier Crête 5d3035553c analytics: Replace type quark with opaque struct pointer
This way, we can add function pointers in there for things like
transformations.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5863>
2024-01-10 18:34:53 -05:00