OLD | NEW |
1 // Copyright (c) 2011 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 #include "remoting/host/capture_scheduler.h" | 5 #include "remoting/protocol/capture_scheduler.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/sys_info.h" | 10 #include "base/sys_info.h" |
11 #include "base/time/default_tick_clock.h" | 11 #include "base/time/default_tick_clock.h" |
12 #include "base/time/time.h" | 12 #include "base/time/time.h" |
13 #include "remoting/proto/video.pb.h" | 13 #include "remoting/proto/video.pb.h" |
14 | 14 |
15 namespace { | 15 namespace { |
(...skipping 16 matching lines...) Expand all Loading... |
32 | 32 |
33 // Maximum number of unacknowledged frames. Ignored if the client doesn't | 33 // Maximum number of unacknowledged frames. Ignored if the client doesn't |
34 // support ACKs. This value was chosen experimentally, using synthetic | 34 // support ACKs. This value was chosen experimentally, using synthetic |
35 // performance tests (see ProtocolPerfTest), to maximize frame rate, while | 35 // performance tests (see ProtocolPerfTest), to maximize frame rate, while |
36 // keeping round-trip latency low. | 36 // keeping round-trip latency low. |
37 static const int kMaxUnacknowledgedFrames = 4; | 37 static const int kMaxUnacknowledgedFrames = 4; |
38 | 38 |
39 } // namespace | 39 } // namespace |
40 | 40 |
41 namespace remoting { | 41 namespace remoting { |
| 42 namespace protocol { |
42 | 43 |
43 // We assume that the number of available cores is constant. | 44 // We assume that the number of available cores is constant. |
44 CaptureScheduler::CaptureScheduler(const base::Closure& capture_closure) | 45 CaptureScheduler::CaptureScheduler(const base::Closure& capture_closure) |
45 : capture_closure_(capture_closure), | 46 : capture_closure_(capture_closure), |
46 tick_clock_(new base::DefaultTickClock()), | 47 tick_clock_(new base::DefaultTickClock()), |
47 capture_timer_(new base::Timer(false, false)), | 48 capture_timer_(new base::Timer(false, false)), |
48 minimum_interval_( | 49 minimum_interval_( |
49 base::TimeDelta::FromMilliseconds(kDefaultMinimumIntervalMs)), | 50 base::TimeDelta::FromMilliseconds(kDefaultMinimumIntervalMs)), |
50 num_of_processors_(base::SysInfo::NumberOfProcessors()), | 51 num_of_processors_(base::SysInfo::NumberOfProcessors()), |
51 capture_time_(kStatisticsWindow), | 52 capture_time_(kStatisticsWindow), |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 void CaptureScheduler::CaptureNextFrame() { | 172 void CaptureScheduler::CaptureNextFrame() { |
172 DCHECK(thread_checker_.CalledOnValidThread()); | 173 DCHECK(thread_checker_.CalledOnValidThread()); |
173 DCHECK(!is_paused_); | 174 DCHECK(!is_paused_); |
174 DCHECK(!capture_pending_); | 175 DCHECK(!capture_pending_); |
175 | 176 |
176 capture_pending_ = true; | 177 capture_pending_ = true; |
177 last_capture_started_time_ = tick_clock_->NowTicks(); | 178 last_capture_started_time_ = tick_clock_->NowTicks(); |
178 capture_closure_.Run(); | 179 capture_closure_.Run(); |
179 } | 180 } |
180 | 181 |
| 182 } // namespace protocol |
181 } // namespace remoting | 183 } // namespace remoting |
OLD | NEW |