DescriptionV4L2VEA: Improve H264 stream header handling.
Currently, V4L2VEA assumes that the first H264 bitstream buffer coming from
the hardware encoder will contain exactly an SPS+PPS pair. It then caches
that buffer and prepends its contents before each keyframe. It also uses it
for the remainder of the session, even if additional/new SPS+PPS pairs are
provided later on.
However, the first buffer may contain additional NALUs, and only SPS+PPS
should be extracted and used. Moreover, the SPS+PPS pair may change later
on. Finally, some hardware encoders may support prepending each IDR with
the header, without the need for V4L2VEA to handle this.
This CL adds support for the V4L2_CID_MPEG_VIDEO_H264_SPS_PPS_BEFORE_IDR
V4L2 control, which instructs the HW encoder to inject SPS+PPS pair before
each IDR in the stream. If that control is supported, we do not have to
inject the header ourselves.
If the control is not supported, we need to keep injecting, however -
instead of making the above assumptions - we parse the stream, cache the
latest SPS and PPS, and inject them before any found IDR, if possible.
The VEA unittest is also modified, to verify that the stream includes an
SPS+PPS pair before each IDR.
Also, remove usage of linked_ptr for clearer ownership management of
buffers.
BUG=639238
TEST=veatest on various ARM platforms
Committed: https://crrev.com/db74e2bf3a0bb5a7b4e2c4ed6b14e75ffbcffcc3
Cr-Commit-Position: refs/heads/master@{#414332}
Patch Set 1 #
Total comments: 12
Patch Set 2 : Address PS1 comments #
Total comments: 4
Patch Set 3 : Address nits #
Messages
Total messages: 20 (10 generated)
|