Commit graph

108 commits

Author SHA1 Message Date
Nicolas Dufresne
8a1440b3f1 v4l2codecs: vp9: Add missing error checks in decide_allocation
This could otherwise lead to crash.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1402>
2021-11-30 17:11:56 -05:00
Nicolas Dufresne
4ca7f1e014 v4l2codecs: h264: Fix typo in comment
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1387>
2021-11-30 00:28:34 +00:00
Nicolas Dufresne
83933b7772 v4l2codecs: h264: Properly set pic_num/frame_num
The V4L2 uAPI uses pic_num for both PicNum and ShortTermPicNum. It also
doe the same for both FrameNum and LongTermFrameIdx. This change does
not change the fluster score, but fixed a visual corruption noticed
with some third party streams.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1387>
2021-11-30 00:28:34 +00:00
He Junyan
b5c07e11ca va: Use a lock to protect the surface copy by using vpp.
If we use vpp to do the surface copy, its operation is not atomic.
 We need to maintain the filter's context unchanged during the whole
 copy progress.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1373>
2021-11-29 19:25:31 +00:00
He Junyan
954f7cf88c va: Use the GstVaSurfaceCopy of the allocator atomically.
The mem_copy() of the allocator can be called simultaneously from
different threads. We should use atomic pointer operations to create
and use the GstVaSurfaceCopy of the allocator.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1373>
2021-11-29 19:25:31 +00:00
He Junyan
7f31dcf084 va: DMA allocator: Set the copied memory properly when popped from pool.
The current code does not set the copied memory correctly when it is popped
from the surface cache pool.
1. We forget to ref the allocator, which causes the allocator to be freed
   unexpected, and we get a crash later because of the memory violation.
2. We forget to add ref_mems_count, which causes the surface leak because
   the surface can not be pushed back to the cache pool again.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1373>
2021-11-29 19:25:31 +00:00
Daniel Almeida
285695ee52 v4l2codecs: gstv4l2decoder: set minimum sizeimage
Set minimum sizeimage such that there is enough space for any overhead
introduced by the codec.

Notably fix a vp9 issue in which a small image would not have a
bitstream buffer large enough to accomodate it.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1012>
2021-11-29 17:41:19 +00:00
Daniel Almeida
120b96a974 v4l2codecs: gstv4l2codecsvp9dec: implement a render delay
The v4l2 backend support delayed output for performance reasons.
It is then possible to use render delays to queue multiple requests
simultaneously, thus increasing performance.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1012>
2021-11-29 17:41:19 +00:00
Daniel Almeida
ccab90773f v4l2codecs: vp9dec: Implement VP9 v4l2 decoder
Implement a v4l2 based vp9 decoder element based on the preexisting vp8
v4l2 decoder.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1012>
2021-11-29 17:41:19 +00:00
Daniel Almeida
c51d74ae3a v4l2codecs: update to the new uAPI
The new VP9 stateless API is in its way to be destaged. Update our
headers to match.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1012>
2021-11-29 17:41:19 +00:00
Víctor Manuel Jáquez Leal
5e3bf0fff7 vapostproc, vadeinterlace: don't transform caps if no intersection.
If caps to transform don't intersect with those supported by the VA
filter (VAEntrypointVideoProc) then return them as is, because only
pass-through mode is the only possibility.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1369>
2021-11-22 15:27:10 +00:00
Víctor Manuel Jáquez Leal
68379649db vapostproc: Append featured caps rather than merge.
So it would be possible to honor upstream preference.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1369>
2021-11-22 15:27:10 +00:00
Víctor Manuel Jáquez Leal
718e83ed4c vapostproc: Remove dead code.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1369>
2021-11-22 15:27:10 +00:00
Víctor Manuel Jáquez Leal
26040bd932 va: filter: Validate input parameter in internal function.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1369>
2021-11-22 15:27:10 +00:00
Víctor Manuel Jáquez Leal
8377463128 va: allocator: log drm modifier
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1369>
2021-11-22 15:27:10 +00:00
He Junyan
a14f0da324 va: vpp: Fix the memory leak in fixate_caps().
For the BaseTransform class, the function of fixate_caps(), takes
the ownership of "othercaps". So we should clear it in our subclass.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1372>
2021-11-22 10:54:23 +00:00
He Junyan
c2bffe22f3 va: decoder: Also ref the display when duplicating pictures.
The _destroy_buffers() will check the display handle using the
g_return_val_if_fail. we should not generate the invalid pointer
warning.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1368>
2021-11-19 14:40:18 +00:00
Seungha Yang
7f796b10b2 wasapi2: Fix typo in doc
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1360>
2021-11-19 13:38:19 +00:00
Seungha Yang
6acf89b3d3 mediafoundation: Skip doc for non-default encoder elements
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1360>
2021-11-19 13:38:19 +00:00
Seungha Yang
7fe08d8bed d3d11: Stop doc for non-default decoder and deinterlacer elements
Just skip doc for non-default decoder/deinterlacer elements
since there are multiple element in case that system has
multiple GPUs.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1360>
2021-11-19 13:38:19 +00:00
Wonchul Lee
ae7a365274 d3d11: Fix deadlock while doing unprepare
ShowWindow() could be blocked while doing gst_d3d11_window_win32_unprepare
when external window handle provided to d3d11videosink in multi-threaded
environment.
The condition that issue happened is, UI thread is waiting for a
background thread that changes d3d11videosink state to NULL, and the
background thread would try to send a window message to the queue.
The queue is already occupied by the UI thread, so the background
thread will be blocked.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1366>
2021-11-19 13:42:53 +09:00
Thomas Klausner
49449dfa41 shm: NetBSD build fix
shm_unlink() and friends live in librt on NetBSD. Adapt build system.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1323>
2021-11-08 21:14:42 +00:00
Antonio Ospite
7deee582d2 magicleap: update lumin_rt libraries names to the latest official version
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1314>
2021-11-05 16:21:34 +00:00
Thibault Saunier
d0c5778669 doc: Update nvdec documentation
Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/870

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1309>
2021-11-05 13:26:33 +00:00
Seungha Yang
8eee442715 wasapi2ringbuffer: Fix client object leak
Check whether ringbuffer is holding client object already since
open_device() may be called multiple times

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1307>
2021-11-04 12:41:32 +00:00
Daniel Almeida
f9958eda8e v4l2codecs: gstv4l2codecsmpeg2dec: implement a render delay
The v4l2 backend support delayed output for performance reasons.
It is then possible to use render delays to queue multiple requests
simultaneously, thus increasing performance.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1013>
2021-11-02 16:16:29 +00:00
Daniel Almeida
477b824f8e v4l2codecs: Implement a MPEG2 V4L2 decoder element
Implement a MPEG2 V4L2 decoder element based on the previous h264
implementation.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1013>
2021-11-02 16:16:29 +00:00
Daniel Almeida
4fe6bc1afe v4l2codecs: mpeg2: update to the new uAPI
The mpeg2 stateless api has undergone changes as it is being
destage. Update the v4l2-controls header to match.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1013>
2021-11-02 16:16:29 +00:00
Daniel Almeida
f6e17ea294 sys: va: GstVaMpeg2Dec: use slice sc_offset and size
Seeing as how GstMpeg2Slice will now record the start code offset
as well as its size with the above field taken into account, the
manual computation in this class is not needed.

Remove it.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1013>
2021-11-02 16:16:29 +00:00
James Cowgill
8b932c105f v4l2codecs: Handle allocator creation failure
If `VIDIOC_REQBUFS` doesn't return enough buffers the allocator creation
function can fail and return `NULL`. Handle this by generating an error
and returning instead of segfaulting.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1220>
2021-11-02 15:25:48 +00:00
James Cowgill
3846b0563a v4l2codecs: Fix segfault when destroying non-detached allocator
The GstV4l2CodecAllocator dispose function clears `self->decoder` but
the finalize function then tries to use it if the allocator has no been
detached yet.

Fix by detaching in the dispose function before we clear
`self->decoder`.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1220>
2021-11-02 15:25:48 +00:00
Nirbheek Chauhan
b8d6fd905e applemedia: Add ARGB64_BE, RGBA64_LE support to vtenc/vtdec
We can add this now that ARGB64_BE videoconvert support was added in:
https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1247

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1214>
2021-11-01 09:24:52 +00:00
Nirbheek Chauhan
fed69c48b6 vtenc: Add FieldDetail properties for interlaced input
Standard interlace handling:
* If we have interlace-mode=interleaved and the field order, we just
  set it when creating the session
* If we have interlace-mode=(interleaved|mixed) and no field order, we
  set the field order on the first buffer

The encoder session does not support changing the FieldDetail after it
has started encoding frames, so we cannot support mixed streams
correctly.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1214>
2021-11-01 09:24:52 +00:00
Nirbheek Chauhan
29a32703a5 vtenc: Add a property to forcibly ignore alpha values
This PropertyKey is not documented in any headers anywhere, so we need
to define it ourselves.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1214>
2021-11-01 09:24:52 +00:00
Nirbheek Chauhan
4e37f99975 vtenc: Set colorimetry information
It looks like VideoToolbox doesn't support all our colorimetries.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1214>
2021-11-01 09:24:52 +00:00
Nirbheek Chauhan
0f0e68080c applemedia: Add ProRes support to vtenc and vtdec
For vtdec, we continue to prefer NV12; else we pick whatever
downstream wants. In the special case where we're decoding 10-bit or
12-bit ProRes formats, we will prefer AYUV64.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1214>
2021-11-01 09:24:52 +00:00
Nirbheek Chauhan
db638134e7 vtenc: Improve error reporting in chain function
Otherwise it is quite difficult to figure out why the chain function
failed. Also assert not reached for case statements that should not be
hit.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1214>
2021-11-01 09:24:52 +00:00
Nirbheek Chauhan
d7f6f8172a vtdec: Remove dead code in switch statement
We never advertise these formats, so these cases will never be hit.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1214>
2021-11-01 09:24:52 +00:00
Víctor Manuel Jáquez Leal
4a4823b972 va: Delay decoders downstream negotiation.
Delay decoders downstream negotiation just before an output frame
needs to be allocated.

This is required, are least for H.264 and H.265 decoders, since
codec_data might trigger a new sequence before finishing upstream
negotiation, and sink pad caps need to set before setting source pad
caps, particularly to forward HDR fields. The other decoders are
changed too in order to keep the same structure among them.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1257>
2021-10-29 16:06:52 +00:00
Víctor Manuel Jáquez Leal
5494ec38d0 vabasedec: Move warning message to decoder's category.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1257>
2021-10-29 16:06:52 +00:00
Víctor Manuel Jáquez Leal
97e3f88c20 va: Move common variable need_negotiation to GstBaseDec.
This is a common variable to all decoders, so it's sound to move it to
the base helper.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1257>
2021-10-29 16:06:52 +00:00
Víctor Manuel Jáquez Leal
a2a3c81c85 va: Move back parent_object to each element.
Using GstBaseDec hack to access the parent_object of each element in
the element itself is a bit fragile. It would be better to keep its
own parent object as the usual global variable. It would make it
resistant to code changes.

The GstBaseDec macro to access the parent object now it's internal to
base decoder.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1257>
2021-10-29 16:06:52 +00:00
Mengkejiergeli Ba
5b1662d37e msdk: Insert hdr sei at hevc encoder
There are two HDR SEIs defined in spec: mastering display colour volume and
content light level. Add insertion of HDR SEIs when they are available
during encoding.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1242>
2021-10-28 08:36:05 +00:00
Víctor Manuel Jáquez Leal
cf3d271cde vapostproc: Color fixation will choose othercaps' structure.
gst_va_fixate_format() will iterate all othercaps' structures to find
the one with less information lost at color conversion. If a structure
with same color format is found, the iteration stops. It's like a
smart truncation. Then, this function also will choose the caps
feature.

Later this structure is used fixate its size and no further truncation
is needed.

Don't intersect at fixate, since it kills possible resizing.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1261>
2021-10-27 18:01:50 +00:00
Víctor Manuel Jáquez Leal
bc6a7a63f0 vapostproc: Ignore direction at orientation swapping.
It doesn't matter the direction of the negotiation.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1261>
2021-10-27 18:01:50 +00:00
Víctor Manuel Jáquez Leal
cbca0bb06e vapostproc: Consider video orientation for border calculation.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1261>
2021-10-27 18:01:50 +00:00
Mengkejiergeli Ba
3ca6734860 msdkvpp: Add 12bit formats
Add 12bit formats for different chroma samplings at sink pad and
src pad, including P012_LE, Y212_LE and Y412_LE.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1218>
2021-10-26 07:08:10 +00:00
Víctor Manuel Jáquez Leal
74c75b1e8b vah265dec: Fix end_picture() vmethod.
Since commit 88437a9c the signature of h265decoder's end_picture()
changed to return GstFlowReturn, but vah265dec was not updated.

This commit fixes this regression.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1248>
2021-10-25 17:01:26 +02:00
Mengkejiergeli Ba
164244a2eb va: allocator: Fix possible memory leaks
At gst_va_dmabuf_allocator_setup_buffer_full, static code analysis tool
does not know number of objects in descriptor is always larger than 0 if
export_surface_to_dmabuf succeeds. Thus, the tool will assume buf is
allocated with mem but not released when desc.num_objects equals to 0
and raise a mem leak issue.

For gst_va_dambuf_memories_setup, we should also inform the tool that
n_planes will be larger than 0 by checking the value at very beginning.
Then, the defect similar to above will not be raised during static analysis.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1241>
2021-10-25 15:03:30 +08:00
Mathieu Duponchelle
2f8030d98b nvh264enc: add constrained-baseline to the caps profiles
In practice, when baseline is requested from the encoder it
produces constrained baseline, and it is already reflected
in the profile-iop flags.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1213>
2021-10-21 09:06:08 +00:00