Commit graph

3256 commits

Author SHA1 Message Date
Seungha Yang
700c00eda3 d3d12decoder: Fix potential use after free
A DPB buffer held by codec picture object may not be writable
at the moment, then gst_buffer_make_writable() will unref passed buffer.

Specifically, the use after free or double free can happen if:
* Crop meta of buffer copy is required because of non-zero
  top-left crop position
* zero-copy is possible with crop meta
* A picture was duplicated, interlaced h264 stream for example

Interlaced h264 stream with non-zero top-left crop position
is not very common but it's possible configuration in theory.

Thus gst_buffer_make_writable() should be called with
GstVideoCodecFrame.output_buffer directly.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6706>
2024-04-22 13:28:06 +00:00
Seungha Yang
b9e51facdd d3d11decoder: Fix potential use after free
A DPB buffer held by codec picture object may not be writable
at the moment, then gst_buffer_make_writable() will unref passed buffer.

Specifically, the use after free or double free can happen if:
* Crop meta of buffer copy is required because of non-zero
  top-left crop position
* zero-copy is possible with crop meta
* A picture was duplicated, interlaced h264 stream for example

Interlaced h264 stream with non-zero top-left crop position
is not very common but it's possible configuration in theory.

Thus gst_buffer_make_writable() should be called with
GstVideoCodecFrame.output_buffer directly.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6706>
2024-04-22 13:28:06 +00:00
Edward Hervey
6d228c420c tsdemux: Disable smart program update
The goal of this code was, for programs which were updates (i.e. adding/removing
streams but not completely changing) to allow dynamic addition/removal of
streams without completely removing everything.

But this wasn't 100% tested and there are a bunch of issues which make it fail
in plenty of ways.

For now disable that feature and force the legacy "add all pads again and then
remove old ones" behaviour to make it switch.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6651>
2024-04-22 11:56:30 +00:00
Seungha Yang
40f7d7f1f7 d3d11device: Add device-removed-reason property
In addition to device removed status monitoring in gst_d3d11_result()
method, if ID3D11Device4 interface is available,
an event handle will be used for device removed status update.
And "device-removed" signal is removed since applications can monitor
the device removed status via gobject notify

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6699>
2024-04-21 12:06:03 +00:00
Seungha Yang
b12b04eeef d3d12utils: Fix documentation
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6699>
2024-04-21 12:06:03 +00:00
Seungha Yang
6efeeb8300 d3d12device: Add device-removed-reason property
Adding new property in order to notify users of device removed status.
Once device removed status is detected, application should release
all ID3D12Device objects corresponding to the adapter, including
GstD3D12Device object. Otherwise D3D12CreateDevice() call for the
adapter will fail.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6699>
2024-04-21 12:06:03 +00:00
Seungha Yang
b9feb47de5 mediafoundation: Fix infinite loop in device provider
Initialize source state with GST_MF_DEVICE_NOT_FOUND to terminate
loop immediately if no available capture device is available

Fixes: https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/3492
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6704>
2024-04-21 19:21:54 +09:00
Alexander Slobodeniuk
926d5366b9 d3d11device: protect device_lock vs device_new
It seems that when D3D11CreateDevice collides in time
with other D3D11 calls, in particular the proccess of
creating a shader, it can corrupt the memory in the driver.
D3D11 spec doesn't seem to require any thread safety from
D3D11CreateDevice. Following MSDN, it is supposed to be called
in the beginning of the proccess, while GStreamer calls it with each
new pipeline.
Such crashes in the driver were frequently reproducing on the
Intel UHD 630 machine.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6686>
2024-04-20 11:22:41 +00:00
Alexander Slobodeniuk
8e0046a738 tests/d3d11: add concurrency test for gstd3d11device
We suspect that it's not thread safe to just create and
destroy the device from any thread, particularly because
of D3D11CreateDevice, that is not documented as thread-safe.
While D3D11CreateDevice is usually protected from outside
by the gst_d3d11_ensure_element_data, it still can cross
with the Release() method of another device.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6686>
2024-04-20 11:22:41 +00:00
Elliot Chen
13e17b9149 gstplay: query duration again if previous query failed
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6668>
2024-04-19 20:49:03 +00:00
Seungha Yang
5179cbccfa d3d12testsrc: Use shared 11on12 device
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6697>
2024-04-20 04:16:48 +09:00
Seungha Yang
045c9ac6b9 dwrite: Use shared 11on12 device
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6697>
2024-04-20 04:16:48 +09:00
Seungha Yang
cd97275a19 d3d12device: Hold d3d11on12 device to be shared
d3d11on12 device seems to be occupying a bit of GPU memory
Hold the instance in GstD3D12Device so that it can be shared

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6697>
2024-04-20 04:16:41 +09:00
Seungha Yang
8e4fe98361 d3d12videosink: Handle mouse double click and modifier
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6693>
2024-04-19 16:11:30 +00:00
Seungha Yang
dabce9635d d3d12videosink: Disconnect window's signal on dispose
Same as the commit of 7b69d1758f
but for d3d12videosink.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6692>
2024-04-19 21:25:06 +09:00
Seungha Yang
6659bd6362 d3d12videosink: Handle external HWND's mouse/keyboard events
OS will not propagate the event to child HWND if it's handled by
the parent. Thus, navigation event should be handled by parent HWND's
event handler.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6692>
2024-04-19 21:24:52 +09:00
Sebastian Dröge
d42ee6e48c vavp9enc: Preserve PTS and other frame metadata
See also https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4150

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6680>
2024-04-19 07:18:35 +00:00
Seungha Yang
ba443e7a64 webview2: Handle double click and modifier
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6491>
2024-04-18 20:19:38 +00:00
Seungha Yang
e0def6b355 d3d11videosink: Handle double click and modifier
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6491>
2024-04-18 20:19:38 +00:00
Hou Qi
4dfdaf67db waylandsink: config buffer pool with query size when propose_allocation
If propose_allocation comes before set_caps, self->video_info
has not been extracted from caps and self->video_info.size is 0.
It causes buffer pool fail to set config . So need to use info
size got from query instead when propose_allocation.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6666>
2024-04-18 18:34:30 +00:00
Sebastian Dröge
750d53d7e0 rsvgdec: Remove unused GObject::finalize implementation
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6613>
2024-04-18 17:45:43 +00:00
L. E. Segovia
b8db473955 rsvgdec: Fix uses of librsvg functions deprecated since 2.52
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6613>
2024-04-18 17:45:43 +00:00
Sebastian Dröge
5d876ff774 rsvgdec: Negotiate resolution with downstream and scale accordingly
Prefer the resolution given by the input but if downstream request a
specific resolution then scale to this without regards to the aspect
ratio.

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

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6613>
2024-04-18 17:45:43 +00:00
Nicolas Dufresne
e34f765a7e v4l2codecs: Don't unref allocation query caps
The caps obtained from parsing the allocation query is borrowed and
should not be unreffed. This fixes criticals assertion introduced in
1.24.1.

(gst-launch-1.0:242): GStreamer-CRITICAL **: 19:48:02.667:
    gst_mini_object_unref: assertion 'GST_MINI_OBJECT_REFCOUNT_VALUE (mini_object) > 0' failed

Fixes: 5189e8b956 ("v4l2codecs: decoders: Add DMA_DRM caps support")
Closes #3462

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6679>
2024-04-18 06:13:17 +00:00
Mengkejiergeli Ba
49dee23e65 msdk: Add main-422-12 profile to hevc
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6591>
2024-04-17 19:31:09 +00:00
Jan Schmidt
26acd70c74 dvbsubenc: fixed some memory leaks and a crash
Fix leaks of internal GstBuffers, and a crash if subtitle segments end
up empty.

Based on a patch by Jurijs Satcs <jurijs.satcs@veset.tv>

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6661>
2024-04-17 11:37:49 +00:00
Alexander Slobodeniuk
b46383bf5e d3d11converter: fix documentation for converter_new ()
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6665>
2024-04-16 23:30:51 +02:00
Seungha Yang
a7fe79c4de mediafoundation: Fix device enumeration
Do not stop device enumerate even if a device could not be opened.
Otherwise the other devices listed after the failed device will not be
reported by device provider

Fixes: https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/3460
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6598>
2024-04-15 14:52:32 +00:00
Tim-Philipp Müller
60ac6d0883 tests: fix possible libscpp build failure in gst-plugins-bad
../subprojects/gst-plugins-bad/tests/check/libs/gstlibscpp.cc:41:
fatal error: gst/mpegts/gstmpegts-enumtypes.h: No such file or directory

Could only pass the needed deps to the libscpp test, but gets
messier to maintain, so let's at it for consistency.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6643>
2024-04-15 11:41:51 +00:00
Philippe Normand
97d4c56c8f tests: webrtcbin: Fix repaired-stream-id handling in simulcast test
The test was attempting to add the same stream-id extension twice, probably some
unfinished copy/paste.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6615>
2024-04-15 08:43:09 +00:00
Seungha Yang
15434ce51d dwrite: D3D12 integration
Adding d3d12 backend text renderer/blender by using d3d11on12 interop.
And subclassing renderer object per backend (i.e., d3d11, d3d12, and bitmap)

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6620>
2024-04-14 09:55:41 +00:00
Seungha Yang
f6ec4e6256 d3d12overlaycompositor: Add support for d3d12 memory
Don't allocate d3d12 texture if overlay is d3d12 memory already

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6620>
2024-04-14 09:55:41 +00:00
Seungha Yang
13d892d336 d3d12: Move gst_d3d12_buffer_copy_into method to library
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6620>
2024-04-14 09:55:41 +00:00
Seungha Yang
b242f5d2ec d3d12converter: Port to GstD3D12Frame
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6620>
2024-04-14 09:55:41 +00:00
Seungha Yang
cb670f8110 d3d12: Add GstD3D12Frame struct and helper method
Adding GstD3D12Frame struct with map, unmap, and copy methods.
This new struct is equivalent to GstVideoFrame but gst_d3d12_frame_map()
method will extract D3D12 specific resource handles from memory.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6620>
2024-04-14 09:55:41 +00:00
Seungha Yang
8b88fcd18b d3d12memory: Implement copy method
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6620>
2024-04-14 09:55:41 +00:00
Seungha Yang
e597dcdf0d d3d12encoder: Fix buffer pool leak
Add missing buffer pool release

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6628>
2024-04-13 14:55:09 +00:00
Seungha Yang
d002acdd0c d3d11videosink: Fix rendering on keyed mutex enabled handle
As of the commit 69b2e1565c,
keyed mutex will be handled by the memory object.

Fixes: https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/3468
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6600>
2024-04-12 14:46:20 +00:00
Jordan Petridis
c4e0d19f13 fdkaac: Mark the dependency include_type as 'system'
When using v2.0.2 of the subproject, it triggers werror for
unused functions that come from the fdkaac headers.

This avoids errors like the following when werror is set.

```
subprojects/fdk-aac-2.0.2/fdk-aac/FDK_audio.h:757:29: error: ‘FDKlibInfo_lookup’
defined but not used [-Werror=unused-function]
  757 | static FDK_AUDIO_INLINE INT FDKlibInfo_lookup(const LIB_INFO* info,
```

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6611>
2024-04-12 13:18:40 +03:00
Tim-Philipp Müller
9ec99ac6f2 analyticsmeta: fix g-ir-scanner warnings
Fix

 gstanalyticsmeta.c:134: Warning: GstAnalytics: "@instance"
                         parameter unexpected at this location

warning (caused by the extraneous empty line in the doc chunk)
and align function arguments with documentation and header file
(handle -> instance).

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6585>
2024-04-10 00:46:42 +00:00
Seungha Yang
ff754dca79 ccconverter: Fix caps leak and remove unnecessary code
The removed code does the exactly same thing as the below code
except for leaking caps

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6548>
2024-04-09 18:26:18 +00:00
Seungha Yang
0cc206e939 qsvdecoder: Release too old frames
Release too old frames manually.

Fixes: https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/3163
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6583>
2024-04-09 16:49:47 +00:00
Seungha Yang
448a461a40 d3d12converter: Simplify root signature build
D3DX12SerializeVersionedRootSignature() helper method will translate
RS 1.1 into 1.0 version if needed

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6557>
2024-04-08 13:24:20 +00:00
Daniel Morin
0c8e4d4a2c h264parser: maintain API changes
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6540>
2024-04-07 15:25:23 +00:00
Daniel Morin
71659f2545 Revert "h264parse: test - AU align with SEI between frame slices"
This reverts commit 533f814fd9.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6540>
2024-04-07 15:25:23 +00:00
Daniel Morin
e57f561a8e Revert "h264parse: Improved AU boundary detection"
This reverts commit 49f200cb54.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6540>
2024-04-07 15:25:23 +00:00
Daniel Morin
694c6e77b1 Revert "h264parse: Remove dead code"
This reverts commit 141cd38715.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6540>
2024-04-07 15:25:22 +00:00
Daniel Morin
ac3272db40 Revert "h264parse: Fix AU collection"
This reverts commit 495390f63a.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6540>
2024-04-07 15:25:22 +00:00
Daniel Morin
64c2c8d542 Revert "h264parse: Remove un-needed check on SPS state"
This reverts commit 73dedf9a51.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6540>
2024-04-07 15:25:22 +00:00
Daniel Morin
6ff1973b5b Revert "h264parse: use AUD to detect first VCL NAL"
This reverts commit 90a3b63eed.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6540>
2024-04-07 15:25:22 +00:00