Commit graph

18 commits

Author SHA1 Message Date
Nicolas Dufresne 316b182a86 v4l2codecs: h264: Reset the number of slices on picture start
This way, if we aborted a frame in the middle, we don't endup thinking
there is multiple slices to send.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1079>
2022-07-22 10:21:03 -04:00
Nicolas Dufresne c2144ec586 v4l2codecs: h264: Fix initialization of the slice array
The function g_array_sized_new() leaves the len to 0, but the slice
implementation assumes it would be set to 4. Sending multiple slices is
not yet support for H.264 as no driver needed it yet, but if that code
was to be used it would have overflowed as the array would never grow as
multiple 0 by 2 always results in 0.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1079>
2022-07-22 10:21:03 -04:00
Nicolas Dufresne a707d984ae v4l2codecs: h264: Rename count variable to num_controls
This is the counter for the used control slot. The term num_controls was
introduced in the HEVC decoder and felt like a better choice.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1079>
2022-07-22 10:21:02 -04:00
Dmitry Osipenko fd694d840a v4l2codecs: h264: Set frame type flags
V4L spec now requires decode_params flags to be set in accordance to the
frame's type. In particular this is required by H.264 decoder of NVIDIA
Tegra SoC to operate properly. Set the flags based on type of parsed
slices.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1757>
2022-05-06 13:35:59 +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
Dmitry Osipenko b757d12cff v4l2codecs: h264: Correct scaling matrix ABI check
Scaling matrix V4L UAPI control not presents on NVIDIA Tegra, the default
matrix should be used in this case. Mark scaling matrix presence optional.

Fixes: 47bfa71530 ("v4l2codecs: h264: Improve ABI check ")
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1726>
2022-02-16 13:16:17 +00:00
Seungha Yang 6434d69f8c codecs: Stop claiming constness for refcounted object
It's almost pointless and makes little sense as subclass might
want to modify refcount of the object or so. And all subclasses
are already casting them to non-const version as well.
In a general sense, we need to avoid passing refcounted object
with const qualifier.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1238>
2022-02-06 17:17:22 +00:00
Nicolas Dufresne 47bfa71530 v4l2codecs: h264: Improve ABI check
This moves the ABI check to the registration, so we don't expose
decoders with the wrong ABI or that are just broken somehow. It
also makes few enhancement:

- Handle missing, but required controls
- Prints the controls macro name instead of id

This should fix RK3399 support with a currently release minor
regression in the Hantro driver that cause errors.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1599>
2022-01-29 15:33:49 +00:00
Nicolas Dufresne d7363bd838 v4l2codecs: Fix debug assertion in register functions
As now, we warn if the decoder have no support src pixel format, but that
warning is called before the type (hence the debug category) is initialized.
Fix this by moving the debug category init out of the type initialization,
into the register funcitons.

This will fix an assertion that occures in the register function and allow
relevant log to be seen by the users.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1588>
2022-01-27 18:53:41 +00:00
Nicolas Dufresne 107088a658 v4l2codecs: Unify the src template caps format
Notably NV12_4L4 ended up being applied to only VP9 decoder. This fixes the
situation by using a central define for all static src pad templated formats.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/965>
2022-01-21 19:32:30 +00:00
Nicolas Dufresne a6eb1e7782 v4l2codecs: Fix renegotiation
If we hold the last reference to the allocator, leaving the device
streaming will cause an EBUSY error when trying to free the allocate
buffers.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1404>
2021-12-02 15:45:26 -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
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
Seungha Yang e322745763 codecs: h264decoder: Use GstFlowReturn everywhere
boolean return value is not sufficient for representing the reason
of error in most cases. For instance, any errors around new_sequence()
would mean negotiation error, not just *ERROR*.
And some subclasses will allocate buffer/memory/surface on new_picture()
but it could be failed because of expected error, likely flushing

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1019>
2021-10-04 20:56:46 +00:00
Thibault Saunier 019971a3c7 Move files from gst-plugins-bad into the "subprojects/gst-plugins-bad/" subdir 2021-09-24 16:14:36 -03:00
Renamed from sys/v4l2codecs/gstv4l2codech264dec.c (Browse further)