Chromium Code Reviews| 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_CONTENT_THREAD_SAFE_CAPTURE_ORACLE_H_ | 5 #ifndef MEDIA_CAPTURE_CONTENT_THREAD_SAFE_CAPTURE_ORACLE_H_ |
| 6 #define MEDIA_CAPTURE_CONTENT_THREAD_SAFE_CAPTURE_ORACLE_H_ | 6 #define MEDIA_CAPTURE_CONTENT_THREAD_SAFE_CAPTURE_ORACLE_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 31 : public base::RefCountedThreadSafe<ThreadSafeCaptureOracle> { | 31 : public base::RefCountedThreadSafe<ThreadSafeCaptureOracle> { |
| 32 public: | 32 public: |
| 33 ThreadSafeCaptureOracle(std::unique_ptr<VideoCaptureDevice::Client> client, | 33 ThreadSafeCaptureOracle(std::unique_ptr<VideoCaptureDevice::Client> client, |
| 34 const VideoCaptureParams& params, | 34 const VideoCaptureParams& params, |
| 35 bool enable_auto_throttling); | 35 bool enable_auto_throttling); |
| 36 | 36 |
| 37 // Called when a captured frame is available or an error has occurred. | 37 // Called when a captured frame is available or an error has occurred. |
| 38 // If |success| is true then |frame| is valid and |timestamp| indicates when | 38 // If |success| is true then |frame| is valid and |timestamp| indicates when |
| 39 // the frame was painted. | 39 // the frame was painted. |
| 40 // If |success| is false, all other parameters are invalid. | 40 // If |success| is false, all other parameters are invalid. |
| 41 typedef base::Callback<void(const scoped_refptr<VideoFrame>& frame, | 41 typedef base::Callback<void(scoped_refptr<VideoFrame> frame, |
| 42 base::TimeTicks timestamp, | 42 base::TimeTicks timestamp, |
| 43 bool success)> CaptureFrameCallback; | 43 bool success)> |
| 44 CaptureFrameCallback; | |
|
mcasas
2016/11/11 23:46:15
nit: maybe update to 'using ... ?
| |
| 44 | 45 |
| 45 // Record a change |event| along with its |damage_rect| and |event_time|, and | 46 // Record a change |event| along with its |damage_rect| and |event_time|, and |
| 46 // then make a decision whether to proceed with capture. The decision is based | 47 // then make a decision whether to proceed with capture. The decision is based |
| 47 // on recent event history, capture activity, and the availability of | 48 // on recent event history, capture activity, and the availability of |
| 48 // resources. | 49 // resources. |
| 49 // | 50 // |
| 50 // If this method returns false, the caller should take no further action. | 51 // If this method returns false, the caller should take no further action. |
| 51 // Otherwise, |storage| is set to the destination for the video frame capture | 52 // Otherwise, |storage| is set to the destination for the video frame capture |
| 52 // and the caller should initiate capture. Then, once the video frame has | 53 // and the caller should initiate capture. Then, once the video frame has |
| 53 // been populated with its content, or if capture failed, the |callback| | 54 // been populated with its content, or if capture failed, the |callback| |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 93 private: | 94 private: |
| 94 friend class base::RefCountedThreadSafe<ThreadSafeCaptureOracle>; | 95 friend class base::RefCountedThreadSafe<ThreadSafeCaptureOracle>; |
| 95 virtual ~ThreadSafeCaptureOracle(); | 96 virtual ~ThreadSafeCaptureOracle(); |
| 96 | 97 |
| 97 // Callback invoked on completion of all captures. | 98 // Callback invoked on completion of all captures. |
| 98 void DidCaptureFrame( | 99 void DidCaptureFrame( |
| 99 int frame_number, | 100 int frame_number, |
| 100 std::unique_ptr<VideoCaptureDevice::Client::Buffer> buffer, | 101 std::unique_ptr<VideoCaptureDevice::Client::Buffer> buffer, |
| 101 base::TimeTicks capture_begin_time, | 102 base::TimeTicks capture_begin_time, |
| 102 base::TimeDelta estimated_frame_duration, | 103 base::TimeDelta estimated_frame_duration, |
| 103 const scoped_refptr<VideoFrame>& frame, | 104 scoped_refptr<VideoFrame> frame, |
| 104 base::TimeTicks reference_time, | 105 base::TimeTicks reference_time, |
| 105 bool success); | 106 bool success); |
| 106 | 107 |
| 107 // Callback invoked once all consumers have finished with a delivered video | 108 // Callback invoked once all consumers have finished with a delivered video |
| 108 // frame. Consumer feedback signals are scanned from the frame's |metadata|. | 109 // frame. Consumer feedback signals are scanned from the frame's |metadata|. |
| 109 void DidConsumeFrame(int frame_number, | 110 void DidConsumeFrame(int frame_number, |
| 110 const media::VideoFrameMetadata* metadata); | 111 const media::VideoFrameMetadata* metadata); |
| 111 | 112 |
| 112 // Protects everything below it. | 113 // Protects everything below it. |
| 113 mutable base::Lock lock_; | 114 mutable base::Lock lock_; |
| 114 | 115 |
| 115 // Recipient of our capture activity. | 116 // Recipient of our capture activity. |
| 116 std::unique_ptr<VideoCaptureDevice::Client> client_; | 117 std::unique_ptr<VideoCaptureDevice::Client> client_; |
| 117 | 118 |
| 118 // Makes the decision to capture a frame. | 119 // Makes the decision to capture a frame. |
| 119 VideoCaptureOracle oracle_; | 120 VideoCaptureOracle oracle_; |
| 120 | 121 |
| 121 // The video capture parameters used to construct the oracle proxy. | 122 // The video capture parameters used to construct the oracle proxy. |
| 122 const VideoCaptureParams params_; | 123 const VideoCaptureParams params_; |
| 123 }; | 124 }; |
| 124 | 125 |
| 125 } // namespace media | 126 } // namespace media |
| 126 | 127 |
| 127 #endif // MEDIA_CAPTURE_CONTENT_THREAD_SAFE_CAPTURE_ORACLE_H_ | 128 #endif // MEDIA_CAPTURE_CONTENT_THREAD_SAFE_CAPTURE_ORACLE_H_ |
| OLD | NEW |