| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #ifndef CONTENT_BROWSER_RENDERER_HOST_VIDEO_CAPTURE_DEVICE_IMPL_H_ | 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_VIDEO_CAPTURE_DEVICE_IMPL_H_ |
| 6 #define CONTENT_BROWSER_RENDERER_HOST_VIDEO_CAPTURE_DEVICE_IMPL_H_ | 6 #define CONTENT_BROWSER_RENDERER_HOST_VIDEO_CAPTURE_DEVICE_IMPL_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 } | 64 } |
| 65 | 65 |
| 66 // Updates capture resolution based on the supplied source size and the | 66 // Updates capture resolution based on the supplied source size and the |
| 67 // maximum frame size. | 67 // maximum frame size. |
| 68 void UpdateCaptureSize(const gfx::Size& source_size); | 68 void UpdateCaptureSize(const gfx::Size& source_size); |
| 69 | 69 |
| 70 // Stop new captures from happening (but doesn't forget the client). | 70 // Stop new captures from happening (but doesn't forget the client). |
| 71 void Stop(); | 71 void Stop(); |
| 72 | 72 |
| 73 // Signal an error to the client. | 73 // Signal an error to the client. |
| 74 void ReportError(); | 74 void ReportError(const std::string& reason); |
| 75 | 75 |
| 76 private: | 76 private: |
| 77 friend class base::RefCountedThreadSafe<ThreadSafeCaptureOracle>; | 77 friend class base::RefCountedThreadSafe<ThreadSafeCaptureOracle>; |
| 78 virtual ~ThreadSafeCaptureOracle(); | 78 virtual ~ThreadSafeCaptureOracle(); |
| 79 | 79 |
| 80 // Callback invoked on completion of all captures. | 80 // Callback invoked on completion of all captures. |
| 81 void DidCaptureFrame( | 81 void DidCaptureFrame( |
| 82 scoped_refptr<media::VideoCaptureDevice::Client::Buffer> buffer, | 82 scoped_refptr<media::VideoCaptureDevice::Client::Buffer> buffer, |
| 83 int frame_number, | 83 int frame_number, |
| 84 base::TimeTicks timestamp, | 84 base::TimeTicks timestamp, |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 kError | 158 kError |
| 159 }; | 159 }; |
| 160 | 160 |
| 161 void TransitionStateTo(State next_state); | 161 void TransitionStateTo(State next_state); |
| 162 | 162 |
| 163 // Called on the IO thread in response to StartCaptureMachine(). | 163 // Called on the IO thread in response to StartCaptureMachine(). |
| 164 // |success| is true if capture machine succeeded to start. | 164 // |success| is true if capture machine succeeded to start. |
| 165 void CaptureStarted(bool success); | 165 void CaptureStarted(bool success); |
| 166 | 166 |
| 167 // Stops capturing and notifies client_ of an error state. | 167 // Stops capturing and notifies client_ of an error state. |
| 168 void Error(); | 168 void Error(const std::string& reason); |
| 169 | 169 |
| 170 // Tracks that all activity occurs on the media stream manager's thread. | 170 // Tracks that all activity occurs on the media stream manager's thread. |
| 171 base::ThreadChecker thread_checker_; | 171 base::ThreadChecker thread_checker_; |
| 172 | 172 |
| 173 // Current lifecycle state. | 173 // Current lifecycle state. |
| 174 State state_; | 174 State state_; |
| 175 | 175 |
| 176 // Tracks the CaptureMachine that's doing work on our behalf on the UI thread. | 176 // Tracks the CaptureMachine that's doing work on our behalf on the UI thread. |
| 177 // This value should never be dereferenced by this class, other than to | 177 // This value should never be dereferenced by this class, other than to |
| 178 // create and destroy it on the UI thread. | 178 // create and destroy it on the UI thread. |
| 179 scoped_ptr<VideoCaptureMachine> capture_machine_; | 179 scoped_ptr<VideoCaptureMachine> capture_machine_; |
| 180 | 180 |
| 181 // Our thread-safe capture oracle which serves as the gateway to the video | 181 // Our thread-safe capture oracle which serves as the gateway to the video |
| 182 // capture pipeline. Besides the WCVCD itself, it is the only component of the | 182 // capture pipeline. Besides the WCVCD itself, it is the only component of the |
| 183 // system with direct access to |client_|. | 183 // system with direct access to |client_|. |
| 184 scoped_refptr<ThreadSafeCaptureOracle> oracle_proxy_; | 184 scoped_refptr<ThreadSafeCaptureOracle> oracle_proxy_; |
| 185 | 185 |
| 186 DISALLOW_COPY_AND_ASSIGN(VideoCaptureDeviceImpl); | 186 DISALLOW_COPY_AND_ASSIGN(VideoCaptureDeviceImpl); |
| 187 }; | 187 }; |
| 188 | 188 |
| 189 | 189 |
| 190 } // namespace content | 190 } // namespace content |
| 191 | 191 |
| 192 #endif // CONTENT_BROWSER_RENDERER_HOST_VIDEO_CAPTURE_DEVICE_IMPL_H_ | 192 #endif // CONTENT_BROWSER_RENDERER_HOST_VIDEO_CAPTURE_DEVICE_IMPL_H_ |
| OLD | NEW |