Scroll in Android HTML Element accessibility navigation
[chromium-blink-merge.git] / remoting / protocol / monitored_video_stub.cc
blob245c2ae013474091484e1671141a1949e39334b5
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "remoting/protocol/monitored_video_stub.h"
7 #include "base/bind.h"
8 #include "base/logging.h"
9 #include "remoting/proto/video.pb.h"
11 namespace remoting {
12 namespace protocol {
14 MonitoredVideoStub::MonitoredVideoStub(VideoStub* video_stub,
15 base::TimeDelta connectivity_check_delay,
16 const ChannelStateCallback& callback)
17 : video_stub_(video_stub),
18 callback_(callback),
19 is_connected_(false),
20 connectivity_check_timer_(
21 FROM_HERE,
22 connectivity_check_delay,
23 this,
24 &MonitoredVideoStub::OnConnectivityCheckTimeout) {
27 MonitoredVideoStub::~MonitoredVideoStub() {
30 void MonitoredVideoStub::ProcessVideoPacket(scoped_ptr<VideoPacket> packet,
31 const base::Closure& done) {
32 DCHECK(thread_checker_.CalledOnValidThread());
34 connectivity_check_timer_.Reset();
36 NotifyChannelState(true);
38 video_stub_->ProcessVideoPacket(packet.Pass(), done);
41 void MonitoredVideoStub::OnConnectivityCheckTimeout() {
42 DCHECK(thread_checker_.CalledOnValidThread());
43 NotifyChannelState(false);
46 void MonitoredVideoStub::NotifyChannelState(bool connected) {
47 if (is_connected_ != connected) {
48 is_connected_ = connected;
49 callback_.Run(is_connected_);
53 } // namespace protocol
54 } // namespace remoting