h265parse: Don't wait for next NAL if input is aligned
authorNicolas Dufresne <nicolas.dufresne@collabora.com>
Tue, 9 Oct 2018 20:01:08 +0000 (16:01 -0400)
committerNicolas Dufresne <nicolas@ndufresne.ca>
Wed, 15 Apr 2020 14:10:16 +0000 (14:10 +0000)
commite88d8480709581a2e54b7954c47193b729b23c79
tree55469396e30934b0f1b1c5ce1c512ce2a02b2257
parent7cba3847ece5193c0d75aa97bcc34ee1c338208e
h265parse: Don't wait for next NAL if input is aligned

Waiting for the next NAL increases the latency. If alignment=nal/au
has been negotiated, assumes the the buffer contains a complete
NAL and don't expect a second start-code. This way, nal -> nal,
au -> au and au -> nal no longer introduce latency.

As a side effect, the collect_pad() function was not able to poke at the
following NAL. This call is now moved before processing the NAL, so
it's looking at the current NAL before it's ingested into the parser
state in order to dermin if the end of an AU has been reached. The AUD
injection state as been adapted to support this.

This change will break pipelines if alignment=nal is used without respecting the
alignment. Effectively, the parser will no longer fix the broken aligment
which will result in parser error and the termination of the pipeline. Such
issue existed in tsdemux element and might exist in any forks of that code.

Related to https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1193
gst/videoparsers/gsth265parse.c
gst/videoparsers/gsth265parse.h