diff options
author | hclam@chromium.org <hclam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-06-09 21:56:39 +0000 |
---|---|---|
committer | hclam@chromium.org <hclam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-06-09 21:56:39 +0000 |
commit | ef0a59a6fd722a0910196c951dc676c19127a28b (patch) | |
tree | 9d90ab9227e4222fa312dadae114c8d2247028bf /remoting/host/session_manager.cc | |
parent | e9fdd159ffd94e3e097bd6905d84e6b564b04c2c (diff) | |
download | chromium_src-ef0a59a6fd722a0910196c951dc676c19127a28b.zip chromium_src-ef0a59a6fd722a0910196c951dc676c19127a28b.tar.gz chromium_src-ef0a59a6fd722a0910196c951dc676c19127a28b.tar.bz2 |
Implement a chromoting client using X11
Using XRender to render the chromoting client. This patch has done several things:
1. Rename chromotocol_pb to remoting
2. Defined ChromotingView as the display area of the remote view
3. Implemented X11Client as the client that uses X11 for display
4. Implemented X11View that uses XRender for drawing
5. Fixed several problems in host capturer and encoder
Review URL: http://codereview.chromium.org/2745006
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@49329 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'remoting/host/session_manager.cc')
-rw-r--r-- | remoting/host/session_manager.cc | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/remoting/host/session_manager.cc b/remoting/host/session_manager.cc index da16a55..0160993 100644 --- a/remoting/host/session_manager.cc +++ b/remoting/host/session_manager.cc @@ -49,7 +49,7 @@ SessionManager::SessionManager( rate_control_started_(false), capture_width_(0), capture_height_(0), - capture_pixel_format_(chromotocol_pb::PixelFormatInvalid), + capture_pixel_format_(PixelFormatInvalid), encode_stream_started_(false), encode_done_(false) { DCHECK(capture_loop_); @@ -59,7 +59,6 @@ SessionManager::SessionManager( SessionManager::~SessionManager() { clients_.clear(); - DCHECK_EQ(0u, clients_.size()); } void SessionManager::Start() { @@ -132,9 +131,10 @@ void SessionManager::SetMaxRate(double rate) { } void SessionManager::AddClient(scoped_refptr<ClientConnection> client) { - network_loop_->PostTask( + // Gets the init information for the client. + capture_loop_->PostTask( FROM_HERE, - NewRunnableMethod(this, &SessionManager::DoAddClient, client)); + NewRunnableMethod(this, &SessionManager::DoGetInitInfo, client)); } void SessionManager::RemoveClient(scoped_refptr<ClientConnection> client) { @@ -214,7 +214,7 @@ void SessionManager::DoEncode() { } void SessionManager::DoSendUpdate( - chromotocol_pb::UpdateStreamPacketHeader* header, + UpdateStreamPacketHeader* header, scoped_refptr<media::DataBuffer> encoded_data, bool begin_update, bool end_update) { DCHECK_EQ(network_loop_, MessageLoop::current()); @@ -242,10 +242,18 @@ void SessionManager::DoSendInit(scoped_refptr<ClientConnection> client, void SessionManager::DoGetInitInfo(scoped_refptr<ClientConnection> client) { DCHECK_EQ(capture_loop_, MessageLoop::current()); + // Sends the init message to the cleint. network_loop_->PostTask( FROM_HERE, NewRunnableMethod(this, &SessionManager::DoSendInit, client, capturer_->GetWidth(), capturer_->GetHeight())); + + // And then add the client to the list so it can receive update stream. + // It is important we do so in such order or the client will receive + // update stream before init message. + network_loop_->PostTask( + FROM_HERE, + NewRunnableMethod(this, &SessionManager::DoAddClient, client)); } void SessionManager::DoSetRate(double rate) { @@ -279,11 +287,6 @@ void SessionManager::DoAddClient(scoped_refptr<ClientConnection> client) { // TODO(hclam): Force a full frame for next encode. clients_.push_back(client); - - // Gets the init information for the client. - capture_loop_->PostTask( - FROM_HERE, - NewRunnableMethod(this, &SessionManager::DoGetInitInfo, client)); } void SessionManager::DoRemoveClient(scoped_refptr<ClientConnection> client) { |