#include "remoting/protocol/transport.h"
#include "remoting/protocol/video_reader.h"
#include "remoting/protocol/video_stub.h"
-#include "remoting/protocol/util.h"
namespace remoting {
namespace protocol {
event_callback_(NULL),
client_stub_(NULL),
clipboard_stub_(NULL),
- video_stub_(NULL),
audio_stub_(NULL),
signal_strategy_(NULL),
state_(INITIALIZING),
event_callback_ = event_callback;
client_stub_ = client_stub;
clipboard_stub_ = clipboard_stub;
- video_stub_ = video_stub;
+ monitored_video_stub_.reset(new MonitoredVideoStub(
+ video_stub,
+ base::TimeDelta::FromSeconds(
+ MonitoredVideoStub::kConnectivityCheckDelaySeconds),
+ base::Bind(&ConnectionToHost::OnVideoChannelStatus,
+ base::Unretained(this))));
audio_stub_ = audio_stub;
authenticator_ = authenticator.Pass();
case Session::CONNECTING:
case Session::ACCEPTING:
case Session::CONNECTED:
+ case Session::AUTHENTICATING:
// Don't care about these events.
break;
base::Unretained(this)));
video_reader_ = VideoReader::Create(session_->config());
- video_reader_->Init(session_.get(), video_stub_, base::Bind(
- &ConnectionToHost::OnChannelInitialized, base::Unretained(this)));
+ video_reader_->Init(session_.get(), monitored_video_stub_.get(),
+ base::Bind(&ConnectionToHost::OnChannelInitialized,
+ base::Unretained(this)));
audio_reader_ = AudioReader::Create(session_->config());
if (audio_reader_.get()) {
- audio_reader_->Init(
- session_.get(), session_->config().audio_config(),
- base::Bind(&ConnectionToHost::OnChannelInitialized,
- base::Unretained(this)));
+ audio_reader_->Init(session_.get(), session_->config().audio_config(),
+ base::Bind(&ConnectionToHost::OnChannelInitialized,
+ base::Unretained(this)));
audio_reader_->set_audio_stub(audio_stub_);
}
break;
event_callback_->OnRouteChanged(channel_name, route);
}
-void ConnectionToHost::OnSessionChannelReady(const std::string& channel_name,
- bool ready) {
- if (ready) {
- not_ready_channels_.erase(channel_name);
- } else if (!ready) {
- not_ready_channels_.insert(channel_name);
- }
-
- event_callback_->OnConnectionReady(not_ready_channels_.empty());
+void ConnectionToHost::OnVideoChannelStatus(bool active) {
+ event_callback_->OnConnectionReady(active);
}
ConnectionToHost::State ConnectionToHost::state() const {