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 #Depends on Patchset: Messages
Total messages: 11 (10 generated)
|