Commit graph

31 commits

Author SHA1 Message Date
Seungha Yang
89096dde38 h264decoder: Update output frame duration when second field frame is discarded
In case of an interlaced stream, if each field picture belongs to
different GstVideoCodecFrame, updates output frame's duration
based on discarded second field picture's timestamp information.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7132>
2024-07-15 16:36:50 +00:00
Sebastian Dröge
0ef396359c gst: Move GstQueueArray as GstVecDeque to core
And change lengths and indices from guint to gsize for a more correct type.

Also deprecate GstQueueArray and implement it in terms of GstVecDeque.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6779>
2024-05-06 18:25:42 +00:00
Seungha Yang
e353fe8fcc h264decoder: Handle malformed avc/avc3 packets
Packetized stream format should not contain start-code prefix
in bitstream and each [nal-length-byte, nal-byte] unit should consist of
single nal unit. But there are malformed streams in the world.
Use newly added gst_h264_parser_identify_and_split_nalu_avc()
method to identify each nal unit.

Fixes: https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/3219
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5772>
2024-01-17 14:57:57 +00:00
Seungha Yang
ccf6ac2b4c h264decoder: Fix GstVideoCodecFrame leak
If current buffer has no slice data, frame should be released.
Otherwise frames will stay in decoder baseclass forever.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5693>
2023-11-29 10:52:58 +00:00
Seungha Yang
48a0c01570 h264decoder: Update latency dynamically
The actual number of reorder frames is unknown
unless frame reordering is disabled
(e.g., POC type 2 or constrained-* profiles).
Also derived maximum DPB size or max_num_reorder_frames in VUI
is not the upper bound of output delay.

Fixes: https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/2702
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5326>
2023-09-17 01:43:29 +09:00
Seungha Yang
ea3dfadbed h264decoder: Port to GstCodecPicture struct
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5285>
2023-09-08 11:51:23 +00:00
Seungha Yang
9a902afce4 codecs: Use release_frame() instead of drop_frame()
drop_frame() will post QoS message which is not intended here

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5024>
2023-07-13 13:48:46 +00:00
Seungha Yang
45766f2448 codecs: Propagate downstream flow ERROR
Don't translate downstream flow ERROR to OK

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5024>
2023-07-13 13:48:46 +00:00
Stéphane Cerveau
2974c18a5c codecparsers: keep naming consistency in GST_H264_LEVEL
GST_H264_LEVEL_2 should be used instead of GST_H264_LEVEL_2_0

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4737>
2023-06-26 10:47:36 +00:00
Seungha Yang
e9d8bf7532 h264parser: Define level enum values
... and stop duplicating it

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4595>
2023-05-17 21:29:25 +00:00
Seungha Yang
74b7493fd3 h264decoder: Drop nonexisting picture silently without error
If end_picture() was not successful, we do drop corresponding
GstVideoCodecFrame and therefore gst_video_decoder_get_frame()
will return nullptr which is expected behavior.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4561>
2023-05-09 17:02:48 +00:00
Seungha Yang
bb5c151336 h264decoder: Enable low-latency bumping in case of pic_order_cnt_type 2
In case of POC type 2, output order is equal to decoding order
(no frame reordering)

Fixes: https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/2447
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4357>
2023-04-10 13:42:31 +00:00
Seungha Yang
73daa0e0ad h264decoder: Fix for latency report
The minimum latency answered by an element should be the maximum
latency from the element's perspective. Also consider max_reorder_frames
update as a sequence change

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4357>
2023-04-10 13:42:31 +00:00
Seungha Yang
e0c2578f73 h264decoder: Ignore invalid max_num_reorder_frames in VUI
It's not fatal and can be ignored

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4357>
2023-04-10 13:42:31 +00:00
Seungha Yang
560fd4834c h264decoder: Fix for latency report when src caps is not configured
Depending on subclass, negotiation might not happen on new_sequence()

Fixing regression introduced by the commit
4a4823b972

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4357>
2023-04-10 13:42:31 +00:00
Víctor Manuel Jáquez Leal
57e0bdb356 h264decoder: use last_output_poc from DPB
It seems that `last_output_poc` in `h264decoder` class is a left over of commit
5527cc4a2e.

This patch removes it but keeps the log message by fetching the `h264picture`'s
`last_output_pic`.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4288>
2023-03-30 09:38:47 +00:00
He Junyan
13b36cd4e3 h264decoder: fail early if no input caps have been provided
The h264decoder class does not implement the ->parse() virtual function,
and we always need to add the h264parse 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.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4064>
2023-02-25 10:30:37 +08:00
Seungha Yang
2ede4011bf codecs: Keep track of non-decoding-essential input state change
In theory, input caps can be updated anytime at non-keyframe or
sequence boundary, such as HDR10 metadata, framerate, aspect-ratio
or so. Those information update might not trigger ::new_sequence()
or subclass may ignore the changes.

By this commit, input state change will be tracked by baseclass
and subclass will be able to know the non-decoding-essential
update by checking the codec specific picture struct
on ::output_picture()

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3328>
2022-11-16 13:12:38 +00:00
Sebastian Dröge
f821ddc108 codecs: Add/fix various annotations
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3194>
2022-10-18 13:51:17 +03:00
Seungha Yang
b48c8eaee6 h264decoder: Use newly added avcC data parsing API
Use gst_h264_parser_parse_decoder_config_record() method to parse
codec_data.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2449>
2022-06-15 19:58:59 +00:00
Seungha Yang
8ec4452d67 h264decoder: Fix for unhandled low-delay decoding case
Baseclass calls get_preferred_output_delay() in a chain of
sequence header parsing and then new_sequence() is called
with required DPB size (includes render-delay) information.
Thus latency query should happen before the sequence header
parsing for subclass to report required render-delay accordingly
via get_preferred_output_delay() method.
(e.g., zero delay in case of live pipeline)

This commit is to fix wrong liveness signalling in case of
upstream packetized format.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2363>
2022-05-05 14:54:54 +00:00
Seungha Yang
9d51cae7ee h264decoder,h265decoder: Do not hold codec_data buffer
... also do not need to extract it from caps.

Decoder uses codec_data only once per set_format() and
baseclass will extract codec_data buffer already.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2212>
2022-04-18 19:55:15 +00:00
Nicolas Dufresne
104ae1b2e6 codecs: h264: Save the field_pic_flag
This flag is set when the stream is interlaced and the specific
slice is made of single parity fields rather the paired at the
macroblock layer. This is rarely needed in late decoding process
but the Rockchip RKVDEC HW interface requires it, hence needs to
be passed through V4L2 Stateless interface.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2009>
2022-03-25 21:40:28 +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
Benjamin Gaignard
9e0c2c4a09 codecs: h264decoder: Fix return value type
Return value should be GstFlowReturn not gboolean

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1426>
2021-12-08 11:08:30 +01:00
He Junyan
0345188aaa codecs: h264dec: Calculate the latency by its bump mode.
The current latency calculation just uses the num_reorder_frames,
which is not very precise. We should consider the bump mode of the
DPB, the faster it bumps, the lower latency we will have.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1046>
2021-11-05 14:40:42 +00:00
Nicolas Dufresne
da464bde5f codecs: h264: Fix wrong type of ret variable
This ret is not a GstFlowReturn. This broke v4l2 decoder which does not
implement new_picture() virtual function.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1154>
2021-10-14 20:12:03 +00:00
Seungha Yang
88437a9c9b codecs: Use GST_VIDEO_DECODER_ERROR() only for decoding error case
The GST_VIDEO_DECODER_ERROR() should be used only for robust/error-resilient
decoding purpose. Any other error codes such as not-negotiated or flushing
should be returned without modified for upstream to be able to handle
it immediately. (for example, application might want to try other
decoder element on not-negotiated)

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1070>
2021-10-07 06:48:46 +00:00
Seungha Yang
e31b797c05 codecs: h264decoder: Update for remaining gboolean to GstFlowReturn port
Fix for spurious/spammy warning and wrong function return type

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1085>
2021-10-07 06:07:29 +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 gst-libs/gst/codecs/gsth264decoder.c (Browse further)