v4l2_stateful_decoder: move and fix NALU parser

This fixes a read overflow issue. The previous version of find_next_nalu
read 2 bytes beyond the end of the buffer.

This also pulls NALU parsing code into a new file that can be used for
both H264 and H265 parsing.

Also changes the behavior of find_next_nalu so it returns NULL if no
NALU was found.

TEST=tast run ${DUT} video.PlatformDecoding.v4l2_h264*

Change-Id: I9a611a695118b11aee95100ff343cdd94caf7589
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/drm-tests/+/3566876
Tested-by: Nathan Hebert <nhebert@chromium.org>
Reviewed-by: Fritz Koenig <frkoenig@chromium.org>
Commit-Queue: Nathan Hebert <nhebert@chromium.org>
6 files changed