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

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

Issue 2308533003: Break tight coupling of VideoCaptureDeviceClient to renderer_host (Closed)
Patch Set: mcasas' & emircan's comments Created 4 years, 3 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 c5447ca18e74eed9969270fb657a72e2aefd87f6..874eb58263954f07fe90aa209a12225fbf1c764e 100644
--- a/content/browser/renderer_host/media/video_capture_device_client.h
+++ b/content/browser/renderer_host/media/video_capture_device_client.h
@@ -17,19 +17,23 @@
#include "media/capture/video/video_capture_device.h"
namespace content {
-class VideoCaptureBufferPool;
-class VideoCaptureController;
-class VideoCaptureGpuJpegDecoder;
-
-// Receives events from the VideoCaptureDevice and posts them to a |controller_|
-// on the IO thread. An instance of this class may safely outlive its target
-// VideoCaptureController. This is a shallow class meant to convert incoming
-// frames and holds no significant state.
+class ProducerVideoCaptureBufferPool;
+class VideoFrameReceiver;
+class VideoCaptureJpegDecoder;
+
+using VideoCaptureJpegDecoderFactoryCB =
+ base::Callback<std::unique_ptr<VideoCaptureJpegDecoder>()>;
+
+// Implementation of media::VideoCaptureDevice::Client that uses a buffer pool
mcasas 2016/09/09 22:28:02 nit: only one space between "of" and "media"
chfremer 2016/09/12 18:31:22 Done.
+// to provide buffers and converts incoming data to the I420 format for
+// consumption by a given VideoFrameReceiver.
//
// Methods of this class may be called from any thread, and in practice will
// 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.
+// The owner is repsonsible for making sure that the instance outlives these
mcasas 2016/09/09 22:28:02 nit: s/repsonsible/responsible/
chfremer 2016/09/12 18:31:22 Done.
+// calls.
//
// It has an internal ref counted TextureWrapHelper class used to wrap incoming
// GpuMemoryBuffers into Texture backed VideoFrames. This class creates and
@@ -40,8 +44,9 @@ class CONTENT_EXPORT VideoCaptureDeviceClient
public base::SupportsWeakPtr<VideoCaptureDeviceClient> {
public:
VideoCaptureDeviceClient(
- const base::WeakPtr<VideoCaptureController>& controller,
- const scoped_refptr<VideoCaptureBufferPool>& buffer_pool);
+ std::unique_ptr<VideoFrameReceiver> receiver,
+ const scoped_refptr<ProducerVideoCaptureBufferPool>& buffer_pool,
+ const VideoCaptureJpegDecoderFactoryCB& jpeg_decoder_factory);
~VideoCaptureDeviceClient() override;
// VideoCaptureDevice::Client implementation.
@@ -91,17 +96,17 @@ class CONTENT_EXPORT VideoCaptureDeviceClient
uint8_t** u_plane_data,
uint8_t** v_plane_data);
- // The controller to which we post events.
- const base::WeakPtr<VideoCaptureController> controller_;
+ // The receiver to which we post events.
+ const std::unique_ptr<VideoFrameReceiver> receiver_;
- // Hardware JPEG decoder.
- std::unique_ptr<VideoCaptureGpuJpegDecoder> external_jpeg_decoder_;
+ const VideoCaptureJpegDecoderFactoryCB jpeg_decoder_factory_;
mcasas 2016/09/09 22:28:02 nit : s/jpeg_decoder_factory_/jpeg_decoder_factory
emircan 2016/09/10 00:08:46 +1
chfremer 2016/09/12 18:31:22 Done.
+ std::unique_ptr<VideoCaptureJpegDecoder> external_jpeg_decoder_;
// Whether |external_jpeg_decoder_| has been initialized.
bool external_jpeg_decoder_initialized_;
// The pool of shared-memory buffers used for capturing.
- const scoped_refptr<VideoCaptureBufferPool> buffer_pool_;
+ const scoped_refptr<ProducerVideoCaptureBufferPool> buffer_pool_;
#if DCHECK_IS_ON()
// Counter used to track the number of times consecutive capture buffers are

Powered by Google App Engine
This is Rietveld 408576698