Commit graph

842 commits

Author SHA1 Message Date
Seungha Yang b5fb709be7 qsvh265dec: 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
Yinhang Liu 89a6ce105b msdkenc: Fix scale ratio for frame duration
For the calculation of frame duration, the numerator
should be FrameRateExtD, and the denominator should be
FrameRateExtN.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4119>
2023-03-06 13:57:01 +08:00
Piotr Brzeziński 3c739b9b76 vtdec: Correctly retrieve reorder queue length from SPS
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4057>
2023-03-03 19:26:11 +00:00
Yinhang Liu 5c47002d99 msdkvpp: correct the fixated caps for src pad
In src pad, fixate othercaps instead of the NULL result caps

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3999>
2023-03-02 07:21:10 +00:00
Jan Schmidt 47e97251af avfvideosrc: Fix description and trailing whitespace
Minor fix to mention that the element is also useful on MacOS,
and remove some trailing whitespace

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4083>
2023-03-01 20:05:32 +00:00
Jan Schmidt 855e86f6a2 avfvideosrc: Don't wait on main thread for permissions request
Recursively invoking the NSMainLoop can cause crashes in
applications that don't expect it. Instead of waiting for
permission to be granted, move the wait later - until we
actually need device permissions when starting the capture
session. That moves the wait into the streaming thread
instead of the application thread that's setting the pipeline
state to READY.

Instead of a manual state change implementation to open
and close the device, use the basesrc start/stop methods that
are intended for the purpose.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4083>
2023-03-01 20:05:32 +00:00
Seungha Yang 95ca40c4ab d3d11screencapturesrc: Use keyed mutex instead of fence
D3D11 runtime might not support ID3D11Fence, and if so GstD3D11Fence
abstraction will use ID3D11Query instead. However, since the ID3D11Query
requires busy waiting, keyed mutex is better approach.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4094>
2023-03-02 03:03:58 +09:00
Seungha Yang ac869214ad d3d11testsrc: Use keyed mutex for rendering patterns
D2D operations would not flush D3D commands. Use keyed mutex
to synchronize between them. Note that previous code was wrong
(Flush should be called inside of BeginDraw/EndDraw calls)

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4081>
2023-03-01 14:13:14 +00:00
Mengkejiergeli Ba 28e2eccf55 msdkenc: Set pts at handle_frame
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3998>
2023-03-01 01:42:50 +00:00
Seungha Yang 8d7cab1f0d nvcodec: Remove stateful decoders
Use H.264, H.265, VP8, and VP9 stateless decoders unconditionally
and don't register its stateful counterpart

Fixes: https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/1768
Fixes: https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/issues/1621
Fixes: https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/1432
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4015>
2023-02-28 18:42:17 +00:00
Piotr Brzeziński b3830b08fd vtenc: Fix checking for certain CPU variants when running in VMs
These checks were introduced to prevent exposing ARGB64/RGBA64 in the caps
when running on M1 Pro/Max with macOS <13 because of a bug in VideoToolbox.
Unfortunately, the initial buffer size of 15 is too short when running
in a VM - the CPU brand string there looks like "Apple M1 Pro (Virtual)",
which due to its length causes sysctlbyname to return -1, resulting in
broken formats still showing up in the caps.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4080>
2023-02-28 16:00:07 +00:00
Evgeny Pavlov 00988e70ac amfcodec: Initial support of preanalysis and preencoding for AMF encoders
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3847>
2023-02-28 15:04:45 +00:00
Seungha Yang 025adaff4b bad: Update indent
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4023>
2023-02-28 10:12:31 +00:00
Mengkejiergeli Ba 799c6ff860 msdkdec: Check available surfaces when all pre-allocated surfaces are in use
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3439>
2023-02-27 12:22:13 +00:00
Mengkejiergeli Ba 3062f1b6b0 msdkdec: Apply the modified memory allocation logic
We did several things to enable the new memory logic in msdkdec:
(1) We always use video memory for decoder in linux path;
(2) We give negotiated pool to alloc_pool stored in GstMsdkContext which
will be used in callback mfxFrameAllocator:Alloc to alloc surfaces as
MediaSDK needs, and this pool is also available for decoder itself;
(3) We modify decide_allocation process, that is we make pool negotiaion
before gst_msdk_init_decoder to ensure the pool is decided and ready for
use in mfxFrameAllocator:Alloc callback; then we will consider the case
when we need to do the gpu to cpu copy.
(4) In gst_msdkdec_finish_task, we modify the way for copy following the
logic in (3).

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3439>
2023-02-27 12:22:13 +00:00
Mengkejiergeli Ba 75efb204e5 msdkdec: Add a function to create va pool
Add a pool creation function name as 2 for later use which will create
va pool for video memory in linux and keep system pool for windows.
This gst_msdkdec_create_buffer_pool2 will replace gst_msdkdec_create_buffer_pool
when all the memory allocation modifications are ready in the commits after.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3439>
2023-02-27 12:22:13 +00:00
Mengkejiergeli Ba 8459349963 msdkallocator_libva: Rewrite gst_msdk_frame_alloc
Rewrite gst_msdk_frame_alloc and name it as xxx_2 before applying it.
It uses negotiated bufferpool stored in GstMsdkContext to allocate buffers
in the callback MfxFrameAllocator:Alloc, then extract VASurface from buffer,
wrap it as mfxMemIDs and pass these IDs to MediaSDK/oneVPL.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3439>
2023-02-27 12:22:13 +00:00
Mengkejiergeli Ba 4124b8ffd4 msdkdec: Add a function to directly allocate output GstMsdkSurface
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3439>
2023-02-27 12:22:13 +00:00
Mengkejiergeli Ba b2001c1ca5 msdk: Add a bufferpool in GstMsdkContext structure
This alloc_pool is the negotiated pool and will be used in
mfxFrameAllocator:Alloc to create surfaces.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3439>
2023-02-27 12:22:13 +00:00
Mengkejiergeli Ba 3b0d300759 msdkdec: Enable va caps at srcpad
Set caps with VA memory at src pad with a higher priority, then comes
dmabuf caps.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3439>
2023-02-27 12:22:13 +00:00
Seungha Yang 464c51a78a d3d11testsrc: Add circular, blink and ball patterns
Note that circular and ball patterns will be rendered via
Direct2D (and Direct3D11 interop)

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4070>
2023-02-26 22:38:03 +09:00
He Junyan c24c4e9b3f jpegdecoder: fail early if no input caps have been provided
The jpegdecoder class does not implement the ->parse() virtual function,
and we always need to add the jpegparse 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.

Fixes: https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/1829
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4064>
2023-02-25 10:41:53 +08:00
Célestin Marot 81f121f244 d3d11overlaycompositor: fix texture width and height
The dimension of the overlay texture directly corresponds to the size of the overlay **buffer** which is given by its video meta.
The dimension at which the overlay should be displayed directly correspond to the overlay `render_width`and `render_height`.

This match the behavior of glimagesink

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4046>
2023-02-22 15:18:12 +01:00
He Junyan cbbfab0f3b va: jpegdecoder: Do not check SOS state when parsing DRI marker.
According to spec, the JPEG_MARKER_DRI(Restart interval definition)
marker can come before the SOS marker. So we should not check the SOS
state when parsing the DRI marker.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3943>
2023-02-22 11:24:57 +00:00
Seungha Yang 67764a1579 cudaconverter: Rename CUDA kernel function
Changing its name (was too generic) to help GPU tracing via Nsight tool

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4029>
2023-02-21 20:07:31 +00:00
Seungha Yang fd77f088a1 d3d11mpeg2dec: Promote rank to PRIMARY + 1
Make its rank higher than avdec_mpeg2video

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4014>
2023-02-21 17:32:20 +00:00
Seungha Yang 26dd6c5c26 d3d11videosink: Fix rendering on external handle
Partial revert of the commit 068a5c1053.
That introduced size mismatch between internal and external HWND

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4006>
2023-02-20 22:35:27 +00:00
Seungha Yang 2ffc594d96 qsvenc: Simplify property update helpers
Takes lock outside of helper methods, and protect property getter too

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4005>
2023-02-20 21:52:43 +00:00
Seungha Yang 77b3e461db qsvh264enc: Add more encoding options
Adding trellis quantization, frame size, slice size and number of
slices related encoding options

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4005>
2023-02-20 21:52:43 +00:00
Seungha Yang e48869e269 qsv: Use std::once_flag
GLib's once implementation will take mutex every time
in case of non-GCC build

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4005>
2023-02-20 21:52:43 +00:00
Seungha Yang 5eb4253547 qsvh264enc: Optimization for byte-stream to packetized format conversion
Allocate single memory instead of per NAL

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4005>
2023-02-20 21:52:43 +00:00
Seungha Yang b1c14b0357 nvencoder: Fix b-frame encoding on Linux
On Windows, Win32 event handle is used to wait for encoded output,
but it's not available on Linux. We should delay bitstream locking
if encoder returns "need-more-input"

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4004>
2023-02-20 20:49:01 +00:00
Víctor Manuel Jáquez Leal 573eecac30 vah265enc: Use helper to update properties.
This is a continuation of the original patch by
 Mengkejiergeli Ba <mengkejiergeli.ba@intel.com>

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3996>
2023-02-20 18:18:27 +00:00
Mengkejiergeli Ba b5b86a0c98 nvh264dec: Remove type casting
Have fixed type of second_chroma_qp_index_offset as gint8, so remove the type
casting here.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3966>
2023-02-20 16:40:01 +00:00
Mengkejiergeli Ba 735b6af5b9 va: Fix some code defects
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3919>
2023-02-20 16:02:38 +00:00
Mengkejiergeli Ba 4e60e91a05 msdkdec: Fix some lock issue
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3947>
2023-02-20 09:38:09 +08:00
Seungha Yang b88b323e04 nvencoder: Optimization for byte-stream to packetized format conversion
Allocate single memory instead of per NAL

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3992>
2023-02-20 02:15:24 +09:00
Seungha Yang 070a80943d nvencoder: Add support for caption insert
Fixes: https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/1406
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3992>
2023-02-20 02:15:24 +09:00
Seungha Yang b6d371295a nvencoder: Add support for HDR10 static metadata
Insert HDR10 SEIs per IDR

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3992>
2023-02-20 02:15:24 +09:00
Seungha Yang 84ec16c67a nvencoder: Add support for GL memory
preparation to deprecate old NVENC elements

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3992>
2023-02-20 02:15:19 +09:00
Seungha Yang 58373e38f4 nvencoder: Fix critical warning in autogpu mode
If upstream memory is not CUDA, CUDA context will be null.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3992>
2023-02-20 01:49:31 +09: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
Yinhang Liu b5357cbcbc msdkav1enc: fix the category for msdkav1enc debug
The msdkav1enc debug initialized with gst_msdkav1dec_debug,
fix this.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3985>
2023-02-17 16:02:58 +08:00
Seungha Yang f831b92540 nvdecoder: Add support for reconfiguration
Instead of creating new decoder instance per new sequence,
re-use configured decoder instance via cuvidReconfigureDecoder()
API. It will make output surface reusable without re-allocation.
Also, in order for application to be able to reserve higher resolution
output surface, "init-max-width" and "init-max-height" properties are
added to each decoder.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3884>
2023-02-16 17:49:54 +00:00
Seungha Yang eb0fca4180 nvencoder: Reuse input resource
Call input resource map functions (i.e., nvEncRegisterResource,
nvEncUnregisterResource, nvEncMapInputResource, and
nvEncUnmapInputResource) only once and reuse the mapped resources,
instead of per input frame map/unmap

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3884>
2023-02-16 17:49:54 +00:00
Seungha Yang 03425bc702 nvdecoder: Add support for CUDA zero-copy in stateless decoder
Wrap mapped decoder output surface using GstCudaMemory and
output without any copy operation. Also, for application to be able to
control the number of zero-copyable output surfaces,
"num-output-surfaces" property is added.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3884>
2023-02-16 17:49:54 +00:00
Seungha Yang a94af552f5 nvdecoder: Port to C++
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3884>
2023-02-16 17:49:54 +00:00
Seungha Yang 6ddd1713f1 nvdecoder: Reduce render delay to 2 frames
4 frames delay seems to be too high

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3884>
2023-02-16 17:49:54 +00:00
Seungha Yang fa2bb42fda cudaconverter: Use cached texture
... instead of per conversion texture alloc/free

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