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

Side by Side Diff: content/browser/renderer_host/media/video_capture_controller.h

Issue 2214533002: move //media/capture to //device/capture (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 // 4 //
5 // VideoCaptureController is the glue between a VideoCaptureDevice and all 5 // VideoCaptureController is the glue between a VideoCaptureDevice and all
6 // VideoCaptureHosts that have connected to it. A controller exists on behalf of 6 // VideoCaptureHosts that have connected to it. A controller exists on behalf of
7 // one (and only one) VideoCaptureDevice; both are owned by the 7 // one (and only one) VideoCaptureDevice; both are owned by the
8 // VideoCaptureManager. 8 // VideoCaptureManager.
9 // 9 //
10 // The VideoCaptureController is responsible for: 10 // The VideoCaptureController is responsible for:
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 #include <memory> 44 #include <memory>
45 45
46 #include "base/compiler_specific.h" 46 #include "base/compiler_specific.h"
47 #include "base/macros.h" 47 #include "base/macros.h"
48 #include "base/memory/ref_counted.h" 48 #include "base/memory/ref_counted.h"
49 #include "base/memory/weak_ptr.h" 49 #include "base/memory/weak_ptr.h"
50 #include "base/process/process.h" 50 #include "base/process/process.h"
51 #include "content/browser/renderer_host/media/video_capture_controller_event_han dler.h" 51 #include "content/browser/renderer_host/media/video_capture_controller_event_han dler.h"
52 #include "content/common/content_export.h" 52 #include "content/common/content_export.h"
53 #include "content/common/media/video_capture.h" 53 #include "content/common/media/video_capture.h"
54 #include "device/capture/video/video_capture_device.h"
54 #include "media/base/video_capture_types.h" 55 #include "media/base/video_capture_types.h"
55 #include "media/capture/video/video_capture_device.h"
56 56
57 namespace content { 57 namespace content {
58 class VideoCaptureBufferPool; 58 class VideoCaptureBufferPool;
59 59
60 class CONTENT_EXPORT VideoCaptureController { 60 class CONTENT_EXPORT VideoCaptureController {
61 public: 61 public:
62 // |max_buffers| is the maximum number of video frame buffers in-flight at any 62 // |max_buffers| is the maximum number of video frame buffers in-flight at any
63 // one time. This value should be based on the logical capacity of the 63 // one time. This value should be based on the logical capacity of the
64 // capture pipeline, and not on hardware performance. For example, tab 64 // capture pipeline, and not on hardware performance. For example, tab
65 // capture requires more buffers than webcam capture because the pipeline is 65 // capture requires more buffers than webcam capture because the pipeline is
66 // longer (it includes read-backs pending in the GPU pipeline). 66 // longer (it includes read-backs pending in the GPU pipeline).
67 explicit VideoCaptureController(int max_buffers); 67 explicit VideoCaptureController(int max_buffers);
68 virtual ~VideoCaptureController(); 68 virtual ~VideoCaptureController();
69 69
70 base::WeakPtr<VideoCaptureController> GetWeakPtrForIOThread(); 70 base::WeakPtr<VideoCaptureController> GetWeakPtrForIOThread();
71 71
72 // Return a new VideoCaptureDeviceClient to forward capture events to this 72 // Return a new VideoCaptureDeviceClient to forward capture events to this
73 // instance. 73 // instance.
74 std::unique_ptr<media::VideoCaptureDevice::Client> NewDeviceClient(); 74 std::unique_ptr<device::VideoCaptureDevice::Client> NewDeviceClient();
75 75
76 // Start video capturing and try to use the resolution specified in |params|. 76 // Start video capturing and try to use the resolution specified in |params|.
77 // Buffers will be shared to the client as necessary. The client will continue 77 // Buffers will be shared to the client as necessary. The client will continue
78 // to receive frames from the device until RemoveClient() is called. 78 // to receive frames from the device until RemoveClient() is called.
79 void AddClient(VideoCaptureControllerID id, 79 void AddClient(VideoCaptureControllerID id,
80 VideoCaptureControllerEventHandler* event_handler, 80 VideoCaptureControllerEventHandler* event_handler,
81 base::ProcessHandle render_process, 81 base::ProcessHandle render_process,
82 media::VideoCaptureSessionId session_id, 82 media::VideoCaptureSessionId session_id,
83 const media::VideoCaptureParams& params); 83 const media::VideoCaptureParams& params);
84 84
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 int buffer_id, 120 int buffer_id,
121 const gpu::SyncToken& sync_token, 121 const gpu::SyncToken& sync_token,
122 double consumer_resource_utilization); 122 double consumer_resource_utilization);
123 123
124 const media::VideoCaptureFormat& GetVideoCaptureFormat() const; 124 const media::VideoCaptureFormat& GetVideoCaptureFormat() const;
125 125
126 bool has_received_frames() const { return has_received_frames_; } 126 bool has_received_frames() const { return has_received_frames_; }
127 127
128 // Worker functions on IO thread. Called by the VideoCaptureDeviceClient. 128 // Worker functions on IO thread. Called by the VideoCaptureDeviceClient.
129 virtual void DoIncomingCapturedVideoFrameOnIOThread( 129 virtual void DoIncomingCapturedVideoFrameOnIOThread(
130 std::unique_ptr<media::VideoCaptureDevice::Client::Buffer> buffer, 130 std::unique_ptr<device::VideoCaptureDevice::Client::Buffer> buffer,
131 const scoped_refptr<media::VideoFrame>& frame); 131 const scoped_refptr<media::VideoFrame>& frame);
132 virtual void DoErrorOnIOThread(); 132 virtual void DoErrorOnIOThread();
133 virtual void DoLogOnIOThread(const std::string& message); 133 virtual void DoLogOnIOThread(const std::string& message);
134 virtual void DoBufferDestroyedOnIOThread(int buffer_id_to_drop); 134 virtual void DoBufferDestroyedOnIOThread(int buffer_id_to_drop);
135 135
136 private: 136 private:
137 struct ControllerClient; 137 struct ControllerClient;
138 typedef std::list<ControllerClient*> ControllerClients; 138 typedef std::list<ControllerClient*> ControllerClients;
139 139
140 // Notify renderer that a new buffer has been created. 140 // Notify renderer that a new buffer has been created.
141 void DoNewBufferOnIOThread(ControllerClient* client, 141 void DoNewBufferOnIOThread(ControllerClient* client,
142 media::VideoCaptureDevice::Client::Buffer* buffer, 142 device::VideoCaptureDevice::Client::Buffer* buffer,
143 const scoped_refptr<media::VideoFrame>& frame); 143 const scoped_refptr<media::VideoFrame>& frame);
144 144
145 // Find a client of |id| and |handler| in |clients|. 145 // Find a client of |id| and |handler| in |clients|.
146 ControllerClient* FindClient(VideoCaptureControllerID id, 146 ControllerClient* FindClient(VideoCaptureControllerID id,
147 VideoCaptureControllerEventHandler* handler, 147 VideoCaptureControllerEventHandler* handler,
148 const ControllerClients& clients); 148 const ControllerClients& clients);
149 149
150 // Find a client of |session_id| in |clients|. 150 // Find a client of |session_id| in |clients|.
151 ControllerClient* FindClient(int session_id, 151 ControllerClient* FindClient(int session_id,
152 const ControllerClients& clients); 152 const ControllerClients& clients);
(...skipping 14 matching lines...) Expand all
167 media::VideoCaptureFormat video_capture_format_; 167 media::VideoCaptureFormat video_capture_format_;
168 168
169 base::WeakPtrFactory<VideoCaptureController> weak_ptr_factory_; 169 base::WeakPtrFactory<VideoCaptureController> weak_ptr_factory_;
170 170
171 DISALLOW_COPY_AND_ASSIGN(VideoCaptureController); 171 DISALLOW_COPY_AND_ASSIGN(VideoCaptureController);
172 }; 172 };
173 173
174 } // namespace content 174 } // namespace content
175 175
176 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_VIDEO_CAPTURE_CONTROLLER_H_ 176 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_VIDEO_CAPTURE_CONTROLLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698