| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 REMOTING_PROTOCOL_CAPTURE_SCHEDULER_H_ | 5 #ifndef REMOTING_PROTOCOL_CAPTURE_SCHEDULER_H_ |
| 6 #define REMOTING_PROTOCOL_CAPTURE_SCHEDULER_H_ | 6 #define REMOTING_PROTOCOL_CAPTURE_SCHEDULER_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 void OnCaptureCompleted(); | 47 void OnCaptureCompleted(); |
| 48 | 48 |
| 49 // Notifies the scheduler that a frame has been encoded. The scheduler can | 49 // Notifies the scheduler that a frame has been encoded. The scheduler can |
| 50 // change |packet| if necessary, e.g. set |frame_id|. | 50 // change |packet| if necessary, e.g. set |frame_id|. |
| 51 void OnFrameEncoded(VideoPacket* packet); | 51 void OnFrameEncoded(VideoPacket* packet); |
| 52 | 52 |
| 53 // Notifies the scheduler that a frame has been sent. | 53 // Notifies the scheduler that a frame has been sent. |
| 54 void OnFrameSent(); | 54 void OnFrameSent(); |
| 55 | 55 |
| 56 // VideoFeedbackStub interface. | 56 // VideoFeedbackStub interface. |
| 57 void ProcessVideoAck(scoped_ptr<VideoAck> video_ack) override; | 57 void ProcessVideoAck(std::unique_ptr<VideoAck> video_ack) override; |
| 58 | 58 |
| 59 // Sets minimum interval between frames. | 59 // Sets minimum interval between frames. |
| 60 void set_minimum_interval(base::TimeDelta minimum_interval) { | 60 void set_minimum_interval(base::TimeDelta minimum_interval) { |
| 61 minimum_interval_ = minimum_interval; | 61 minimum_interval_ = minimum_interval; |
| 62 } | 62 } |
| 63 | 63 |
| 64 // Helper functions for tests. | 64 // Helper functions for tests. |
| 65 void SetTickClockForTest(scoped_ptr<base::TickClock> tick_clock); | 65 void SetTickClockForTest(std::unique_ptr<base::TickClock> tick_clock); |
| 66 void SetTimerForTest(scoped_ptr<base::Timer> timer); | 66 void SetTimerForTest(std::unique_ptr<base::Timer> timer); |
| 67 void SetNumOfProcessorsForTest(int num_of_processors); | 67 void SetNumOfProcessorsForTest(int num_of_processors); |
| 68 | 68 |
| 69 private: | 69 private: |
| 70 // Schedules |capture_timer_| to call CaptureNextFrame() at appropriate time. | 70 // Schedules |capture_timer_| to call CaptureNextFrame() at appropriate time. |
| 71 // Doesn't do anything if next frame cannot be captured yet (e.g. because | 71 // Doesn't do anything if next frame cannot be captured yet (e.g. because |
| 72 // there are too many frames being processed). | 72 // there are too many frames being processed). |
| 73 void ScheduleNextCapture(); | 73 void ScheduleNextCapture(); |
| 74 | 74 |
| 75 // Called by |capture_timer_|. Calls |capture_closure_| to start capturing a | 75 // Called by |capture_timer_|. Calls |capture_closure_| to start capturing a |
| 76 // new frame. | 76 // new frame. |
| 77 void CaptureNextFrame(); | 77 void CaptureNextFrame(); |
| 78 | 78 |
| 79 base::Closure capture_closure_; | 79 base::Closure capture_closure_; |
| 80 | 80 |
| 81 scoped_ptr<base::TickClock> tick_clock_; | 81 std::unique_ptr<base::TickClock> tick_clock_; |
| 82 | 82 |
| 83 // Timer used to schedule CaptureNextFrame(). | 83 // Timer used to schedule CaptureNextFrame(). |
| 84 scoped_ptr<base::Timer> capture_timer_; | 84 std::unique_ptr<base::Timer> capture_timer_; |
| 85 | 85 |
| 86 // Minimum interval between frames that determines maximum possible framerate. | 86 // Minimum interval between frames that determines maximum possible framerate. |
| 87 base::TimeDelta minimum_interval_; | 87 base::TimeDelta minimum_interval_; |
| 88 | 88 |
| 89 int num_of_processors_; | 89 int num_of_processors_; |
| 90 | 90 |
| 91 RunningSamples capture_time_; | 91 RunningSamples capture_time_; |
| 92 RunningSamples encode_time_; | 92 RunningSamples encode_time_; |
| 93 | 93 |
| 94 // Number of frames pending encoding. | 94 // Number of frames pending encoding. |
| (...skipping 15 matching lines...) Expand all Loading... |
| 110 | 110 |
| 111 base::ThreadChecker thread_checker_; | 111 base::ThreadChecker thread_checker_; |
| 112 | 112 |
| 113 DISALLOW_COPY_AND_ASSIGN(CaptureScheduler); | 113 DISALLOW_COPY_AND_ASSIGN(CaptureScheduler); |
| 114 }; | 114 }; |
| 115 | 115 |
| 116 } // namespace protocol | 116 } // namespace protocol |
| 117 } // namespace remoting | 117 } // namespace remoting |
| 118 | 118 |
| 119 #endif // REMOTING_PROTOCOL_CAPTURE_SCHEDULER_H_ | 119 #endif // REMOTING_PROTOCOL_CAPTURE_SCHEDULER_H_ |
| OLD | NEW |