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

Issue 1016773002: MJPEG acceleration for video capture using VAAPI (Closed)

Created:
5 years, 9 months ago by kcwu
Modified:
5 years, 7 months ago
CC:
chromium-reviews, posciak+watch_chromium.org, jam, mcasas+watch_chromium.org, sievers+watch_chromium.org, jbauman+watch_chromium.org, feature-media-reviews_chromium.org, darin-cc_chromium.org, kalyank, piman+watch_chromium.org, danakj+watch_chromium.org, wjia+watch_chromium.org, miu+watch_chromium.org
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

MJPEG acceleration for video capture using VAAPI The latency and cpu usage (including sys) to decode 1280x720 image: software decode: latency 10.2ms, cpu 28.2% hardware decode: latency 5.5ms, cpu 26.7% Tested on peppy chromebook (haswell) using apprtc.appspot.com (not connected yet and no loopback) Default cpu scaling governor. BUG=335778 TEST=apprtc loopback

Patch Set 1 #

Patch Set 2 : fix coded size, shm handle #

Total comments: 56

Patch Set 3 : fix many thread issues #

Total comments: 36

Patch Set 4 : address most comments #

Total comments: 130

Patch Set 5 : Move JPEG related code to separated file. And address some other comments #

Total comments: 47

Patch Set 6 : #

Total comments: 36

Patch Set 7 : #

Patch Set 8 : rename GpuJpegDecodeAcceleratorAdapter to GpuJpegDecoder #

Total comments: 42

Patch Set 9 : support multiple jpeg decoder #

Total comments: 91

Patch Set 10 : (hide change of base/containers/scoped_ptr_hash_map.h in https://codereview.chromium.org/1099383002… #

Total comments: 22

Patch Set 11 : #

Patch Set 12 : rebase #

Patch Set 13 : fix AsPlatformHandle #

Patch Set 14 : reuse VASurface #

Total comments: 53

Patch Set 15 : jpeg thread; no fallback; SendBuffer with bytes_used #

Patch Set 16 : rebase #

Total comments: 56
Unified diffs Side-by-side diffs Delta from patch set Stats (+1479 lines, -17 lines) Patch
A content/browser/renderer_host/gpu_jpeg_decoder.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 1 chunk +113 lines, -0 lines 10 comments Download
A content/browser/renderer_host/gpu_jpeg_decoder.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 1 chunk +214 lines, -0 lines 8 comments Download
M content/browser/renderer_host/media/video_capture_buffer_pool.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1 chunk +1 line, -0 lines 0 comments Download
M content/browser/renderer_host/media/video_capture_buffer_pool.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 4 chunks +19 lines, -3 lines 0 comments Download
M content/browser/renderer_host/media/video_capture_device_client.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 3 chunks +9 lines, -1 line 4 comments Download
M content/browser/renderer_host/media/video_capture_device_client.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 5 chunks +28 lines, -1 line 2 comments Download
M content/common/BUILD.gn View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1 chunk +2 lines, -0 lines 0 comments Download
M content/common/gpu/DEPS View 1 chunk +1 line, -0 lines 0 comments Download
M content/common/gpu/client/gpu_channel_host.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 3 chunks +5 lines, -0 lines 0 comments Download
M content/common/gpu/client/gpu_channel_host.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 2 chunks +12 lines, -0 lines 0 comments Download
A content/common/gpu/client/gpu_jpeg_decode_accelerator_host.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 1 chunk +61 lines, -0 lines 0 comments Download
A content/common/gpu/client/gpu_jpeg_decode_accelerator_host.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 1 chunk +157 lines, -0 lines 0 comments Download
M content/common/gpu/gpu_channel.h View 1 2 3 4 5 6 7 8 9 10 11 5 chunks +9 lines, -0 lines 0 comments Download
M content/common/gpu/gpu_channel.cc View 1 2 3 4 5 6 7 8 9 10 3 chunks +18 lines, -0 lines 0 comments Download
M content/common/gpu/gpu_messages.h View 1 2 3 4 5 6 7 8 9 10 11 5 chunks +47 lines, -0 lines 0 comments Download
A content/common/gpu/media/gpu_jpeg_decode_accelerator.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 1 chunk +105 lines, -0 lines 0 comments Download
A content/common/gpu/media/gpu_jpeg_decode_accelerator.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 1 chunk +241 lines, -0 lines 0 comments Download
A content/common/gpu/media/vaapi_jpeg_decode_accelerator.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 1 chunk +132 lines, -0 lines 8 comments Download
A content/common/gpu/media/vaapi_jpeg_decode_accelerator.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 1 chunk +255 lines, -0 lines 24 comments Download
M content/content_browser.gypi View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1 chunk +2 lines, -0 lines 0 comments Download
M content/content_common.gypi View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 3 chunks +6 lines, -0 lines 0 comments Download
M media/BUILD.gn View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +2 lines, -0 lines 0 comments Download
M media/media.gyp View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1 chunk +2 lines, -0 lines 0 comments Download
M media/video/capture/linux/v4l2_capture_delegate.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 1 chunk +3 lines, -3 lines 0 comments Download
M media/video/capture/linux/v4l2_capture_delegate.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 1 chunk +2 lines, -1 line 0 comments Download
M media/video/capture/linux/v4l2_capture_delegate_multi_plane.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 1 chunk +2 lines, -1 line 0 comments Download
M media/video/capture/linux/v4l2_capture_delegate_multi_plane.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 1 chunk +2 lines, -1 line 0 comments Download
M media/video/capture/linux/v4l2_capture_delegate_single_plane.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 1 chunk +2 lines, -1 line 0 comments Download
M media/video/capture/linux/v4l2_capture_delegate_single_plane.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 1 chunk +3 lines, -4 lines 0 comments Download
M media/video/capture/video_capture_device.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1 chunk +1 line, -0 lines 0 comments Download
M media/video/jpeg_decode_accelerator.h View 1 2 1 chunk +1 line, -1 line 0 comments Download
A media/video/jpeg_decode_accelerator.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 1 chunk +22 lines, -0 lines 0 comments Download

Messages

Total messages: 36 (3 generated)
kcwu
I'm still working on this CL (it's known to crash, leaks, etc.) If you want ...
5 years, 9 months ago (2015-03-17 14:12:36 UTC) #2
wuchengli
https://codereview.chromium.org/1016773002/diff/20001/content/browser/renderer_host/media/video_capture_buffer_pool.cc File content/browser/renderer_host/media/video_capture_buffer_pool.cc (right): https://codereview.chromium.org/1016773002/diff/20001/content/browser/renderer_host/media/video_capture_buffer_pool.cc#newcode172 content/browser/renderer_host/media/video_capture_buffer_pool.cc:172: int buffer_id) { Need to acquire |lock_|. Or how ...
5 years, 9 months ago (2015-03-23 06:30:15 UTC) #3
mcasas
Please clarify to which platforms/hardware is this CL applicable: from the code, I only see ...
5 years, 9 months ago (2015-03-23 19:29:51 UTC) #5
chromium-reviews
> > > https://codereview.chromium.org/1016773002/diff/20001/ > content/browser/renderer_host/media/video_capture_device_ > client.cc#newcode184 > content/browser/renderer_host/media/video_capture_device_client.cc:184: > There's a lot of ...
5 years, 9 months ago (2015-03-24 15:20:18 UTC) #6
kcwu
I fixed all thread issues. But I haven't addressed all comments yet. To mcasas, yes ...
5 years, 8 months ago (2015-03-30 18:12:15 UTC) #7
wuchengli
I'll finish the rest of the review soon. https://codereview.chromium.org/1016773002/diff/40001/build/common.gypi File build/common.gypi (right): https://codereview.chromium.org/1016773002/diff/40001/build/common.gypi#newcode3631 build/common.gypi:3631: #'_DEBUG', ...
5 years, 8 months ago (2015-04-14 09:41:44 UTC) #8
kcwu
https://codereview.chromium.org/1016773002/diff/20001/content/browser/renderer_host/media/video_capture_device_client.cc File content/browser/renderer_host/media/video_capture_device_client.cc (right): https://codereview.chromium.org/1016773002/diff/20001/content/browser/renderer_host/media/video_capture_device_client.cc#newcode71 content/browser/renderer_host/media/video_capture_device_client.cc:71: GpuChannelHost* host = On 2015/03/23 19:29:51, mcasas wrote: > ...
5 years, 8 months ago (2015-04-14 20:02:35 UTC) #9
wuchengli
https://codereview.chromium.org/1016773002/diff/60001/content/browser/renderer_host/media/video_capture_device_client.cc File content/browser/renderer_host/media/video_capture_device_client.cc (right): https://codereview.chromium.org/1016773002/diff/60001/content/browser/renderer_host/media/video_capture_device_client.cc#newcode216 content/browser/renderer_host/media/video_capture_device_client.cc:216: // Verify parameters from GPU thread. s/thread/process/ https://codereview.chromium.org/1016773002/diff/60001/content/common/gpu/client/gpu_channel_host.cc File ...
5 years, 8 months ago (2015-04-15 07:12:00 UTC) #10
kcwu
Hi, @mcasas, could you please take another look? Now most JPEG related stuff are moved ...
5 years, 8 months ago (2015-04-16 14:38:29 UTC) #11
mcasas
Did a partial review. Please revisit your comments, I find some of them hard to ...
5 years, 8 months ago (2015-04-16 23:55:14 UTC) #12
kcwu
Miguel, thanks for your review. Could you please take another look? Wu-cheng, I addressed all ...
5 years, 8 months ago (2015-04-20 17:48:00 UTC) #13
wuchengli
Here are the comments so far. I'll finish the rest of the review later. https://codereview.chromium.org/1016773002/diff/100001/content/browser/media/capture/web_contents_video_capture_device_unittest.cc ...
5 years, 8 months ago (2015-04-21 06:05:37 UTC) #14
mcasas
Few comments so far. Will continue soon. https://codereview.chromium.org/1016773002/diff/80001/content/browser/renderer_host/gpu_jpeg_decode_accelerator_adapter.cc File content/browser/renderer_host/gpu_jpeg_decode_accelerator_adapter.cc (right): https://codereview.chromium.org/1016773002/diff/80001/content/browser/renderer_host/gpu_jpeg_decode_accelerator_adapter.cc#newcode51 content/browser/renderer_host/gpu_jpeg_decode_accelerator_adapter.cc:51: media::JpegDecodeAccelerator::kInvalidBitstreamBufferId) { ...
5 years, 8 months ago (2015-04-22 01:23:53 UTC) #15
kcwu
@mcasas, I have some review questions in patchset 5 need your comments, especially the one ...
5 years, 8 months ago (2015-04-22 14:43:34 UTC) #16
wuchengli
https://codereview.chromium.org/1016773002/diff/140001/content/common/gpu/media/vaapi_jpeg_decode_accelerator.cc File content/common/gpu/media/vaapi_jpeg_decode_accelerator.cc (right): https://codereview.chromium.org/1016773002/diff/140001/content/common/gpu/media/vaapi_jpeg_decode_accelerator.cc#newcode19 content/common/gpu/media/vaapi_jpeg_decode_accelerator.cc:19: #include "ui/gl/gl_bindings.h" not used? https://codereview.chromium.org/1016773002/diff/140001/content/common/gpu/media/vaapi_jpeg_decode_accelerator.cc#newcode86 content/common/gpu/media/vaapi_jpeg_decode_accelerator.cc:86: CHECK(decoder_thread_.Start()); Log an ...
5 years, 8 months ago (2015-04-23 09:35:19 UTC) #17
kcwu
https://codereview.chromium.org/1016773002/diff/60001/content/common/gpu/gpu_channel.h File content/common/gpu/gpu_channel.h (right): https://codereview.chromium.org/1016773002/diff/60001/content/common/gpu/gpu_channel.h#newcode237 content/common/gpu/gpu_channel.h:237: scoped_ptr<content::GpuJpegDecodeAccelerator> jpeg_decoder_; On 2015/04/15 07:11:57, wuchengli wrote: > Need ...
5 years, 8 months ago (2015-04-23 13:00:18 UTC) #18
kcwu
https://codereview.chromium.org/1016773002/diff/160001/base/containers/scoped_ptr_hash_map.h File base/containers/scoped_ptr_hash_map.h (right): https://codereview.chromium.org/1016773002/diff/160001/base/containers/scoped_ptr_hash_map.h#newcode1 base/containers/scoped_ptr_hash_map.h:1: // Copyright 2013 The Chromium Authors. All rights reserved. ...
5 years, 8 months ago (2015-04-23 13:02:33 UTC) #19
wuchengli
https://codereview.chromium.org/1016773002/diff/160001/content/browser/renderer_host/gpu_jpeg_decoder.cc File content/browser/renderer_host/gpu_jpeg_decoder.cc (right): https://codereview.chromium.org/1016773002/diff/160001/content/browser/renderer_host/gpu_jpeg_decoder.cc#newcode20 content/browser/renderer_host/gpu_jpeg_decoder.cc:20: // requires an IPC. s/IPC/IPC even for platforms that ...
5 years, 8 months ago (2015-04-24 05:54:25 UTC) #20
kcwu
Hi @mcasas, when you have time, could you please reply my questions in patchset 5 ...
5 years, 8 months ago (2015-04-27 19:14:52 UTC) #21
mcasas
Some more review. Apologies for the delay. https://codereview.chromium.org/1016773002/diff/80001/content/browser/renderer_host/gpu_jpeg_decode_accelerator_adapter.cc File content/browser/renderer_host/gpu_jpeg_decode_accelerator_adapter.cc (right): https://codereview.chromium.org/1016773002/diff/80001/content/browser/renderer_host/gpu_jpeg_decode_accelerator_adapter.cc#newcode102 content/browser/renderer_host/gpu_jpeg_decode_accelerator_adapter.cc:102: captured_data_.timestamp); On ...
5 years, 7 months ago (2015-04-28 00:04:50 UTC) #22
kcwu
I uploaded my progress so far for you to review.I will continue to fix remain ...
5 years, 7 months ago (2015-04-30 19:25:43 UTC) #23
kcwu
Hi, Miguel Please take a look. Now AsPlatformHandle works.
5 years, 7 months ago (2015-05-04 11:32:05 UTC) #24
wuchengli
https://codereview.chromium.org/1016773002/diff/260001/content/browser/renderer_host/gpu_jpeg_decoder.cc File content/browser/renderer_host/gpu_jpeg_decoder.cc (right): https://codereview.chromium.org/1016773002/diff/260001/content/browser/renderer_host/gpu_jpeg_decoder.cc#newcode135 content/browser/renderer_host/gpu_jpeg_decoder.cc:135: // Since IsDecoding_Locked() is false here and we only ...
5 years, 7 months ago (2015-05-04 14:14:41 UTC) #25
wuchengli
https://codereview.chromium.org/1016773002/diff/260001/content/browser/renderer_host/gpu_jpeg_decoder.cc File content/browser/renderer_host/gpu_jpeg_decoder.cc (right): https://codereview.chromium.org/1016773002/diff/260001/content/browser/renderer_host/gpu_jpeg_decoder.cc#newcode130 content/browser/renderer_host/gpu_jpeg_decoder.cc:130: return false; Can we return a enum from this ...
5 years, 7 months ago (2015-05-06 07:59:18 UTC) #26
mcasas
A few more comments in // with wuchengli@'s. https://codereview.chromium.org/1016773002/diff/260001/content/browser/renderer_host/gpu_jpeg_decoder.cc File content/browser/renderer_host/gpu_jpeg_decoder.cc (right): https://codereview.chromium.org/1016773002/diff/260001/content/browser/renderer_host/gpu_jpeg_decoder.cc#newcode124 content/browser/renderer_host/gpu_jpeg_decoder.cc:124: // ...
5 years, 7 months ago (2015-05-07 00:59:04 UTC) #27
wuchengli
https://codereview.chromium.org/1016773002/diff/260001/content/browser/renderer_host/gpu_jpeg_decoder.cc File content/browser/renderer_host/gpu_jpeg_decoder.cc (right): https://codereview.chromium.org/1016773002/diff/260001/content/browser/renderer_host/gpu_jpeg_decoder.cc#newcode124 content/browser/renderer_host/gpu_jpeg_decoder.cc:124: // fallback to software decoding) before the former frame. ...
5 years, 7 months ago (2015-05-07 06:23:14 UTC) #28
kcwu
Major changes in this patchset. 1. Use jpeg thread. GpuJpegDecoder and GpuJpegDecodeAcceleratorHost are much simplified. ...
5 years, 7 months ago (2015-05-08 14:42:43 UTC) #29
henryhsu
https://codereview.chromium.org/1016773002/diff/300001/content/browser/renderer_host/gpu_jpeg_decoder.cc File content/browser/renderer_host/gpu_jpeg_decoder.cc (right): https://codereview.chromium.org/1016773002/diff/300001/content/browser/renderer_host/gpu_jpeg_decoder.cc#newcode178 content/browser/renderer_host/gpu_jpeg_decoder.cc:178: error_cb_.Run(base::StringPrintf("CreateAndMapAnonymous failed, size=%ld", There is a warning in arm ...
5 years, 7 months ago (2015-05-12 09:42:03 UTC) #30
wuchengli
Adding JPEG thread simplifies the code a lot! This CL is ready for owner review. ...
5 years, 7 months ago (2015-05-13 15:04:07 UTC) #32
piman
This is a very large CL. Can you split it in 2 parts, one that ...
5 years, 7 months ago (2015-05-13 22:59:28 UTC) #33
wuchengli
On 2015/05/13 22:59:28, piman (Very slow to review) wrote: > This is a very large ...
5 years, 7 months ago (2015-05-14 03:09:49 UTC) #34
kcwu
This CL is split to three smaller ones. https://codereview.chromium.org/1147693002/ https://codereview.chromium.org/1132683004/ https://codereview.chromium.org/1124423008/ This one will be ...
5 years, 7 months ago (2015-05-25 18:20:36 UTC) #35
kcwu
5 years, 7 months ago (2015-05-26 07:04:20 UTC) #36
https://codereview.chromium.org/1016773002/diff/300001/content/browser/render...
File content/browser/renderer_host/gpu_jpeg_decoder.cc (right):

https://codereview.chromium.org/1016773002/diff/300001/content/browser/render...
content/browser/renderer_host/gpu_jpeg_decoder.cc:44:
DCHECK(CalledOnValidThread());
On 2015/05/13 15:04:05, wuchengli wrote:
> We need a GpuJpegDecoder::Destroy to stop jpeg thread and destroy |decoder_|.
So
> we don't access the member variables from VideoFrameReady when |this| is being
> destructed. GpuJpegDecoder::Destroy should be called in
> ~VideoCaptureDeviceClient().
> 
> VideoCaptureDeviceClient owns GpuJpegDecoder. So the lifecycle should be the
> same. When VideoCaptureDeviceClient is gone, GpuJpegDecoder shouldn't be
alive.
> We don't need to use WeakPtr for VideoCaptureDeviceClient. Using Unretained is
> enough.

Acknowledged.
piman raised the same issue in
https://codereview.chromium.org/1124423008/diff/1/content/common/gpu/client/g...
I will address it there.

Powered by Google App Engine
This is Rietveld 408576698