| 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_SCREEN_RECORDER_H_ | 5 #ifndef REMOTING_HOST_SCREEN_RECORDER_H_ |
| 6 #define REMOTING_HOST_SCREEN_RECORDER_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" |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 // v | 57 // v |
| 58 // | 58 // |
| 59 // ScreenRecorder 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 ScreenRecorder : public base::RefCountedThreadSafe<ScreenRecorder> { | 63 class ScreenRecorder : public base::RefCountedThreadSafe<ScreenRecorder> { |
| 64 public: | 64 public: |
| 65 | 65 |
| 66 // Construct a ScreenRecorder. 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 but owns encoder. |
| 68 ScreenRecorder(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 ~ScreenRecorder(); | 74 virtual ~ScreenRecorder(); |
| 75 | 75 |
| 76 // Start recording. | 76 // Start recording. |
| 77 void Start(); | 77 void Start(); |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 void EncodedDataAvailableCallback(VideoPacket* packet); | 147 void EncodedDataAvailableCallback(VideoPacket* packet); |
| 148 void SendVideoPacket(VideoPacket* packet); | 148 void SendVideoPacket(VideoPacket* packet); |
| 149 | 149 |
| 150 // Message loops used by this class. | 150 // Message loops used by this class. |
| 151 MessageLoop* capture_loop_; | 151 MessageLoop* capture_loop_; |
| 152 MessageLoop* encode_loop_; | 152 MessageLoop* encode_loop_; |
| 153 MessageLoop* network_loop_; | 153 MessageLoop* network_loop_; |
| 154 | 154 |
| 155 // Reference to the capturer. This member is always accessed on the capture | 155 // Reference to the capturer. This member is always accessed on the capture |
| 156 // thread. | 156 // thread. |
| 157 scoped_ptr<Capturer> capturer_; | 157 Capturer* capturer_; |
| 158 | 158 |
| 159 // Reference to the encoder. This member is always accessed on the encode | 159 // Reference to the encoder. This member is always accessed on the encode |
| 160 // thread. | 160 // thread. |
| 161 scoped_ptr<Encoder> encoder_; | 161 scoped_ptr<Encoder> encoder_; |
| 162 | 162 |
| 163 // A list of clients connected to this hosts. | 163 // A list of clients connected to this hosts. |
| 164 // This member is always accessed on the NETWORK thread. | 164 // This member is always accessed on the NETWORK thread. |
| 165 // TODO(hclam): Have to scoped_refptr the clients since they have a shorter | 165 // TODO(hclam): Have to scoped_refptr the clients since they have a shorter |
| 166 // lifetime than this object. | 166 // lifetime than this object. |
| 167 typedef std::vector<scoped_refptr<protocol::ConnectionToClient> > | 167 typedef std::vector<scoped_refptr<protocol::ConnectionToClient> > |
| (...skipping 18 matching lines...) Expand all Loading... |
| 186 | 186 |
| 187 // Number of captures to perform every second. Written on the capture thread. | 187 // Number of captures to perform every second. Written on the capture thread. |
| 188 double max_rate_; | 188 double max_rate_; |
| 189 | 189 |
| 190 DISALLOW_COPY_AND_ASSIGN(ScreenRecorder); | 190 DISALLOW_COPY_AND_ASSIGN(ScreenRecorder); |
| 191 }; | 191 }; |
| 192 | 192 |
| 193 } // namespace remoting | 193 } // namespace remoting |
| 194 | 194 |
| 195 #endif // REMOTING_HOST_SCREEN_RECORDER_H_ | 195 #endif // REMOTING_HOST_SCREEN_RECORDER_H_ |
| OLD | NEW |