OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 MEDIA_CAPTURE_THREAD_SAFE_CAPTURE_ORACLE_H_ | 5 #ifndef MEDIA_CAPTURE_THREAD_SAFE_CAPTURE_ORACLE_H_ |
6 #define MEDIA_CAPTURE_THREAD_SAFE_CAPTURE_ORACLE_H_ | 6 #define MEDIA_CAPTURE_THREAD_SAFE_CAPTURE_ORACLE_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
12 #include "media/base/media_export.h" | 12 #include "media/base/media_export.h" |
13 #include "media/base/video_frame.h" | 13 #include "media/base/video_frame.h" |
14 #include "media/capture/content/video_capture_oracle.h" | 14 #include "media/capture/content/video_capture_oracle.h" |
15 #include "media/capture/video/video_capture_device.h" | 15 #include "media/capture/video/video_capture_device.h" |
16 | 16 |
| 17 namespace tracked_objects { |
| 18 class Location; |
| 19 } // namespace tracked_objects |
| 20 |
17 namespace media { | 21 namespace media { |
18 | 22 |
19 struct VideoCaptureParams; | 23 struct VideoCaptureParams; |
20 class VideoFrame; | 24 class VideoFrame; |
21 | 25 |
22 // Thread-safe, refcounted proxy to the VideoCaptureOracle. This proxy wraps | 26 // Thread-safe, refcounted proxy to the VideoCaptureOracle. This proxy wraps |
23 // the VideoCaptureOracle, which decides which frames to capture, and a | 27 // the VideoCaptureOracle, which decides which frames to capture, and a |
24 // VideoCaptureDevice::Client, which allocates and receives the captured | 28 // VideoCaptureDevice::Client, which allocates and receives the captured |
25 // frames, in a lock to synchronize state between the two. | 29 // frames, in a lock to synchronize state between the two. |
26 class MEDIA_EXPORT ThreadSafeCaptureOracle | 30 class MEDIA_EXPORT ThreadSafeCaptureOracle |
(...skipping 29 matching lines...) Expand all Loading... |
56 gfx::Size GetCaptureSize() const; | 60 gfx::Size GetCaptureSize() const; |
57 | 61 |
58 // Updates capture resolution based on the supplied source size and the | 62 // Updates capture resolution based on the supplied source size and the |
59 // maximum frame size. | 63 // maximum frame size. |
60 void UpdateCaptureSize(const gfx::Size& source_size); | 64 void UpdateCaptureSize(const gfx::Size& source_size); |
61 | 65 |
62 // Stop new captures from happening (but doesn't forget the client). | 66 // Stop new captures from happening (but doesn't forget the client). |
63 void Stop(); | 67 void Stop(); |
64 | 68 |
65 // Signal an error to the client. | 69 // Signal an error to the client. |
66 void ReportError(const std::string& reason); | 70 void ReportError(const tracked_objects::Location& from_here, |
| 71 const std::string& reason); |
67 | 72 |
68 private: | 73 private: |
69 friend class base::RefCountedThreadSafe<ThreadSafeCaptureOracle>; | 74 friend class base::RefCountedThreadSafe<ThreadSafeCaptureOracle>; |
70 virtual ~ThreadSafeCaptureOracle(); | 75 virtual ~ThreadSafeCaptureOracle(); |
71 | 76 |
72 // Callback invoked on completion of all captures. | 77 // Callback invoked on completion of all captures. |
73 void DidCaptureFrame(int frame_number, | 78 void DidCaptureFrame(int frame_number, |
74 scoped_ptr<VideoCaptureDevice::Client::Buffer> buffer, | 79 scoped_ptr<VideoCaptureDevice::Client::Buffer> buffer, |
75 base::TimeTicks capture_begin_time, | 80 base::TimeTicks capture_begin_time, |
76 base::TimeDelta estimated_frame_duration, | 81 base::TimeDelta estimated_frame_duration, |
(...skipping 15 matching lines...) Expand all Loading... |
92 // Makes the decision to capture a frame. | 97 // Makes the decision to capture a frame. |
93 VideoCaptureOracle oracle_; | 98 VideoCaptureOracle oracle_; |
94 | 99 |
95 // The video capture parameters used to construct the oracle proxy. | 100 // The video capture parameters used to construct the oracle proxy. |
96 const VideoCaptureParams params_; | 101 const VideoCaptureParams params_; |
97 }; | 102 }; |
98 | 103 |
99 } // namespace media | 104 } // namespace media |
100 | 105 |
101 #endif // MEDIA_CAPTURE_THREAD_SAFE_CAPTURE_ORACLE_H_ | 106 #endif // MEDIA_CAPTURE_THREAD_SAFE_CAPTURE_ORACLE_H_ |
OLD | NEW |