Commit graph

302 commits

Author SHA1 Message Date
Matthew Waters b8a5e7a4e4 applemeida/texturecache: remove unused variable
Fixes:

../sys/applemedia/videotexturecache.m:71:20: error: variable 'features' set but not used [-Werror,-Wunused-but-set-variable]
  GstCapsFeatures *features;
                   ^

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2046>
2022-03-28 10:30:23 +00:00
Matthew Waters 3ffbb66593 applemedia/corevideobuffer: remove unused variable
Fixes:

../sys/applemedia/corevideobuffer.c:209:19: error: variable 'video_meta' set but not used [-Werror,-Wunused-but-set-variable]
    GstVideoMeta *video_meta;
                  ^

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2046>
2022-03-28 10:30:23 +00:00
Matthew Waters b8f83c9d14 applemedia/iosgl: remove unused variable
Fixes:

../sys/applemedia/iosurfaceglmemory.c:219:41: error: variable 'texfmt' set but not used [-Werror,-Wunused-but-set-variable]
    GLuint tex_id, tex_target, texifmt, texfmt;
                                        ^

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2046>
2022-03-28 10:30:23 +00:00
Matthew Waters 49e452525d vtdec: remove unused variable
Fixes:

../sys/applemedia/vtdec.c:611:35: error: variable 'output_flags' set but not used [-Werror,-Wunused-but-set-variable]
  VTDecodeFrameFlags input_flags, output_flags;
                                  ^

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2046>
2022-03-28 10:30:23 +00:00
Matthew Waters edd9ec0456 avsamplevideosink: remove unused variable
Fixes

../sys/applemedia/avsamplevideosink.m:80:20: error: variable 'gstelement_class' set but not used [-Werror,-Wunused-but-set-variable]
  GstElementClass *gstelement_class;
                   ^

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2046>
2022-03-28 10:30:23 +00:00
Matthew Waters 651cd8e0bb avfassetsrc: fix unused-but-set warning
../sys/applemedia/avfassetsrc.m:1014:12: error: variable 'caps' set but not used [-Werror,-Wunused-but-set-variable]
  GstCaps *caps;
           ^

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2046>
2022-03-28 10:30:23 +00:00
Andrew Pritchard 432354e6d4 Fix GstAmcSurfaceTexture segfault
Check that `self` and `self->callback` are defined. `self` can be set to
`NULL` in `remove_listener`, and `self->callback` can be set to `NULL`
inside `gst_amc_surface_texture_jni_set_on_frame_available_callback`.
This can cause a segfault since the Java object can outlive the C
object, and call the callback after `remove_listener` is called.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2024>
2022-03-28 04:44:21 +00:00
Nicolas Dufresne c9d8b8a972 v4l2codecs: Detect missing M2M_HOLD_CAPTURE_BUF
Produce an error if we try to use the feature of holding capture buffer
but it is not supported by the driver. Ingoring this can lead to stalls
as the driver will run-out of capture buffer to decode into. This
affects slice decoders but also split-field interlaced decoding.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2009>
2022-03-25 21:40:28 +00:00
Nicolas Dufresne efa360ce82 v4l2codecs: h264: Set other field poc if available
Whenever the other field POC is available, pass it back to the
driver. This should not be strictly required, but it makes things
easier to debug and more forgiven.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2009>
2022-03-25 21:40:28 +00:00
Nicolas Dufresne dcd62c35f0 v4l2codecs: Trace request by it FD
This helps when crossing the debug logs with the kernel logs.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2009>
2022-03-25 21:40:28 +00:00
Nicolas Dufresne d24dc74170 v4l2codecs: h264: Fix dpb entry flag FLAG_FIELD
The logic to guess back this value was broken. Use the value
now saved into the picture instead. This was tested using
LibreELEC patched 5.15 kernel, and fixed the interlaced decode
issues.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2009>
2022-03-25 21:40:28 +00:00
Thibault Saunier 25819c41fb navigation: Add support for key Modifiers in all relevant events
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2010>
2022-03-25 15:16:03 +00:00
He Junyan b2a00dff07 va: h265dec: Fix a crash because of missing reference frame.
Some problematic H265 stream may miss the reference frame in the DPB,
and get some message like: "No short term reference picture for xxx".
So there may be empty entries in ref_pic_list0/1 when passing to
decode_slice() function of sub class. We need to check the NULL pointer.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2018>
2022-03-25 13:12:46 +00:00
Seungha Yang 769800ad5f qsvencoder: Clear caps after debug print
Otherwise debug function will print (null) for alread cleared pointer

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2012>
2022-03-24 02:55:49 +09:00
Seungha Yang 188382ca9a qsvh264enc: Fix profile and level setting in codec data
The profile field in SPS is located after header byte

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2012>
2022-03-24 02:55:31 +09:00
Seungha Yang 60735deded nvcodec: Add new Direct3D11/CUDA mode encoder implementation
Adding new encoder elements nvd3d11{h264,h265}enc for Direct3D11
input support and re-written nvcuda{h264,h265}enc elements.
Newly writeen elements have some differences compared with old
nv{h264,h265}enc including non-backward compatible changes.

* RGBA is not a supported input format any more:
  New elements will support only YUV formats to avoid implicit conversion
  done by hardware. Ideally it should be done by upstream element
  in order to have more control on it. Moreover, RGBA support can cause
  redundant RGBA -> YUV conversion if multiple encoders are
  used for the same RGBA input
* Subsampled planar format support is dropped:
  I420 and YV12 format are not supported formats for Direct3D11.
  Although it's supported in CUDA mode, it's not a hardware friendly
  memory layout and it will waste GPU memory since UV planes
  will have large padding due to the memory layout requirement of NVENC.
* GL support is dropped: Similar to the RGBA case,
  GL support in encoder would be suboptimal if GL input is
  used by multiple encoders, because each encoder will copy GL memory
  into CUDA memory.
  Upstream cudaupload element can be used for GL <-> CUDA
  interop instead.
* No more pre-allocation of encoder input surfaces. New implementation
  will use input CUDA memory without copy (zero-copy) or
  will copy into a NVENC's input buffer struct in case of
  system memory input.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1997>
2022-03-23 13:48:53 +00:00
Vivienne Watermeier 6c2f6c3bd4 all: Use new navigation interface and API
Use and implement the new navigation interface in all relevant sink elements,
and use API functions everywhere instead of directy accessing the event structure.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1633>
2022-03-23 13:14:52 +00:00
Tong Wu 2a703678c0 msdkenc: add macro definitions to avoid the gst-inspect error
Since the strings are empty for GST_MSDK_CAPS_MAKE_WITH_DMABUF_FEATURE
and GST_MSDK_CAPS_MAKE_WITH_VA_FEATURE, when excuting
gst-inspect-1.0.exe msdkh265enc, there will be convert static caps error
because of the extra semicolon between two empty strings. Now macro
definitions are added to avoid this issue.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2004>
2022-03-23 04:34:06 +00:00
Mengkejiergeli Ba d8ab85c3ef msdkdec: Check width and height of mfxVideoParam before allocation
DecodeHeader must be called to fill the mfxVideoParam before allocation,
and thus the check for width and height in mfxVideoParam is necessary.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1817>
2022-03-22 05:22:09 +00:00
Benjamin Gaignard 98cb44ffc6 v4l2codecs: Fix memory leak
Free pending_requests array when releasing decoder to avoid memory leak

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2000>
2022-03-21 16:06:05 +00:00
Daniel Almeida 9a364464f0 av1decoder: Sync duplicate_picture with VP9 one
Pass the current frame to the duplicate_picture callback. This makes it easier
to set the frame's output_buffer if we already have one available. Also
documented that unlike VP9, it is not optional to implement this as the
picture will populate the DPB if it is a key-frame. To ensure this, remove the
default implementation.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1992>
2022-03-21 15:10:01 +00:00
Seungha Yang 0c6125bad6 meson: va: Define GST_USE_UNSTABLE_API
Remove extra_c_args which is not defined in this meson file at all,
and define GST_USE_UNSTABLE_API to avoid build warnings

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1999>
2022-03-21 22:17:00 +09:00
Jakub Adam 90eadae350 d3d11: Fix some typos
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1985>
2022-03-19 00:19:41 +00:00
Jakub Adam df55700f44 d3d11screencapturesrc: Allow capturing screen sub-area
Adds crop-x, crop-y, crop-width, crop-height properties specifying the
screen area to capture.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1932>
2022-03-18 13:56:51 +01:00
Seungha Yang c08ce58753 nvcodec: Move CUDA <-> GL, D3D11, NVMM copy function to utils
This method can be used in other elements as well.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1945>
2022-03-15 21:51:50 +00:00
Seungha Yang b3df58add1 nvh265sldec: Add support for delayed output
Delay 4 frames in case of non-live to improve throughput

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1937>
2022-03-15 21:08:06 +00:00
Seungha Yang e270e2967f nvenc: Fix deadlock because of too strict buffer pool size
The pool size might need to be larger than encoding surface pool size.
Also, because we always copy input frame into internal CUDA memory,
there's no reason to restrict max size of buffer pool.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1939>
2022-03-12 16:44:44 +00:00
He Junyan 50a481939d va: Fix a regression because of "Invert video codec frame dependency".
1. Always set the according GstVaH264EncFrame pointer when GstVideoCodecFrame
   pointer is assigned, which can make the logic safe.
2. Fix the forgotten change in _sort_by_frame_num. Its input pointer now is
   GstVideoCodecFrame type.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1935>
2022-03-12 15:20:19 +00:00
Seungha Yang aa476452fb codecs: Rename picture clear functions
Our convention for clear method is gst_clear_foo_bar().

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1897>
2022-03-11 20:20:17 +00:00
Seungha Yang 423111480c nvh265sldec: Always fill SPS/PPS related parameters
Address compare was not a valid approach since it works
only if SPS/PPS id are changed. Otherwise it will always point to
the same address of member variables of h265parser.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1931>
2022-03-11 16:14:14 +00:00
Corentin Damman 1fb3e35708 cudamemorycopy: add D3D11 resource support
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1807>
2022-03-10 18:08:10 +00:00
Corentin Damman 1568db2c3e cudacontext: find associated DXGI Adapter LUID
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1807>
2022-03-10 18:08:10 +00:00
Corentin Damman 895f11401d cudautils: add support of D3D11 resource as Cuda graphics resource type
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1807>
2022-03-10 18:08:10 +00:00
Corentin Damman f76ecf1e63 cudaloader: add D3D11 API
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1807>
2022-03-10 18:08:10 +00:00
Seungha Yang 5d298b98da nvh264dec,nvh265dec: Fix broken key-unit trick and reverse playback
On GstVideoDecoder::{drain,flush}, we send null packet with
CUVID_PKT_ENDOFSTREAM flag to drain out decoder. Which will
reset CUVID parser as well.
To continue decoding after the drain, the next input buffer
should include sequence headers otherwise CUVID parser will
not report any decodeable frame.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1911>
2022-03-10 12:40:05 +00:00
Víctor Manuel Jáquez Leal 838fe24e78 vah264enc: Invert video codec frame dependency.
Instead of using GstMiniObject to hold H264 frame, now it uses a plain
structure. Besides, instead of holding a reference to
GstVideoCodecFrame, the H264 frame structure is set as a
GstVideoCodecFrame user data.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1856>
2022-03-09 12:57:30 +00:00
Seungha Yang 496b77e6aa cudamemorycopy: Fix GL resource leak
Clear GL resources on stop()

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1896>
2022-03-08 18:02:25 +00:00
Seungha Yang 34c6063769 decklink: Update SDK version to 12.2.2
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1883>
2022-03-08 10:16:29 +00:00
Seungha Yang 4aa516f305 cudamemorycopy: Remove texture-target caps field
It's GL specific field, and we can remove it unconditionally

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1865>
2022-03-07 19:05:29 +00:00
Seungha Yang e5132a8508 cudaupload,cudadownload: Add support for dGPU NVMM
Implement NVMM <-> CUDA, GL, SYSTEM memory conversion. Jetson is
not supported yet. Note that NVMM <-> GL interop on Jetson platform
is supported by GstGL

Some example pipelines are:
- Convert NVMM to GstGL memory
  nvv4l2decoder ! "video/x-raw(memory:NVMM)" ! cudadownload ! "video/x-raw(memory:GLMemory)" ! glimagesink

- Upload system memory to NVMM and encode
  video/x-raw,format=NV12 ! cudaupload ! "video/x-raw(memory:NVMM)" ! nvv4l2h264enc

- Convert NVMM to GstCUDA memory and encode
  nvvideoconvert ! "video/x-raw(memory:NVMM)" ! cudaupload ! "video/x-raw(memory:CUDAMemory)" ! nvh264enc

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1865>
2022-03-07 19:05:29 +00:00
Víctor Manuel Jáquez Leal 0c7fe80387 va: encoder: Don't preallocate reconstruct buffers.
It's not required by VA to register the reconstruct buffers at context
creation, just as in decoders.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1857>
2022-03-07 16:31:41 +00:00
Seungha Yang a63d1cf4c4 cudamemorycopy: Fix build when gl is disabled
Fixes: https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/issues/1707
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1868>
2022-03-07 10:22:21 +00:00
Mengkejiergeli Ba c9aa529484 msdkdec: Fix to not trigger SFC scaling when vpp at downstream
When there is vpp scaling downstream, we need to make sure SFC is not
triggered because vpp may fall into passthrough mode which causes
the decoder negotiation to create src caps with vpp scaled width/height.

This patch includes bitstream's original size in first query with
downstream in gst_msdkdec_src_caps, which is the same for what we do for
color format in this query. This is to ensure SFC scaling starts to
work only when downstream directly asks for a different size instead of
through vpp.

Note that here SFC scaling follows the same behavior as msdkvpp:
if user only changes width or height, e.g. dec ! video/x-raw,width=xx !,
the height will be modified to the value which fits the original DAR.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1838>
2022-03-07 07:26:40 +00:00
Seungha Yang 30ddb0cd97 nvcodec: Add missing null check in context sharing code
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1834>
2022-03-06 15:39:04 +00:00
Seungha Yang c31bf2db4d nvcodec: Refactor cudaupload/download and add support for GL memory
* Implement new baseclass GstCudaMemoryCopy to remove duplicated
  cudaupload/download code
* Add support for CUDA <-> GL memory conversion via cudaupload/download

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1834>
2022-03-06 15:39:04 +00:00
Seungha Yang 111b2c3f53 nvcodec: Refactor GstCudaMemory abstraction
* Hide GstCudaMemory member variables
* Make GstCudaAllocator object GstCudaContext independent
* Set offset/stride of memory correctly via video meta
* Drop GST_BUFFER_POOL_OPTION_VIDEO_ALIGNMENT support.
  This implementation actually does not support custom alignment
  because we allocate device memory via cuMemAllocPitch
  of which alignment is almost uncontrollable

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1834>
2022-03-06 15:39:04 +00:00
Seungha Yang ad0e7fca14 nvcodec: Refactor basetransform subclasses
* cudaupload/download
  - Specify only formats actually we can deal with
    nvcodec elements, not all video formats
  - Supports CUDA output for download and input for upload in order
    to make passthrough possible, like other upload/download elements.
* cudabasetransform
  - Reset conversion element if upstream CUDA memory
    holds different CUDA context and the element can accept it.
    This is the same behavior as corresponding d3d11 filter elements.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1834>
2022-03-06 15:39:04 +00:00
Seungha Yang 89bbcf0061 cudabufferpool: Move GstCudaContext object to public member
... so that plugins can understand assosicated cuda context with the
pool.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1834>
2022-03-06 15:39:04 +00:00
Seungha Yang c8a1c953d8 cudacontext: Require explicit gpu id instead of auto (-1)
Sync up with GstD3D11Device implementation. The auto stuff should
be handled in context sharing step, not device creation.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1834>
2022-03-06 15:39:04 +00:00
Seungha Yang 1b9274307a nvcodec: Indent update
... to prevent gnu indent version dependent diffs.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1834>
2022-03-06 15:39:04 +00:00