| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_HOST_RECORD_SESSION_H_ | 5 #ifndef REMOTING_HOST_SCREEN_RECORDER_H_ |
| 6 #define REMOTING_HOST_RECORD_SESSION_H_ | 6 #define REMOTING_HOST_SCREEN_RECORDER_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| 11 #include "base/message_loop.h" | 11 #include "base/message_loop.h" |
| 12 #include "base/ref_counted.h" | 12 #include "base/ref_counted.h" |
| 13 #include "base/scoped_ptr.h" | 13 #include "base/scoped_ptr.h" |
| 14 #include "base/time.h" | 14 #include "base/time.h" |
| 15 #include "remoting/base/encoder.h" | 15 #include "remoting/base/encoder.h" |
| 16 #include "remoting/host/capturer.h" | 16 #include "remoting/host/capturer.h" |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 // | ............. ............ .......... | 49 // | ............. ............ .......... |
| 50 // | . Capture . . . . Send . | 50 // | . Capture . . . . Send . |
| 51 // | ............. . . .......... | 51 // | ............. . . .......... |
| 52 // | . Encode . | 52 // | . Encode . |
| 53 // | . . | 53 // | . . |
| 54 // | . . | 54 // | . . |
| 55 // | ............ | 55 // | ............ |
| 56 // | Time | 56 // | Time |
| 57 // v | 57 // v |
| 58 // | 58 // |
| 59 // SessionManager has the following responsibilities: | 59 // ScreenRecorder has the following responsibilities: |
| 60 // 1. Make sure capture and encode occurs no more frequently than |rate|. | 60 // 1. Make sure capture and encode occurs no more frequently than |rate|. |
| 61 // 2. Make sure there is at most one outstanding capture not being encoded. | 61 // 2. Make sure there is at most one outstanding capture not being encoded. |
| 62 // 3. Distribute tasks on three threads on a timely fashion to minimize latency. | 62 // 3. Distribute tasks on three threads on a timely fashion to minimize latency. |
| 63 class SessionManager : public base::RefCountedThreadSafe<SessionManager> { | 63 class ScreenRecorder : public base::RefCountedThreadSafe<ScreenRecorder> { |
| 64 public: | 64 public: |
| 65 | 65 |
| 66 // Construct a SessionManager. Message loops and threads are provided. | 66 // Construct a ScreenRecorder. Message loops and threads are provided. |
| 67 // This object does not own capturer and encoder. | 67 // This object does not own capturer and encoder. |
| 68 SessionManager(MessageLoop* capture_loop, | 68 ScreenRecorder(MessageLoop* capture_loop, |
| 69 MessageLoop* encode_loop, | 69 MessageLoop* encode_loop, |
| 70 MessageLoop* network_loop, | 70 MessageLoop* network_loop, |
| 71 Capturer* capturer, | 71 Capturer* capturer, |
| 72 Encoder* encoder); | 72 Encoder* encoder); |
| 73 | 73 |
| 74 virtual ~SessionManager(); | 74 virtual ~ScreenRecorder(); |
| 75 | 75 |
| 76 // Start recording. | 76 // Start recording. |
| 77 void Start(); | 77 void Start(); |
| 78 | 78 |
| 79 // Pause the recording session. | 79 // Pause the recording session. |
| 80 void Pause(); | 80 void Pause(); |
| 81 | 81 |
| 82 // Set the maximum capture rate. This is denoted by number of updates | 82 // Set the maximum capture rate. This is denoted by number of updates |
| 83 // in one second. The actual system may run in a slower rate than the maximum | 83 // in one second. The actual system may run in a slower rate than the maximum |
| 84 // rate due to various factors, e.g. capture speed, encode speed and network | 84 // rate due to various factors, e.g. capture speed, encode speed and network |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 int recordings_; // Count the number of recordings | 172 int recordings_; // Count the number of recordings |
| 173 // (i.e. capture or encode) happening. | 173 // (i.e. capture or encode) happening. |
| 174 | 174 |
| 175 // The maximum rate is written on the capture thread and read on the network | 175 // The maximum rate is written on the capture thread and read on the network |
| 176 // thread. | 176 // thread. |
| 177 double max_rate_; // Number of captures to perform every second. | 177 double max_rate_; // Number of captures to perform every second. |
| 178 | 178 |
| 179 // The following member is accessed on the network thread. | 179 // The following member is accessed on the network thread. |
| 180 bool rate_control_started_; | 180 bool rate_control_started_; |
| 181 | 181 |
| 182 DISALLOW_COPY_AND_ASSIGN(SessionManager); | 182 DISALLOW_COPY_AND_ASSIGN(ScreenRecorder); |
| 183 }; | 183 }; |
| 184 | 184 |
| 185 } // namespace remoting | 185 } // namespace remoting |
| 186 | 186 |
| 187 #endif // REMOTING_HOST_RECORD_SESSION_H_ | 187 #endif // REMOTING_HOST_SCREEN_RECORDER_H_ |
| OLD | NEW |