Chromium Code Reviews| Index: remoting/protocol/connection_to_client.cc |
| diff --git a/remoting/protocol/connection_to_client.cc b/remoting/protocol/connection_to_client.cc |
| index 03ee1fec34bf4da5915c2a05a5a0451352f64e6e..24c1cac0acf411fc9b8f62b455341f6d25e3a57a 100644 |
| --- a/remoting/protocol/connection_to_client.cc |
| +++ b/remoting/protocol/connection_to_client.cc |
| @@ -68,6 +68,11 @@ VideoStub* ConnectionToClient::video_stub() { |
| return video_writer_.get(); |
| } |
| +AudioStub* ConnectionToClient::audio_stub() { |
| + DCHECK(CalledOnValidThread()); |
| + return audio_writer_.get(); |
| +} |
| + |
| // Return pointer to ClientStub. |
| ClientStub* ConnectionToClient::client_stub() { |
| DCHECK(CalledOnValidThread()); |
| @@ -120,6 +125,14 @@ void ConnectionToClient::OnSessionStateChange(Session::State state) { |
| video_writer_->Init(session_.get(), base::Bind( |
| &ConnectionToClient::OnChannelInitialized, base::Unretained(this))); |
| + use_audio_ = (session_->config().audio_config().transport != |
| + ChannelConfig::TRANSPORT_NONE); |
| + if (use_audio_) { |
| + audio_writer_ = AudioWriter::Create(session_->config()); |
|
Sergey Ulanov
2012/06/21 17:24:56
Change AudioWriter::Create() to return NULL when a
kxing
2012/06/21 18:09:22
Even if AudioWriter::Create() returns NULL, wouldn
Sergey Ulanov
2012/06/21 18:20:45
Yes, you will need to check NULL before calling In
|
| + audio_writer_->Init(session_.get(), base::Bind( |
| + &ConnectionToClient::OnChannelInitialized, base::Unretained(this))); |
| + } |
| + |
| // Notify the handler after initializing the channels, so that |
| // ClientSession can get a client clipboard stub. |
| handler_->OnConnectionAuthenticated(this); |
| @@ -158,7 +171,8 @@ void ConnectionToClient::NotifyIfChannelsReady() { |
| if (control_dispatcher_.get() && control_dispatcher_->is_connected() && |
| event_dispatcher_.get() && event_dispatcher_->is_connected() && |
| - video_writer_.get() && video_writer_->is_connected()) { |
| + video_writer_.get() && video_writer_->is_connected() && |
| + (!use_audio_ || (audio_writer_.get() && audio_writer_->is_connected()))) { |
|
Sergey Ulanov
2012/06/21 17:24:56
This code potentially may be called even before yo
kxing
2012/06/21 18:09:22
Done.
|
| handler_->OnConnectionChannelsConnected(this); |
| } |
| } |
| @@ -172,6 +186,7 @@ void ConnectionToClient::CloseChannels() { |
| control_dispatcher_.reset(); |
| event_dispatcher_.reset(); |
| video_writer_.reset(); |
| + audio_writer_.reset(); |
| } |
| } // namespace protocol |