| OLD | NEW |
| 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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 // longer (it includes read-backs pending in the GPU pipeline). | 65 // longer (it includes read-backs pending in the GPU pipeline). |
| 66 explicit VideoCaptureController(int max_buffers); | 66 explicit VideoCaptureController(int max_buffers); |
| 67 virtual ~VideoCaptureController(); | 67 virtual ~VideoCaptureController(); |
| 68 | 68 |
| 69 base::WeakPtr<VideoCaptureController> GetWeakPtrForIOThread(); | 69 base::WeakPtr<VideoCaptureController> GetWeakPtrForIOThread(); |
| 70 | 70 |
| 71 // Return a new VideoCaptureDeviceClient to forward capture events to this | 71 // Return a new VideoCaptureDeviceClient to forward capture events to this |
| 72 // instance. Some device clients need to allocate resources for the given | 72 // instance. Some device clients need to allocate resources for the given |
| 73 // capture |format| and/or work on Capture Thread (|capture_task_runner|). | 73 // capture |format| and/or work on Capture Thread (|capture_task_runner|). |
| 74 scoped_ptr<media::VideoCaptureDevice::Client> NewDeviceClient( | 74 scoped_ptr<media::VideoCaptureDevice::Client> NewDeviceClient( |
| 75 const scoped_refptr<base::SingleThreadTaskRunner>& capture_task_runner); | 75 const scoped_refptr<base::SingleThreadTaskRunner>& capture_task_runner, |
| 76 const media::VideoCaptureFormat& format); |
| 76 | 77 |
| 77 // Start video capturing and try to use the resolution specified in |params|. | 78 // Start video capturing and try to use the resolution specified in |params|. |
| 78 // Buffers will be shared to the client as necessary. The client will continue | 79 // Buffers will be shared to the client as necessary. The client will continue |
| 79 // to receive frames from the device until RemoveClient() is called. | 80 // to receive frames from the device until RemoveClient() is called. |
| 80 void AddClient(VideoCaptureControllerID id, | 81 void AddClient(VideoCaptureControllerID id, |
| 81 VideoCaptureControllerEventHandler* event_handler, | 82 VideoCaptureControllerEventHandler* event_handler, |
| 82 base::ProcessHandle render_process, | 83 base::ProcessHandle render_process, |
| 83 media::VideoCaptureSessionId session_id, | 84 media::VideoCaptureSessionId session_id, |
| 84 const media::VideoCaptureParams& params); | 85 const media::VideoCaptureParams& params); |
| 85 | 86 |
| (...skipping 27 matching lines...) Expand all Loading... |
| 113 VideoCaptureControllerEventHandler* event_handler, | 114 VideoCaptureControllerEventHandler* event_handler, |
| 114 int buffer_id, | 115 int buffer_id, |
| 115 uint32 sync_point); | 116 uint32 sync_point); |
| 116 | 117 |
| 117 const media::VideoCaptureFormat& GetVideoCaptureFormat() const; | 118 const media::VideoCaptureFormat& GetVideoCaptureFormat() const; |
| 118 | 119 |
| 119 bool has_received_frames() const { return has_received_frames_; } | 120 bool has_received_frames() const { return has_received_frames_; } |
| 120 | 121 |
| 121 // Worker functions on IO thread. Called by the VideoCaptureDeviceClient. | 122 // Worker functions on IO thread. Called by the VideoCaptureDeviceClient. |
| 122 void DoIncomingCapturedVideoFrameOnIOThread( | 123 void DoIncomingCapturedVideoFrameOnIOThread( |
| 123 scoped_ptr<media::VideoCaptureDevice::Client::Buffer> buffer, | 124 const scoped_refptr<media::VideoCaptureDevice::Client::Buffer>& buffer, |
| 124 const scoped_refptr<media::VideoFrame>& frame, | 125 const scoped_refptr<media::VideoFrame>& frame, |
| 125 const base::TimeTicks& timestamp); | 126 const base::TimeTicks& timestamp); |
| 126 void DoErrorOnIOThread(); | 127 void DoErrorOnIOThread(); |
| 127 void DoLogOnIOThread(const std::string& message); | 128 void DoLogOnIOThread(const std::string& message); |
| 128 void DoBufferDestroyedOnIOThread(int buffer_id_to_drop); | 129 void DoBufferDestroyedOnIOThread(int buffer_id_to_drop); |
| 129 | 130 |
| 130 private: | 131 private: |
| 131 struct ControllerClient; | 132 struct ControllerClient; |
| 132 typedef std::list<ControllerClient*> ControllerClients; | 133 typedef std::list<ControllerClient*> ControllerClients; |
| 133 | 134 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 156 media::VideoCaptureFormat video_capture_format_; | 157 media::VideoCaptureFormat video_capture_format_; |
| 157 | 158 |
| 158 base::WeakPtrFactory<VideoCaptureController> weak_ptr_factory_; | 159 base::WeakPtrFactory<VideoCaptureController> weak_ptr_factory_; |
| 159 | 160 |
| 160 DISALLOW_COPY_AND_ASSIGN(VideoCaptureController); | 161 DISALLOW_COPY_AND_ASSIGN(VideoCaptureController); |
| 161 }; | 162 }; |
| 162 | 163 |
| 163 } // namespace content | 164 } // namespace content |
| 164 | 165 |
| 165 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_VIDEO_CAPTURE_CONTROLLER_H_ | 166 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_VIDEO_CAPTURE_CONTROLLER_H_ |
| OLD | NEW |