| 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_RECORD_SESSION_H_ |
| 6 #define REMOTING_HOST_RECORD_SESSION_H_ | 6 #define REMOTING_HOST_RECORD_SESSION_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/message_loop_proxy.h" |
| 12 #include "base/ref_counted.h" | 13 #include "base/ref_counted.h" |
| 13 #include "base/scoped_ptr.h" | 14 #include "base/scoped_ptr.h" |
| 14 #include "base/time.h" | 15 #include "base/time.h" |
| 15 #include "remoting/base/encoder.h" | 16 #include "remoting/base/encoder.h" |
| 16 #include "remoting/host/capturer.h" | 17 #include "remoting/host/capturer.h" |
| 17 #include "remoting/proto/video.pb.h" | 18 #include "remoting/proto/video.pb.h" |
| 18 | 19 |
| 19 namespace remoting { | 20 namespace remoting { |
| 20 | 21 |
| 21 namespace protocol { | 22 namespace protocol { |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 // | 59 // |
| 59 // SessionManager has the following responsibilities: | 60 // SessionManager has the following responsibilities: |
| 60 // 1. Make sure capture and encode occurs no more frequently than |rate|. | 61 // 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. | 62 // 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. | 63 // 3. Distribute tasks on three threads on a timely fashion to minimize latency. |
| 63 class SessionManager : public base::RefCountedThreadSafe<SessionManager> { | 64 class SessionManager : public base::RefCountedThreadSafe<SessionManager> { |
| 64 public: | 65 public: |
| 65 | 66 |
| 66 // Construct a SessionManager. Message loops and threads are provided. | 67 // Construct a SessionManager. Message loops and threads are provided. |
| 67 // This object does not own capturer and encoder. | 68 // This object does not own capturer and encoder. |
| 68 SessionManager(MessageLoop* capture_loop, | 69 SessionManager(scoped_refptr<base::MessageLoopProxy> capture_loop, |
| 69 MessageLoop* encode_loop, | 70 MessageLoop* encode_loop, |
| 70 MessageLoop* network_loop, | 71 MessageLoop* network_loop, |
| 71 Capturer* capturer, | 72 Capturer* capturer, |
| 72 Encoder* encoder); | 73 Encoder* encoder); |
| 73 | 74 |
| 74 virtual ~SessionManager(); | 75 virtual ~SessionManager(); |
| 75 | 76 |
| 76 // Start recording. | 77 // Start recording. |
| 77 void Start(); | 78 void Start(); |
| 78 | 79 |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 | 139 |
| 139 // Encoder thread ----------------------------------------------------------- | 140 // Encoder thread ----------------------------------------------------------- |
| 140 | 141 |
| 141 void DoEncode(scoped_refptr<CaptureData> capture_data); | 142 void DoEncode(scoped_refptr<CaptureData> capture_data); |
| 142 | 143 |
| 143 // EncodeDataAvailableTask takes ownership of header and is responsible for | 144 // EncodeDataAvailableTask takes ownership of header and is responsible for |
| 144 // deleting it. | 145 // deleting it. |
| 145 void EncodeDataAvailableTask(VideoPacket* packet); | 146 void EncodeDataAvailableTask(VideoPacket* packet); |
| 146 | 147 |
| 147 // Message loops used by this class. | 148 // Message loops used by this class. |
| 148 MessageLoop* capture_loop_; | 149 scoped_refptr<base::MessageLoopProxy> capture_loop_; |
| 149 MessageLoop* encode_loop_; | 150 MessageLoop* encode_loop_; |
| 150 MessageLoop* network_loop_; | 151 MessageLoop* network_loop_; |
| 151 | 152 |
| 152 // Reference to the capturer. This member is always accessed on the capture | 153 // Reference to the capturer. This member is always accessed on the capture |
| 153 // thread. | 154 // thread. |
| 154 scoped_ptr<Capturer> capturer_; | 155 scoped_ptr<Capturer> capturer_; |
| 155 | 156 |
| 156 // Reference to the encoder. This member is always accessed on the encode | 157 // Reference to the encoder. This member is always accessed on the encode |
| 157 // thread. | 158 // thread. |
| 158 scoped_ptr<Encoder> encoder_; | 159 scoped_ptr<Encoder> encoder_; |
| (...skipping 19 matching lines...) Expand all Loading... |
| 178 | 179 |
| 179 // The following member is accessed on the network thread. | 180 // The following member is accessed on the network thread. |
| 180 bool rate_control_started_; | 181 bool rate_control_started_; |
| 181 | 182 |
| 182 DISALLOW_COPY_AND_ASSIGN(SessionManager); | 183 DISALLOW_COPY_AND_ASSIGN(SessionManager); |
| 183 }; | 184 }; |
| 184 | 185 |
| 185 } // namespace remoting | 186 } // namespace remoting |
| 186 | 187 |
| 187 #endif // REMOTING_HOST_RECORD_SESSION_H_ | 188 #endif // REMOTING_HOST_RECORD_SESSION_H_ |
| OLD | NEW |