| Index: remoting/protocol/connection_to_host.cc
|
| diff --git a/remoting/protocol/connection_to_host.cc b/remoting/protocol/connection_to_host.cc
|
| index 296439bf0d6ef6d3285bd5c278ab3cdb24f8df83..e5e18a717928cd207ae2d648893e302606da607b 100644
|
| --- a/remoting/protocol/connection_to_host.cc
|
| +++ b/remoting/protocol/connection_to_host.cc
|
| @@ -10,6 +10,8 @@
|
| #include "remoting/base/constants.h"
|
| #include "remoting/jingle_glue/javascript_signal_strategy.h"
|
| #include "remoting/jingle_glue/xmpp_signal_strategy.h"
|
| +#include "remoting/protocol/audio_reader.h"
|
| +#include "remoting/protocol/audio_stub.h"
|
| #include "remoting/protocol/auth_util.h"
|
| #include "remoting/protocol/authenticator.h"
|
| #include "remoting/protocol/client_control_dispatcher.h"
|
| @@ -33,6 +35,7 @@ ConnectionToHost::ConnectionToHost(
|
| client_stub_(NULL),
|
| clipboard_stub_(NULL),
|
| video_stub_(NULL),
|
| + audio_stub_(NULL),
|
| state_(CONNECTING),
|
| error_(OK) {
|
| }
|
| @@ -62,11 +65,13 @@ void ConnectionToHost::Connect(scoped_refptr<XmppProxy> xmpp_proxy,
|
| HostEventCallback* event_callback,
|
| ClientStub* client_stub,
|
| ClipboardStub* clipboard_stub,
|
| - VideoStub* video_stub) {
|
| + VideoStub* video_stub,
|
| + AudioStub* audio_stub) {
|
| event_callback_ = event_callback;
|
| client_stub_ = client_stub;
|
| clipboard_stub_ = clipboard_stub;
|
| video_stub_ = video_stub;
|
| + audio_stub_ = audio_stub;
|
| authenticator_ = authenticator.Pass();
|
|
|
| // Save jid of the host. The actual connection is created later after
|
| @@ -162,6 +167,14 @@ void ConnectionToHost::OnSessionStateChange(
|
| video_reader_->Init(session_.get(), video_stub_, base::Bind(
|
| &ConnectionToHost::OnChannelInitialized, base::Unretained(this)));
|
|
|
| + use_audio_ = (session_->config().audio_config().transport !=
|
| + ChannelConfig::TRANSPORT_NONE);
|
| + if (use_audio_) {
|
| + audio_reader_ = AudioReader::Create(session_->config());
|
| + audio_reader_->Init(session_.get(), audio_stub_, base::Bind(
|
| + &ConnectionToHost::OnChannelInitialized, base::Unretained(this)));
|
| + }
|
| +
|
| control_dispatcher_.reset(new ClientControlDispatcher());
|
| control_dispatcher_->Init(session_.get(), base::Bind(
|
| &ConnectionToHost::OnChannelInitialized, base::Unretained(this)));
|
| @@ -211,6 +224,7 @@ void ConnectionToHost::NotifyIfChannelsReady() {
|
| if (control_dispatcher_.get() && control_dispatcher_->is_connected() &&
|
| event_dispatcher_.get() && event_dispatcher_->is_connected() &&
|
| video_reader_.get() && video_reader_->is_connected() &&
|
| + (!use_audio_ || (audio_reader_.get() && audio_reader_->is_connected())) &&
|
| state_ == CONNECTING) {
|
| // Start forwarding clipboard and input events.
|
| clipboard_forwarder_.set_clipboard_stub(control_dispatcher_.get());
|
| @@ -230,6 +244,7 @@ void ConnectionToHost::CloseChannels() {
|
| clipboard_forwarder_.set_clipboard_stub(NULL);
|
| event_forwarder_.set_input_stub(NULL);
|
| video_reader_.reset();
|
| + audio_reader_.reset();
|
| }
|
|
|
| void ConnectionToHost::SetState(State state, ErrorCode error) {
|
|
|