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

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

Issue 2308533003: Break tight coupling of VideoCaptureDeviceClient to renderer_host (Closed)
Patch Set: miu'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_controller.h
diff --git a/content/browser/renderer_host/media/video_capture_controller.h b/content/browser/renderer_host/media/video_capture_controller.h
index a8a446d046bdd6e4fbd337e791da34dec64432cb..9674bdd09f3bbdf4f4b75c4c4cea3b177be122a1 100644
--- a/content/browser/renderer_host/media/video_capture_controller.h
+++ b/content/browser/renderer_host/media/video_capture_controller.h
@@ -57,7 +57,19 @@
namespace content {
class VideoCaptureBufferPool;
-class CONTENT_EXPORT VideoCaptureController {
+class CONTENT_EXPORT VideoFrameReceiver {
+ public:
+ virtual ~VideoFrameReceiver(){};
+
+ virtual void OnIncomingCapturedVideoFrame(
+ std::unique_ptr<media::VideoCaptureDevice::Client::Buffer> buffer,
+ const scoped_refptr<media::VideoFrame>& frame) = 0;
+ virtual void OnError() = 0;
+ virtual void OnLog(const std::string& message) = 0;
+ virtual void OnBufferDestroyed(int buffer_id_to_drop) = 0;
+};
+
+class CONTENT_EXPORT VideoCaptureController : public VideoFrameReceiver {
public:
// |max_buffers| is the maximum number of video frame buffers in-flight at any
// one time. This value should be based on the logical capacity of the
@@ -65,7 +77,7 @@ class CONTENT_EXPORT VideoCaptureController {
// capture requires more buffers than webcam capture because the pipeline is
// longer (it includes read-backs pending in the GPU pipeline).
explicit VideoCaptureController(int max_buffers);
- virtual ~VideoCaptureController();
+ ~VideoCaptureController() override;
base::WeakPtr<VideoCaptureController> GetWeakPtrForIOThread();
@@ -125,13 +137,13 @@ class CONTENT_EXPORT VideoCaptureController {
bool has_received_frames() const { return has_received_frames_; }
- // Worker functions on IO thread. Called by the VideoCaptureDeviceClient.
- virtual void DoIncomingCapturedVideoFrameOnIOThread(
+ // Implementation of VideoFrameReceiver interface:
+ void OnIncomingCapturedVideoFrame(
std::unique_ptr<media::VideoCaptureDevice::Client::Buffer> buffer,
- const scoped_refptr<media::VideoFrame>& frame);
- virtual void DoErrorOnIOThread();
- virtual void DoLogOnIOThread(const std::string& message);
- virtual void DoBufferDestroyedOnIOThread(int buffer_id_to_drop);
+ const scoped_refptr<media::VideoFrame>& frame) override;
+ void OnError() override;
+ void OnLog(const std::string& message) override;
+ void OnBufferDestroyed(int buffer_id_to_drop) override;
private:
struct ControllerClient;

Powered by Google App Engine
This is Rietveld 408576698