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

Issue 2583603002: [Mojo Video Capture] Split OnIncomingCapturedVideoFrame() to OnNewBuffer() + OnFrameReadyInBuffer() (Closed)

Created:
4 years ago by chfremer
Modified:
3 years, 11 months ago
Reviewers:
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] Split OnIncomingCapturedVideoFrame() to OnNewBuffer() and OnFrameReadyInBuffer() In interface media::VideoFrameReceiver, instead of method OnIncomingCapturedVideoFrame() use two methods OnNewBufferHandle() and OnFrameReadyInBuffer(). This matches the Mojo interface exposed to the Renderers by VideoCaptureHost. Instead of requiring the VideoFrameReceiver implementation (VideoCaptureController) to set and release a consumer hold, we pass in a |buffer_read_permission| that encapsulates the hold using the RAII pattern. This allows us to remove the |frame_buffer_pool_| member from VideoCaptureController. Replace OnBufferDestroyed(), which could only be called while a buffer was not in use by the VideoFrameReceiver with OnBufferRetired(), which may be called while a buffer is in use. This is a functional change that is required for supporting the use case of Android Chromium shutting down the VideoCaptureDevice and VideoCaptureDeviceClient when going to the background. Before this CL, the shared buffers and the buffer pool would be kept alive while in the bakground, and would be reused with newly created VCDevice and VCDeviceClient when being restored to the foreground. 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 mean exposing this as some new type of "suspended" mode for AbstractDevice (which is different from the existing suspend/resume). Instead of this, we opt for the alternative solution, which is to allow a complete shutdown of AbstractDevice, including the buffer pool, while the app is in the background. 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, while holding |buffer_read_permission|. Use struct mojom::VideoFrameInfo when receiving frames as media::VideoFrameReceiver (e.g. VideoCaptureController). This will allow us to have it receive frames from the Mojo service in a later step. This CL is part of the Mojo Video Capture work. For the bigger picture, see [1] CL1.9.11 BUG=584797 TEST= content_unittests --gtest_filter="*Video*", video_capture_unittests, 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/

Patch Set 1 #

Patch Set 2 : Improve naming and fix Android background issue #

Unified diffs Side-by-side diffs Delta from patch set Stats (+420 lines, -326 lines) Patch
M content/browser/renderer_host/media/video_capture_controller.h View 1 5 chunks +31 lines, -25 lines 0 comments Download
M content/browser/renderer_host/media/video_capture_controller.cc View 1 16 chunks +159 lines, -104 lines 0 comments Download
M content/browser/renderer_host/media/video_capture_controller_event_handler.h View 2 chunks +2 lines, -1 line 0 comments Download
M content/browser/renderer_host/media/video_capture_controller_unittest.cc View 1 8 chunks +18 lines, -45 lines 0 comments Download
M content/browser/renderer_host/media/video_capture_device_client_unittest.cc View 1 2 chunks +14 lines, -9 lines 0 comments Download
M content/browser/renderer_host/media/video_capture_gpu_jpeg_decoder.cc View 1 2 chunks +15 lines, -4 lines 0 comments Download
M content/browser/renderer_host/media/video_capture_host.h View 1 chunk +1 line, -1 line 0 comments Download
M content/browser/renderer_host/media/video_capture_host.cc View 2 chunks +3 lines, -14 lines 0 comments Download
M content/browser/renderer_host/media/video_capture_manager.h View 1 chunk +0 lines, -1 line 0 comments Download
M content/browser/renderer_host/media/video_capture_manager.cc View 1 7 chunks +9 lines, -44 lines 0 comments Download
M content/browser/renderer_host/media/video_capture_manager_unittest.cc View 1 chunk +1 line, -1 line 0 comments Download
M content/browser/renderer_host/media/video_frame_receiver_on_io_thread.h View 1 1 chunk +9 lines, -4 lines 0 comments Download
M content/browser/renderer_host/media/video_frame_receiver_on_io_thread.cc View 1 1 chunk +24 lines, -12 lines 0 comments Download
M media/capture/BUILD.gn View 1 chunk +4 lines, -0 lines 0 comments Download
M media/capture/video/video_capture_device.h View 1 1 chunk +0 lines, -8 lines 0 comments Download
M media/capture/video/video_capture_device_client.h View 1 3 chunks +8 lines, -0 lines 0 comments Download
M media/capture/video/video_capture_device_client.cc View 1 8 chunks +63 lines, -31 lines 0 comments Download
M media/capture/video/video_capture_jpeg_decoder.h View 1 2 chunks +6 lines, -2 lines 0 comments Download
M media/capture/video/video_frame_receiver.h View 1 2 chunks +31 lines, -4 lines 0 comments Download
M services/video_capture/receiver_mojo_to_media_adapter.h View 1 1 chunk +9 lines, -4 lines 0 comments Download
M services/video_capture/receiver_mojo_to_media_adapter.cc View 1 3 chunks +13 lines, -12 lines 0 comments Download

Depends on Patchset:

Messages

Total messages: 11 (10 generated)
chfremer
3 years, 11 months ago (2016-12-29 20:02:08 UTC) #11

Powered by Google App Engine
This is Rietveld 408576698