Index: remoting/host/chromoting_host.h |
=================================================================== |
--- remoting/host/chromoting_host.h (revision 156297) |
+++ remoting/host/chromoting_host.h (working copy) |
@@ -12,7 +12,9 @@ |
#include "base/observer_list.h" |
#include "base/threading/thread.h" |
#include "net/base/backoff_entry.h" |
+#include "remoting/codec/video_encoder.h" |
#include "remoting/host/client_session.h" |
+#include "remoting/host/desktop_environment.h" |
#include "remoting/host/host_key_pair.h" |
#include "remoting/host/host_status_observer.h" |
#include "remoting/host/mouse_move_observer.h" |
@@ -29,8 +31,13 @@ |
class CandidateSessionConfig; |
} // namespace protocol |
+class AudioEncoder; |
+class AudioScheduler; |
class ChromotingHostContext; |
-class DesktopEnvironmentFactory; |
+class DesktopEnvironment; |
+class Encoder; |
+class ScreenRecorder; |
+class VideoFrameCapturer; |
// A class to implement the functionality of a host process. |
// |
@@ -62,11 +69,10 @@ |
public: |
// The caller must ensure that |context|, |signal_strategy| and |
// |environment| out-live the host. |
- ChromotingHost( |
- ChromotingHostContext* context, |
- SignalStrategy* signal_strategy, |
- DesktopEnvironmentFactory* desktop_environment_factory, |
- scoped_ptr<protocol::SessionManager> session_manager); |
+ ChromotingHost(ChromotingHostContext* context, |
+ SignalStrategy* signal_strategy, |
+ DesktopEnvironment* environment, |
+ scoped_ptr<protocol::SessionManager> session_manager); |
// Asynchronously start the host process. |
// |
@@ -148,7 +154,7 @@ |
friend class base::RefCountedThreadSafe<ChromotingHost>; |
friend class ChromotingHostTest; |
- typedef std::vector<scoped_refptr<ClientSession> > ClientList; |
+ typedef std::vector<ClientSession*> ClientList; |
enum State { |
kInitial, |
@@ -157,12 +163,21 @@ |
kStopped, |
}; |
+ // Creates encoder for the specified configuration. |
+ static VideoEncoder* CreateVideoEncoder( |
+ const protocol::SessionConfig& config); |
+ |
+ // Creates an audio encoder for the specified configuration. |
+ static scoped_ptr<AudioEncoder> CreateAudioEncoder( |
+ const protocol::SessionConfig& config); |
+ |
virtual ~ChromotingHost(); |
- // Called when a client session is stopped completely. |
- void OnClientStopped(); |
+ void StopScreenRecorder(); |
+ void StopAudioScheduler(); |
+ void OnRecorderStopped(); |
- // Called from Shutdown() to finish shutdown. |
+ // Called from Shutdown() or OnScreenRecorderStopped() to finish shutdown. |
void ShutdownFinish(); |
// Unless specified otherwise all members of this class must be |
@@ -170,7 +185,7 @@ |
// Parameters specified when the host was created. |
ChromotingHostContext* context_; |
- DesktopEnvironmentFactory* desktop_environment_factory_; |
+ DesktopEnvironment* desktop_environment_; |
scoped_ptr<protocol::SessionManager> session_manager_; |
// Connection objects. |
@@ -182,11 +197,16 @@ |
// The connections to remote clients. |
ClientList clients_; |
- // The number of allocated |ClientSession| objects. |clients_count_| can be |
- // greater than |clients_.size()| because it also includes the objects that |
- // are about to be deleted. |
- int clients_count_; |
+ // Schedulers for audio and video capture. |
+ // TODO(sergeyu): Do we need to have one set of schedulers per client? |
+ scoped_refptr<ScreenRecorder> recorder_; |
+ scoped_refptr<AudioScheduler> audio_scheduler_; |
+ // Number of screen recorders and audio schedulers that are currently being |
+ // stopped. Used to delay shutdown if one or more recorders/schedulers are |
+ // asynchronously shutting down. |
+ int stopping_recorders_; |
+ |
// Tracks the internal state of the host. |
State state_; |