Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(513)

Issue 2274493002: V4L2VEA: Improve H264 stream header handling. (Closed)

Created:
4 years, 4 months ago by Pawel Osciak
Modified:
4 years, 4 months ago
Reviewers:
kcwu
CC:
chromium-reviews, posciak+watch_chromium.org, piman+watch_chromium.org, feature-media-reviews_chromium.org, Owen Lin
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

V4L2VEA: 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 #

Unified diffs Side-by-side diffs Delta from patch set Stats (+181 lines, -60 lines) Patch
M media/gpu/v4l2_video_encode_accelerator.h View 5 chunks +27 lines, -8 lines 0 comments Download
M media/gpu/v4l2_video_encode_accelerator.cc View 1 2 13 chunks +153 lines, -52 lines 0 comments Download
M media/gpu/video_encode_accelerator_unittest.cc View 1 1 chunk +1 line, -0 lines 0 comments Download

Messages

Total messages: 20 (10 generated)
Pawel Osciak
4 years, 4 months ago (2016-08-23 08:55:36 UTC) #3
kcwu
https://codereview.chromium.org/2274493002/diff/20001/media/gpu/v4l2_video_encode_accelerator.cc File media/gpu/v4l2_video_encode_accelerator.cc (right): https://codereview.chromium.org/2274493002/diff/20001/media/gpu/v4l2_video_encode_accelerator.cc#newcode70 media/gpu/v4l2_video_encode_accelerator.cc:70: : at_device(false), buffer_ref(nullptr), address(nullptr), length(0) {} Isn't buffer_ref nullptr ...
4 years, 4 months ago (2016-08-23 10:02:22 UTC) #4
kcwu
https://codereview.chromium.org/2274493002/diff/20001/media/gpu/v4l2_video_encode_accelerator.cc File media/gpu/v4l2_video_encode_accelerator.cc (right): https://codereview.chromium.org/2274493002/diff/20001/media/gpu/v4l2_video_encode_accelerator.cc#newcode455 media/gpu/v4l2_video_encode_accelerator.cc:455: while (parser.AdvanceToNextNALU(&nalu) == H264Parser::kOk) { On 2016/08/23 10:02:22, kcwu ...
4 years, 4 months ago (2016-08-24 07:16:45 UTC) #5
Pawel Osciak
ptal https://codereview.chromium.org/2274493002/diff/20001/media/gpu/v4l2_video_encode_accelerator.cc File media/gpu/v4l2_video_encode_accelerator.cc (right): https://codereview.chromium.org/2274493002/diff/20001/media/gpu/v4l2_video_encode_accelerator.cc#newcode70 media/gpu/v4l2_video_encode_accelerator.cc:70: : at_device(false), buffer_ref(nullptr), address(nullptr), length(0) {} On 2016/08/23 ...
4 years, 4 months ago (2016-08-24 07:42:51 UTC) #6
kcwu
nits https://codereview.chromium.org/2274493002/diff/40001/media/gpu/v4l2_video_encode_accelerator.cc File media/gpu/v4l2_video_encode_accelerator.cc (right): https://codereview.chromium.org/2274493002/diff/40001/media/gpu/v4l2_video_encode_accelerator.cc#newcode81 media/gpu/v4l2_video_encode_accelerator.cc:81: } } // namespace https://codereview.chromium.org/2274493002/diff/40001/media/gpu/v4l2_video_encode_accelerator.cc#newcode482 media/gpu/v4l2_video_encode_accelerator.cc:482: remaining_dst_size) DVLOG(1) ...
4 years, 4 months ago (2016-08-24 08:15:48 UTC) #9
kcwu
lgtm first since only nits remains
4 years, 4 months ago (2016-08-24 08:24:57 UTC) #10
Pawel Osciak
https://codereview.chromium.org/2274493002/diff/40001/media/gpu/v4l2_video_encode_accelerator.cc File media/gpu/v4l2_video_encode_accelerator.cc (right): https://codereview.chromium.org/2274493002/diff/40001/media/gpu/v4l2_video_encode_accelerator.cc#newcode81 media/gpu/v4l2_video_encode_accelerator.cc:81: } On 2016/08/24 08:15:48, kcwu wrote: > } // ...
4 years, 4 months ago (2016-08-24 08:27:04 UTC) #11
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2274493002/60001
4 years, 4 months ago (2016-08-25 05:43:34 UTC) #17
commit-bot: I haz the power
Committed patchset #3 (id:60001)
4 years, 4 months ago (2016-08-25 05:47:51 UTC) #18
commit-bot: I haz the power
4 years, 4 months ago (2016-08-25 05:50:15 UTC) #20
Message was sent while issue was closed.
Patchset 3 (id:??) landed as
https://crrev.com/db74e2bf3a0bb5a7b4e2c4ed6b14e75ffbcffcc3
Cr-Commit-Position: refs/heads/master@{#414332}

Powered by Google App Engine
This is Rietveld 408576698