Commit graph

118024 commits

Author SHA1 Message Date
Michiel Westerbeek
03bf8e9386 video-scaler, audio-resampler: downgrade 'can't find exact taps' to debug
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5369>
2023-09-20 16:31:47 +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
Maksym Khomenko
5b252a1511 appsrc: use macros for getters/setters
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5321>
2023-09-20 08:54:01 +00:00
Maksym Khomenko
60591960c3 appsink: add max-time and max-buffers properties
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5321>
2023-09-20 08:54:01 +00:00
Maksym Khomenko
4c13ccec16 appsrc: extract buffering level calculations
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5321>
2023-09-20 08:54:01 +00:00
Jordan Petridіs
aa515b0276 handle-subprojects-cache: Remove old gst-build path
this was a leftover from the monorepo transition.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5347>
2023-09-20 07:42:18 +00:00
Piotr Brzeziński
f3d98341e3 qml: Fix leftover reference to gstqsgtexture
Made it impossible to build with qmake as per the readme. The file was renamed to gstqsgmaterial a while ago.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5357>
2023-09-19 23:55:45 +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
Olivier Blin
4b891639da pulsedeviceprovider: fix incorrect usage of GST_ELEMENT_ERROR
The provider is not a GStreamer element.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5349>
2023-09-19 14:13:49 +02: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
Leif Andersen
60b93fd593 docs: Fix markdown link in contribution page
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5348>
2023-09-18 22:44:25 -04:00
Leif Andersen
2fb819a549 docs: Meson has deprecated the implicit setup command
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5342>
2023-09-18 15:32:15 +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
Michiel Westerbeek
0705de9f12 ges: decreased log level for missing ->init method
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5339>
2023-09-17 19:19:19 +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
7f99fe243e h264decoder: Update gir
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5326>
2023-09-17 02:44:08 +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
Seungha Yang
3ac2690807 h265decoder: Fix DPB overflow
If DPB is full already, GstH265Decoder::new_picture() might fail if
subclass uses fixed size picture pool and its size is equal to the DPB
size. Call the new_picture() after DPB is cleared in gst_h265_decoder_dpb_init()

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5333>
2023-09-15 18:26:31 +00:00
Matthew Waters
86f00367fc androidmedia/enc: handle codec-data before popping GstVideoCodecFrames
Issue is that when amc was producing a codec-data buffer, a
GstVideoCodecFrame was being popped off the internal queue.  This meant
that the codec-data was being associated with the first input frame and
the second (first encoded buffer) output buffer with the second input
frame.  At the end (assuming one input produces one output which seems
to hold in my testing and how the encoder is currently implemented)
there would be an input frame missing and would be pushed without any
timing information.  This would lead to e.g. muxers rejecting the buffer
without PTS and failing to mux.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5330>
2023-09-15 17:47:17 +03:00
Matthew Waters
bec57df2f8 androidmedia/enc: add fixme log about partial frames
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5330>
2023-09-15 13:46:47 +00:00
Mengkejiergeli Ba
b3e7404312 msdkvpp: Add compute scaling mode
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5128>
2023-09-14 13:50:48 +08:00