Commit graph

2544 commits

Author SHA1 Message Date
Seungha Yang ba02e94dde d3d11converter: Calculate gamma LUT only once
Reuse calculated gamma lookup table and use immutable 1D texture

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5482>
2023-10-14 13:37:08 +00:00
Seungha Yang 6f8c474293 d3d11converter: Remove unused variable
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5482>
2023-10-14 13:37:08 +00:00
Seungha Yang 26e8bd1cc2 docs: Update Windows plugin docs
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5481>
2023-10-14 12:32:46 +00:00
Seungha Yang 347dd37225 dxva: Build gir and remove SDK header dependency
Build gir for documentation

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5481>
2023-10-14 12:32:46 +00:00
Seungha Yang c5d60cee01 d3d12decoder: Hide non-default device from docs
... and add since marker

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5481>
2023-10-14 12:32:46 +00:00
Seungha Yang 8a35c8a2a5 d3d11compositor: Fix typo in property description
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5481>
2023-10-14 12:32:46 +00:00
Seungha Yang 0a05ba3f62 nvencoder: Add support for new preset/tune/multi-pass options
Adding new P1 ~ P7 presets and deprecate old preset values.
Also adding tune and multi-pass properties.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5428>
2023-10-14 11:03:40 +00:00
Mart Raudsepp bcc0885239 bs2b: Add missing space in plugin description
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5477>
2023-10-13 09:04:14 +00:00
Mart Raudsepp 6c0e5ca689 colormanagement: Fix typo in pipeline example
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5478>
2023-10-13 10:04:39 +03:00
Rahul T R 6fbe4d55c4 kmssink: Add TIDSS auto-detection
Add Texas Instruments TIDSS display controller into list of
auto-detected modules.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5469>
2023-10-12 18:25:50 +00:00
Seungha Yang ed29c23e86 d3d12, dwrite, va: Fix various msys2 build error/warning
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5454>
2023-10-12 10:53:58 +00:00
Mengkejiergeli Ba c14f4cda0c msdkvpp: Use filter flag to handle passthrough for tone mapping
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5449>
2023-10-12 05:02:37 +00:00
Seungha Yang c2ed8759c8 d3d11videosink: Don't use DXGI_ALPHA_MODE_PREMULTIPLIED for HWND swapchain
It's allowed only for a swapchain type which does composition

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5464>
2023-10-11 22:22:56 +00:00
Seungha Yang 7b564619cf d3d11videosink: Fix rendering with initial fullscreen state
Change fullscreen mode once the swapchain is fully configured

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5462>
2023-10-11 21:39:11 +00:00
Seungha Yang 15248d8b84 d3d11videosink: Fix toggling between fullscreen and maximized
Use GetWindowPlacement() and SetWindowPlacement() APIs
to remember and restore window status, such as maximized, position,
restore position, etc.

Fixes: https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/3016
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5462>
2023-10-11 21:39:11 +00:00
Seungha Yang f52ecb9607 d3d11converter: Add support for HLSL precompile and bytecode caching
Precompile pixel shaders for simple conversion path
(without gamma/primaries conversion) in case of MSVC build.
Even if runtime compile is required (cross-compiled or complex conversion
path), do it only once and reuse the compiled bytecode.

This precompile/caching can save about 95% of time taken by
gst_d3d11_converter_new() call.

Fixes: https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/3004
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5457>
2023-10-11 18:40:46 +00:00
Seungha Yang 83a576e854 d3d11: Reuse sampler object
The linear sampler object can be reused

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5457>
2023-10-11 18:40:46 +00:00
Seungha Yang 92cc5722c8 d3d11: Pass HLSL source size to compile function
The string size is known at build time

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5457>
2023-10-11 18:40:46 +00:00
Seungha Yang bfdea297d2 d3d11converter: Set alpha-mode using config
... and disallow runtime alpha-mode update for now

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5457>
2023-10-11 18:40:46 +00:00
Seungha Yang 8fe26c8a10 d3d11: Simplify HLSL build
Unify source/header/entrypoint names

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5457>
2023-10-11 18:40:46 +00:00
Nicolas Dufresne 88fd9908fe v4l2codecs: Fix tiled formats stride conversion
While adding arbitrary tile support, a round up operation was badly
converter. This caused the Y component of the stride to be 0. This
eventually lead to a crash in glupoad preceded by the following
assertion.

  gst_gl_buffer_allocation_params_new: assertion 'alloc_size > 0' failed

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5458>
2023-10-11 14:13:53 +00:00
Seungha Yang 3536b7f3a6 decklink: Fix broken COM string conversion
WideCharToMultiByte return is the string length without null terminate
character if passed "cchWideChar" does not include the null terminate
character size. Instead of passing the exact string length, pass -1 so that
the API can understand the input string is null terminated already and
returned value from the API includes the character.

Fixes: https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/3023
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5444>
2023-10-09 20:10:25 +09:00
Michael Tretter c020dab393 uvcsink: use the pad's current caps to update caps_changed
The caps that were sent by the caps event can be retrieved from the sinkpad
using gst_pad_get_current_caps(). This is more reliable than using cur_caps as
we know exactly which caps upstream selected when the UVC host didn't select a
format, yet.

This further allows to simplify the check, if the uvcsink has to wait for the
caps event before switching to the internal v4l2sink.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4994>
2023-10-06 15:55:23 +00:00
Michael Tretter 733b4d9597 uvcsink: use event function instead of probe
The probe passes all events except the EVENT_CAPS. Installing and removing the
probe doesn't provide any additional value.

Install an event function and always handle EVENT_CAPS. Use the caps_changed
field, to decide, if the element has to do anything special on a EVENT_CAPS.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4994>
2023-10-06 15:55:23 +00:00
Michael Tretter 1732f8c728 uvcsink: refactor gst_uvc_sink_update_streaming
Move the sanity checks to the beginning of the function. Make the actual effect
of the function more obvious and reset the flags in the end.

This should make it easier to understand what this function is doing.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4994>
2023-10-06 15:55:23 +00:00
Michael Tretter 6637343980 uvcsink: extract helper function for updating the stream state
The uvcsink may switch to the v4l2sink after a STREAMON either on a caps event
or on a caps query.

Extract the code that handles the STREAMON into a helper function, as this is
the same code.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4994>
2023-10-06 15:55:23 +00:00
Michael Tretter 24daf9ea3d uvcsink: extract common code to reset caps_changed
The caps_changed flag must be reset for streamon and streamoff. Extract it to a
common path.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4994>
2023-10-06 15:55:23 +00:00
Michael Tretter a9eef25717 uvcsink: remove separate function for buffer probe installation
The probe that installs the buffer probe is already on the correct pad. There is
no need for a separate function to install the probe.

While at it, change the signature of the probe functions to GstPadProbeCallback
to avoid the cast when installing the probes.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4994>
2023-10-06 15:55:23 +00:00
Michael Tretter eac9f60608 uvcsink: extract common code in idle_probe
The RECONFIGURE event has to be sent in streamon and streamoff. Extract the
common code to a separate branch to make it easier to understand.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4994>
2023-10-06 15:55:23 +00:00
Michael Tretter 69c5529011 uvcsink: return caps when reading the host configured caps
The uvcsink calculates the caps for the format that the UVC host selected. The
gst_uvc_sink_parse_cur_caps() sets these caps as cur_caps as a side effect. This
behavior is surprising as cur_caps is later updated to reflect the actually used
caps.

Just return the configured caps to avoid side effects. This makes the function
easier to understand. Update the function name to reflect the new behavior.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4994>
2023-10-06 15:55:23 +00:00
Michael Grzeschik 17797d1d28 uvcsink: fix event peer probe
The only job of the event peer probe is to catch the upcoming caps event
and be able to react with the sink change. All other events that are
passing the pad shall be passed and ignored.

Since the probe is a blocking probe, there is no use in returning
with GST_PAD_PROBE_OK on other events. Otherwise the event would just
be blocked.

Since we are handling the probe removal of the probe already in the
event switch, we can remove the second explicit probe removal.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4994>
2023-10-06 15:55:23 +00:00
Michael Grzeschik e3a121950b uvcsink: drop useless debug messages in peer event probe
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4994>
2023-10-06 15:55:22 +00:00
Guillaume Desmottes dd0896f05a audiobuffersplit: disable max-silence-time if set to 0
According to the property documentation max-silence-time is supposed to be
disabled when set to 0 but it was not.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5442>
2023-10-06 14:48:46 +02:00
James Oliver aeef97d81b nvh265encoder: fix bounds for auto-select GPU enumeration
Fixes the bounds-check for encoder auto-select GPU enumeration to be
between 0-7 instead of 0-6. This should allow 8-GPU machines to work
with nvautogpuh265enc for the last enumerated GPU.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5438>
2023-10-05 13:37:36 +08:00
James Oliver 54074af8ec nvh264encoder: fix bounds for auto-select GPU enumeration
Fixes the bounds-check for encoder auto-select GPU enumeration to be
between 0-7 instead of 0-6. This should allow 8-GPU machines to work
with nvautogpuh264enc for the last enumerated GPU.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5438>
2023-10-05 13:37:32 +08:00
Stéphane Cerveau 898e153968 dashsink: add dashmp4mux support
As mp4mux is not correctly suppporting the fragment generation,
see
https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1722,
we deprecate and advertize the current status of usage.

Added the possibility to use the rust dashmp4mux element.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5403>
2023-10-04 23:49:02 +00:00
Stéphane Cerveau 2644b3608f dashsink: Do not reset muxer only for TS
The MP4 needs to be reset to continue to produce segments.

Closes #1015

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5403>
2023-10-04 23:49:02 +00:00
Nicolas Dufresne fc4bb5585f doc: Update plugin cache for added DMA_DRM format
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5386>
2023-10-03 21:13:00 +00:00
Nicolas Dufresne aaed9272c1 video-filters: Fix passthrough with ANY caps feature
With the support for DRM modifiers, passthrough caps must now include DMA_DRM
format, otherwise pipeline using thhese filters unconditionally may fail
to negotiate.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5386>
2023-10-03 21:13:00 +00:00
Jonas K Danielsson 6c84d7ef0d doc: rist: Update cache for new properties
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5422>
2023-10-03 20:17:08 +00:00
Jonas K Danielsson f4fb4a5606 ristsrc: Add support for dynamic payload
This commit ports functionality from the `rtpsrc` to make the `ristsrc`
work with dynamic payload types.

It adds two properties:
  - `caps`
  - `encoding-name`

These can be used to make the `ristsrc` receive other payload types than
the MPEG TS one.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5422>
2023-10-03 20:17:07 +00:00
Seungha Yang cf1286b0e9 d3d11: Add support for HLSL precompile and shader caching
Compile HLSL at build time in case of MSVC, and use it if device
supports shader model 5. Also cache/reuse pixel shader and vertex
shader objects.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5426>
2023-10-03 09:42:03 +00:00
Seungha Yang 6fdcd07e59 d3d11testsrc: Use const buffer in shader
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5426>
2023-10-03 09:42:03 +00:00
Sebastian Dröge 8af9cd9b1a docs: Update plugins caches
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5412>
2023-10-02 09:39:21 +03:00
Sebastian Dröge 510f71fbe4 video-format: Fix up video formats ordering by quality
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5412>
2023-10-02 09:39:21 +03:00
Jordan Petridis 1fb7cda048 svtav1enc: Avoid svtav1 defining TRUE/FALSE
Make sure we include the svt headers first and then undefine TRUE
and FALSE so we will only ever be using glib's defines for those.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5424>
2023-09-29 14:32:22 +00:00
Seungha Yang 2cd81eb1ac nvdecoder: Handle output surface alignment in decoder helper object
Output resolution might not be an even number. Set output resolution
without round up but consider the alignment inside of decoder

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5409>
2023-09-29 12:36:01 +00:00
Seungha Yang 42560c24df nvdecoder: Add support for D3D11 output
Since DXVA does not support some profiles such as HEVC RExt,
vendor specific decoding API is still required.
When decoder is negotiated with d3d11 caps, decoder will convert
semi-planar frame to planar since semi-planar format (e.g.,
DXGI_FORMAT_NV12) is not supported by CUDA/D3D11 interop.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5409>
2023-09-29 12:36:01 +00:00
Seungha Yang 57e0a0bd61 nvdecoder: Handle GstContext in helper object
... and move common code to helper object

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5409>
2023-09-29 12:36:01 +00:00
Seungha Yang 91e0c3aafa cuda: Use d3d11 token data for interop data
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5409>
2023-09-29 12:36:01 +00:00
Seungha Yang c818906236 cuda: Add support for I420_12LE format
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5409>
2023-09-29 12:36:01 +00:00
Philippe Normand ae7871c019 wpevideosrc: Add a simple example for headless rendering
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5405>
2023-09-28 19:20:12 +00:00
David Svensson Fors 82a06a36cc dashsink: Use gst_codec_utils_caps_get_mime_codec()
Use gst_codec_utils_caps_get_mime_codec() in pbutils for codec
strings. That function gives more elaborate RFC 6381 compatible
strings than the helper functions in gstmdphelper.c, such as
"avc1.F4000D".

Remove the helper functions, as they were only used from dashsink.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5404>
2023-09-28 18:31:07 +00:00
Philippe Normand 886bd7e4e0 interaudiosink: Ensure adapters don't store buffers with audio meta
The interaudiosrc might take buffers of different sizes from the audio adapter,
so keeping metas consistency would be an issue. So the sink now strips the audio
metas away and the src adds them back (for non-interleaved layouts only) when
taking buffers from the adapter.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5324>
2023-09-28 10:26:33 +00:00
Philippe Normand 46dbe2a372 interaudiosrc: Add audio meta to buffers containing non-interleaved samples
Without this a downstream audioconverter wouldn't be able to map the
GstAudioBuffer prior to conversion.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5324>
2023-09-28 10:26:33 +00:00
Xavier Claessens 0ab48250a9 GstCustomMeta: Use simplified API where possible
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5385>
2023-09-27 18:46:34 +00:00
Piotr Brzeziński 85adc2daee vtdec: Handle output in separate thread
Moves outputting frames to a task on the source pad, bringing vtdec in line with vtenc.
This brings possible performance improvements thanks to decoupling queueing new frames from outputting processed ones.
The queue length is limited to `2*DBP` to prevent decoding too far ahead compared to what we're pushing downstream.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5163>
2023-09-27 13:01:33 +00:00
Seungha Yang a7353d8859 d3d11decoder: Fix crash on negotiate() when decoder is not configured
The negotiate() can be called by GstVideoDecoder baseclass on GAP event,
and decoder helper object might not be configured at the time
when negotiate() is called.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5394>
2023-09-27 01:15:26 +09:00
Seungha Yang c5bd0faee3 nvdecoder: Add support for HEVC GBR output
... and use P012 format for 12bits instead of P016

Fixes: https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/2991
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5375>
2023-09-23 13:12:56 +00:00
Seungha Yang 907c507680 nvh265encoder: Add support for RGB encoding
Adding GBR format support to nv{autogpu,cuda,d3d11}h265enc.
Note that the only difference between GBR and Y444 encoding
is matrix_coeffs value written in VUI.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5375>
2023-09-23 13:12:56 +00:00
Seungha Yang a80f542f66 cuda: Add support for P012_LE and Y444/GBR high bitdepth formats
Adding P012, Y444_10, Y444_12, GBR_10, GBR_12 and GBR_16 formats support

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5375>
2023-09-23 13:12:55 +00:00
Seungha Yang d731a7c2fc d3d11: Add support for GBR_16LE format
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5375>
2023-09-23 13:12:55 +00:00
Seungha Yang 69d1679914 video: Add GBR 16bits formats
Adding 16bits planar RGB formats

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5375>
2023-09-23 13:12:55 +00:00
Tong Wu 57bfbf51b2 msdkvpp: fix an issue which causes dangling pointer
Put all the external buffer structures into thiz to avoid being freed
early.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5377>
2023-09-22 10:04:30 +08:00
Seungha Yang 2b7dc0de1b h265decoder: Set discont state after new_picture()
Subclass might negotiate with downstream inside of the new_picture().
Set discont state after the new_picture() call

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5368>
2023-09-20 18:44:42 +00:00
Sebastian Dröge 72742dee30 mxfdemux: Check number of channels for AES3 audio
Only up to 8 channels are allowed and using a higher number would cause
integer overflows when copying the data, and lead to out of bound
writes.

Also check that each buffer is at least 4 bytes long to avoid another
overflow.

Fixes ZDI-CAN-21661, CVE-2023-40475

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

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5362>
2023-09-20 15:40:07 +00:00
Sebastian Dröge ce17e968e4 mxfdemux: Fix integer overflow causing out of bounds writes when handling invalid uncompressed video
Check ahead of time when parsing the track information whether
width, height and bpp are valid and usable without overflows.

Fixes ZDI-CAN-21660, CVE-2023-40474

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

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5362>
2023-09-20 15:40:07 +00:00
Nicolas Dufresne ff91a3d8d6 h265parser: Fix possible overflow using max_sub_layers_minus1
This fixes a possible overflow that can be triggered by an invalid value of
max_sub_layers_minus1 being set in the bitstream. The bitstream uses 3 bits,
but the allowed range is 0 to 6 only.

Fixes ZDI-CAN-21768, CVE-2023-40476

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

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5364>
2023-09-20 14:11:55 +00:00
Piotr Brzeziński 9cbe9a52fe vtenc: Fix deadlock after GST_FLOW_ERROR is received on frame push
This was easy to trigger when testing with e.g. vtenc ! vtdec ! glimagesink and closing the sink via window button,
causing GST_FLOW_ERROR to be received by the output loop, stopping it with the queue still full. This made the
enqueue_buffer() callback to lock waiting for space in our queue, while handle_frame() was waiting for the internal
VideoToolbox queue to free up, so that VTCompressionSessionEncodeFrame could finish. As the output loop was not
running, both functions waited forever.

Fixed by 1) immediately emptying our queue when GST_FLOW_ERROR is received (like we already did with _FLUSHING)
and 2) unconditionally setting the flushing flag in finish_encoding() when it sees the output loop stopped because
of GST_FLOW_ERROR, so that enqueue_buffer() will immediately discard any new frames coming out of VideoToolbox.
Both of those make sure we never run into the both-queues-full scenario.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5303>
2023-09-20 13:10:02 +00:00
Seungha Yang d9a89cce06 d3d12decoder: Add support for D3D11 interop
As a short-term solution before full d3d12 rendering feature,
copy decoded d3d12 texture to shared d3d11 texture in order to use
existing various d3d11 implementations such as conversion, resizing,
and videosink.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5356>
2023-09-20 10:34:54 +00:00
Seungha Yang 2aa88033b2 d3d11memory: Allow CreateSharedHandle() without keyed mutex
For d3d11 resource to be shared with d3d12, keyed mutex shouldn't
be enabled since d3d12 resource does not expose the keyed mutex
interface

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5356>
2023-09-20 10:34:54 +00:00
Seungha Yang bb040ce571 d3d12decoder: Move common part to helper object
Store device at helper object

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5356>
2023-09-20 10:34:54 +00:00
Seungha Yang 44b02e58fc d3d12fence: Check completed value before waiting
If currently completed fence value is larger than target value,
skip waiting.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5356>
2023-09-20 10:34:54 +00:00
Hugues Fruchet 42c65cc765 waylandsink: Fix cropping for video with non-square aspect ratio
Padding of unaligned content is still visible at right with some aspect-ratio.
Fix this by giving the original content resolution to wp_viewport_set_source()
instead of pixel aspect ratio scaled one.

Fixes !5259

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5346>
2023-09-19 22:56:31 +00:00
Hugues Fruchet 5c307e8d17 gtkwaylandsink: do not use drm dumb pool when importing DMAbuf buffers
There is no need to use DRM dumb pool if buffer to
render is already a DMABuf, just import it and render it.

This fixes a DMAbuf memory leakage when waylandsink downstream
element exports DMABuf while waylandsink is configured to be
DMABuf exporter (drm-device=/drv/dri/card0):

gst-launch-1.0 v4l2src io-mode=4 ! gtkwaylandsink drm-device=/dev/dri/card0

leakage identfied with command:
watch "cat /sys/kernel/debug/dma_buf/bufinfo | grep attached "

Fixes #2729

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5350>
2023-09-19 16:21:58 +00:00
Hugues Fruchet e4bc88492a waylandsink: do not use drm dumb pool when importing DMAbuf buffers
There is no need to use DRM dumb pool if buffer to
render is already a DMABuf, just import it and render it.

This fixes a DMAbuf memory leakage when waylandsink downstream
element exports DMABuf while waylandsink is configured to be
DMABuf exporter (drm-device=/drv/dri/card0):

gst-launch-1.0 v4l2src io-mode=4 ! waylandsink drm-device=/dev/dri/card0

leakage identfied with command:
watch "cat /sys/kernel/debug/dma_buf/bufinfo | grep attached "

Fixes #2729

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5350>
2023-09-19 16:21:58 +00:00
Seungha Yang 39aca8a096 d3d11vp9dec: Fix critical warning
Don't query GPU vendor using null device.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5353>
2023-09-19 13:09:57 +00:00
Seungha Yang e769ae3dbe d3d12decoder: Add support for d3d12 output
... and enable zero-copy decoding if downstream supports d3d12 memory

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5345>
2023-09-19 08:52:04 +00:00
Seungha Yang ff7bde06f2 d3d12decoder: Use GstD3D12BufferPool
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5345>
2023-09-19 08:52:04 +00:00
Seungha Yang 884f4122b5 d3d12decoder: Use global copy queue and fence value
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5345>
2023-09-19 08:52:04 +00:00
Seungha Yang 1a7390c85c d3d12: Remove unused debug category
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5345>
2023-09-19 08:52:04 +00:00
Seungha Yang 6c9d023861 d3d12: Add d3d12download element
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5345>
2023-09-19 08:52:04 +00:00
Seungha Yang 8965b1e92f d3d12: Add GstD3D12BufferPool
Adding d3d12 specific bufferpool impl.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5345>
2023-09-19 08:52:04 +00:00
Seungha Yang c0572f8749 d3d12memory: Add GstD3D12AllocationParams struct
Will be used for buffer pool configuration. And update C++ helper
to reduce the number of required arguments

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5345>
2023-09-19 08:52:04 +00:00
Seungha Yang 73744df6e4 d3d12memory: Make d3d12memory CPU accessible
Add support for gst_memory_{map,unmap} without GST_MAP_D3D12 flag

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5345>
2023-09-19 08:52:04 +00:00
Seungha Yang 68cfb64ae3 d3d12: Fix d3d12sdklayer setup and d3d12device debug category
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5345>
2023-09-19 08:52:04 +00:00
Víctor Manuel Jáquez Leal 4c5e17308e vaallocator: don't update size in info for single plane images
Don't update info's size with the VA image reported data size for single plane
images, since drivers might allocate bigger space than the strictly required to
store the image, but when we dump the buffer as is (using filesink, for example)
the produced stream is corrupted. For multi-plane images video meta is required
to read/write them.

We updated info's size because gstreamer-vaapi did it too, but the reason to
update it there was for uploading and rendering surfaces (commit c698a015).

Furthermore, this patch adds an error message if the allocated data size for the
image by the driver is lesser than the expected because it would be a buggy
driver.

Fixes: #2959
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5308>
2023-09-18 14:55:10 +00:00
Víctor Manuel Jáquez Leal b5de07a8c5 msdk: meson: don't warn deprecated symbols
Since it's impossible to not to use any because any possible version mismatch
between the header and the runtime, such in the case of the denoise structure.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5283>
2023-09-18 09:30:33 +00:00
Víctor Manuel Jáquez Leal b3b2f3016c msdkdec: fix method declaration signature
Thus silencing a compilation warning.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5283>
2023-09-18 09:30:33 +00:00
Seungha Yang d849e238fe d3d12: Add AV1 decoder
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4161>
2023-09-17 18:53:39 +09:00
Seungha Yang 10bda3a12a d3d12: Add VP9 decoder
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4161>
2023-09-17 18:53:39 +09:00
Seungha Yang fb27733dd8 d3d12: Add H.265 decoder
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4161>
2023-09-17 18:53:39 +09:00
Seungha Yang 734dd50879 d3d12: Add H.264 decoder
Adding Direct3D12 h264 decoder

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4161>
2023-09-17 18:53:24 +09:00
Seungha Yang 2c058b3b99 d3d11decoder: Port to GstDxva
Use new DXVA baseclass

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4161>
2023-09-17 18:30:07 +09:00
Seungha Yang 729c11cb0c dxva: Add DXVA decoder baseclass implementation
Extract Direct3D version independent common DXVA logic from d3d11
decoder so that it can be used by the other APIs (D3D9 and D3D12)
as well

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4161>
2023-09-17 18:30:03 +09:00
Seungha Yang 48a0c01570 h264decoder: Update latency dynamically
The actual number of reorder frames is unknown
unless frame reordering is disabled
(e.g., POC type 2 or constrained-* profiles).
Also derived maximum DPB size or max_num_reorder_frames in VUI
is not the upper bound of output delay.

Fixes: https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/2702
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5326>
2023-09-17 01:43:29 +09:00
Seungha Yang bd25c2738e nvdecoder: Copy output frame if needed
Even if decoder is negotiated with CUDA memory feature, if downstream
proposed no buffer pool, assume that the pool size is unknown.
And disable zero-copy if there's no more free output surface.
Or, in case of reverse playback, always copy frames.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5338>
2023-09-17 00:15:47 +09:00
Seungha Yang c5a5dcdf18 nvh265dec: Reconfigure decoder on max-dpb-size change
Decoder should create new picture pool for larger DPB size

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5338>
2023-09-16 23:00:11 +09:00
Seungha Yang 85f01d7709 d3d11h265dec: Reconfigure decoder on max-dpb-size change
Decoder should create new picture pool for larger DPB size

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5338>
2023-09-16 22:56:03 +09:00
Seungha Yang 6785c7d378 av1parser: Fix segmentation params update
Even if the segmentation feature value is not updated,
the parsed "segmentation_update_map" and "segmentation_temporal_update"
values should not be cleared as it's referenced during lower
level bitstream parsing. Also, don't use assert() in parser
unless it's clearly impossible condition.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5334>
2023-09-16 07:50:41 +09:00