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

Issue 2607203002: [Mojo Video Capture] Retire buffers when Android Chromium goes to the background (Closed)

Created:
3 years, 11 months ago by chfremer
Modified:
3 years, 10 months ago
Reviewers:
braveyao, mcasas, miu
CC:
chromium-reviews, qsr+mojo_chromium.org, Aaron Boodman, posciak+watch_chromium.org, viettrungluu+watch_chromium.org, jam, yzshen+watch_chromium.org, abarth-chromium, feature-media-reviews_chromium.org, darin-cc_chromium.org, mcasas+watch+vc_chromium.org, xjz+watch_chromium.org, darin (slow to review), miu+watch_chromium.org
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

[Mojo Video Capture] Retire buffers when Android Chromium goes to the background Functional change: Before this CL, when Android Chromium went to the background while video was capturing, it would release both the VCDevice and VCDeviceClient while keeping the VCBufferPool and the buffers already shared with Renderers alive. After this CL, when going to the background, we also release the VCBufferPool and the buffers. Motivation: For the Mojofication, we want to move the VCDevice, VCDeviceClient, and VCBufferPool behind an abstraction (let's refer to it as AbstractDevice) and run them in a separate process. With that, shutting down VCDevice, VCDeviceClient while keeping VCBufferPool and shared buffers alive would require exposing this as some new form of "suspended" mode for AbstractDevice (which is different from the existing suspend/resume mechanism). Instead of this, we opt for the less complex alternative solution, which is to allow a complete shutdown of AbstractDevice, including the buffer pool, while the app is in the background. Execution: In interface media::VideoFrameReceiver, replace OnBufferDestroyed(), which could only be called while a buffer was not in use by the VideoFrameReceiver with OnBufferRetired(), which may now be called while a buffer is still in use. When AbstractDevice shuts down, it tells the VideoFrameReceiver that it is "retiring" the buffers. The VideoFrameReceiver may keep consuming them as long as it needs, since it holds shared ownership while it is consuming. This CL is part of the Mojo Video Capture work. For the bigger picture, see [1] CL11pre. BUG=584797 TEST= content_unittests --gtest_filter="*Video*", Apprtc loopback on Debug, Desktop Capture Example extension on Release On Android content_shell, run video capture sample from [2], put to background, then restore from background. [1] https://docs.google.com/a/chromium.org/document/d/1Qw7rw1AJy0QHXjha36jZNiEuxsxWslJ_X-zpOhijvI8/edit?usp=sharing [2] https://webrtc.github.io/samples/src/content/getusermedia/gum/ Review-Url: https://codereview.chromium.org/2607203002 Cr-Commit-Position: refs/heads/master@{#448376} Committed: https://chromium.googlesource.com/chromium/src/+/10e14c24b244e7f58074ae74b0181cb3cb60551e

Patch Set 1 #

Total comments: 21

Patch Set 2 : Added tests and fixed a bug uncovered by the tests. #

Total comments: 4

Patch Set 3 : change std::set to std::vector #

Patch Set 4 : rebase #

Patch Set 5 : Support reused buffer ids in Controller #

Total comments: 16

Patch Set 6 : mcasas comments #

Unified diffs Side-by-side diffs Delta from patch set Stats (+445 lines, -177 lines) Patch
M content/browser/renderer_host/media/video_capture_controller.h View 1 2 3 4 5 3 chunks +36 lines, -12 lines 0 comments Download
M content/browser/renderer_host/media/video_capture_controller.cc View 1 2 3 4 5 16 chunks +128 lines, -95 lines 0 comments Download
M content/browser/renderer_host/media/video_capture_controller_unittest.cc View 1 2 3 4 5 12 chunks +223 lines, -34 lines 0 comments Download
M content/browser/renderer_host/media/video_capture_device_client_unittest.cc View 1 2 chunks +6 lines, -6 lines 0 comments Download
M content/browser/renderer_host/media/video_capture_manager.cc View 1 2 3 chunks +7 lines, -11 lines 0 comments Download
M content/browser/renderer_host/media/video_frame_receiver_on_io_thread.h View 1 chunk +1 line, -1 line 0 comments Download
M content/browser/renderer_host/media/video_frame_receiver_on_io_thread.cc View 1 chunk +2 lines, -3 lines 0 comments Download
M media/capture/video/video_capture_device_client.h View 1 2 4 chunks +8 lines, -5 lines 0 comments Download
M media/capture/video/video_capture_device_client.cc View 1 2 6 chunks +22 lines, -2 lines 0 comments Download
M media/capture/video/video_frame_receiver.h View 1 2 3 4 1 chunk +9 lines, -1 line 0 comments Download
M services/video_capture/receiver_mojo_to_media_adapter.h View 1 chunk +1 line, -1 line 0 comments Download
M services/video_capture/receiver_mojo_to_media_adapter.cc View 1 chunk +2 lines, -6 lines 0 comments Download

Messages

Total messages: 42 (28 generated)
chfremer
mcasas@: PTAL miu@: FYI braveyao@: Are there any concerns from your side regarding the functional ...
3 years, 11 months ago (2017-01-18 20:38:15 UTC) #6
mcasas
In the spirit of fighting codebase complexity, can you add more unittests for these particular ...
3 years, 11 months ago (2017-01-20 22:41:32 UTC) #9
chfremer
PTAL Thanks for the suggestion to add tests. This actually uncovered a bug that I ...
3 years, 11 months ago (2017-01-25 23:45:24 UTC) #10
chfremer
On 2017/01/25 23:45:24, chfremer wrote: > PTAL > > Thanks for the suggestion to add ...
3 years, 10 months ago (2017-01-31 00:39:31 UTC) #15
miu
lgtm % nits: https://codereview.chromium.org/2607203002/diff/40001/media/capture/video/video_capture_device_client.h File media/capture/video/video_capture_device_client.h (right): https://codereview.chromium.org/2607203002/diff/40001/media/capture/video/video_capture_device_client.h#newcode103 media/capture/video/video_capture_device_client.h:103: std::set<int> buffer_ids_known_by_receiver_; nit: std::vector<int> instead, for ...
3 years, 10 months ago (2017-01-31 01:18:51 UTC) #16
mcasas
lgtm On the naming, I feel mostly like this answer: http://stackoverflow.com/questions/3592378/is-naming-variables-after-their-type-a-bad-practice#answer-3592498 https://codereview.chromium.org/2607203002/diff/20001/content/browser/renderer_host/media/video_capture_controller.cc File content/browser/renderer_host/media/video_capture_controller.cc (right): ...
3 years, 10 months ago (2017-01-31 01:39:39 UTC) #17
chfremer
On 2017/01/31 01:39:39, mcasas wrote: > lgtm > > > On the naming, I feel ...
3 years, 10 months ago (2017-01-31 18:50:32 UTC) #18
chfremer
Thanks for the review! Added a patch set to change the std::set to a std::vector. ...
3 years, 10 months ago (2017-01-31 18:54:28 UTC) #19
chfremer
PTAL I realized that introducing a static counter for generating buffer_ids in Patch Set 2 ...
3 years, 10 months ago (2017-01-31 22:57:40 UTC) #26
miu
PS5 lgtm too.
3 years, 10 months ago (2017-01-31 23:28:42 UTC) #27
mcasas
Couple of minor comments otherwise still lgtm https://codereview.chromium.org/2607203002/diff/100001/content/browser/renderer_host/media/video_capture_controller.cc File content/browser/renderer_host/media/video_capture_controller.cc (right): https://codereview.chromium.org/2607203002/diff/100001/content/browser/renderer_host/media/video_capture_controller.cc#newcode377 content/browser/renderer_host/media/video_capture_controller.cc:377: const int ...
3 years, 10 months ago (2017-02-03 23:24:22 UTC) #30
chfremer
Thanks for the review! Addressed mcasas@ comments. https://codereview.chromium.org/2607203002/diff/100001/content/browser/renderer_host/media/video_capture_controller.cc File content/browser/renderer_host/media/video_capture_controller.cc (right): https://codereview.chromium.org/2607203002/diff/100001/content/browser/renderer_host/media/video_capture_controller.cc#newcode377 content/browser/renderer_host/media/video_capture_controller.cc:377: const int ...
3 years, 10 months ago (2017-02-06 18:16:35 UTC) #34
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/2607203002/140001
3 years, 10 months ago (2017-02-06 20:26:41 UTC) #39
commit-bot: I haz the power
3 years, 10 months ago (2017-02-06 20:35:00 UTC) #42
Message was sent while issue was closed.
Committed patchset #6 (id:140001) as
https://chromium.googlesource.com/chromium/src/+/10e14c24b244e7f58074ae74b018...

Powered by Google App Engine
This is Rietveld 408576698