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

Unified Diff: content/browser/renderer_host/media/video_capture_device_client.h

Issue 1064963002: VideoCapture: add support for GpuMemoryBuffer allocation and lifetime mgmt in VideoCaptureBufferPool (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/browser/renderer_host/media/video_capture_device_client.h
diff --git a/content/browser/renderer_host/media/video_capture_device_client.h b/content/browser/renderer_host/media/video_capture_device_client.h
index 7da95da8e75174d4440a68122547119bed32c8d0..d194379b0401e032304cd865d8d5e3e033e6c763 100644
--- a/content/browser/renderer_host/media/video_capture_device_client.h
+++ b/content/browser/renderer_host/media/video_capture_device_client.h
@@ -24,12 +24,21 @@ class VideoCaptureController;
// often be called on some auxiliary thread depending on the platform and the
// device type; including, for example, the DirectShow thread on Windows, the
// v4l2_thread on Linux, and the UI thread for tab capture.
+//
+// It has an internal ref counted TextureWrapperDelegate class used to wrap
+// incoming GpuMemoryBuffers into Texture backed Videoframes. This class creates
+// and manages the necessary interactions with the GPU process, notably an
+// offscreen Context to avoid janking the UI thread. This delegate is also
+// needed since the frame producer owns VideoCaptureDeviceClient, but this needs
+// to launch PostTask()s to the delegate.
class CONTENT_EXPORT VideoCaptureDeviceClient
: public media::VideoCaptureDevice::Client {
public:
VideoCaptureDeviceClient(
const base::WeakPtr<VideoCaptureController>& controller,
- const scoped_refptr<VideoCaptureBufferPool>& buffer_pool);
+ const scoped_refptr<VideoCaptureBufferPool>& buffer_pool,
+ const scoped_refptr<base::SingleThreadTaskRunner>& capture_task_runner,
+ const media::VideoCaptureFormat& capture_format);
~VideoCaptureDeviceClient() override;
// VideoCaptureDevice::Client implementation.
@@ -50,6 +59,9 @@ class CONTENT_EXPORT VideoCaptureDeviceClient
scoped_refptr<Buffer> ReserveOutputBuffer(
media::VideoPixelFormat format,
const gfx::Size& dimensions) override;
+ void OnIncomingCapturedBuffer(const scoped_refptr<Buffer>& buffer,
+ const media::VideoCaptureFormat& frame_format,
+ const base::TimeTicks& timestamp) override;
void OnIncomingCapturedVideoFrame(
const scoped_refptr<Buffer>& buffer,
const scoped_refptr<media::VideoFrame>& frame,
@@ -64,6 +76,13 @@ class CONTENT_EXPORT VideoCaptureDeviceClient
// The pool of shared-memory buffers used for capturing.
const scoped_refptr<VideoCaptureBufferPool> buffer_pool_;
+ // Internal delegate for GpuMemoryBuffer-into-VideoFrame wrapping. Created if
+ // |capture_format| on constructor specifies PIXEL_FORMAT_GPUMEMORYBUFFER.
+ class TextureWrapperDelegate;
+ scoped_refptr<TextureWrapperDelegate> wrapper_delegate_;
+ // Reference to Capture Thread task runner, where |wrapper_delegate_| lives.
+ const scoped_refptr<base::SingleThreadTaskRunner> capture_task_runner_;
+
media::VideoPixelFormat last_captured_pixel_format_;
DISALLOW_COPY_AND_ASSIGN(VideoCaptureDeviceClient);

Powered by Google App Engine
This is Rietveld 408576698