OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "remoting/protocol/host_video_dispatcher.h" | 5 #include "remoting/protocol/host_video_dispatcher.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "net/socket/stream_socket.h" | 10 #include "net/socket/stream_socket.h" |
11 #include "remoting/base/constants.h" | 11 #include "remoting/base/constants.h" |
12 #include "remoting/protocol/message_serialization.h" | 12 #include "remoting/protocol/message_serialization.h" |
13 #include "remoting/protocol/video_feedback_stub.h" | 13 #include "remoting/protocol/video_feedback_stub.h" |
14 | 14 |
15 namespace remoting { | 15 namespace remoting { |
16 namespace protocol { | 16 namespace protocol { |
17 | 17 |
18 HostVideoDispatcher::HostVideoDispatcher() | 18 HostVideoDispatcher::HostVideoDispatcher() |
19 : ChannelDispatcherBase(kVideoChannelName), | 19 : ChannelDispatcherBase(kVideoChannelName), |
20 parser_( | 20 parser_( |
21 base::Bind(&HostVideoDispatcher::OnVideoAck, base::Unretained(this)), | 21 base::Bind(&HostVideoDispatcher::OnVideoAck, base::Unretained(this)), |
22 reader()), | 22 reader()), |
23 video_feedback_stub_(nullptr) { | 23 video_feedback_stub_(nullptr) {} |
24 } | |
25 | 24 |
26 HostVideoDispatcher::~HostVideoDispatcher() { | 25 HostVideoDispatcher::~HostVideoDispatcher() {} |
27 } | |
28 | 26 |
29 void HostVideoDispatcher::ProcessVideoPacket(scoped_ptr<VideoPacket> packet, | 27 void HostVideoDispatcher::ProcessVideoPacket(scoped_ptr<VideoPacket> packet, |
30 const base::Closure& done) { | 28 const base::Closure& done) { |
31 writer()->Write(SerializeAndFrameMessage(*packet), done); | 29 writer()->Write(SerializeAndFrameMessage(*packet), done); |
32 } | 30 } |
33 | 31 |
34 void HostVideoDispatcher::OnVideoAck(scoped_ptr<VideoAck> ack, | 32 void HostVideoDispatcher::OnVideoAck(scoped_ptr<VideoAck> ack) { |
35 const base::Closure& done) { | |
36 if (video_feedback_stub_) | 33 if (video_feedback_stub_) |
37 video_feedback_stub_->ProcessVideoAck(std::move(ack)); | 34 video_feedback_stub_->ProcessVideoAck(std::move(ack)); |
38 | |
39 done.Run(); | |
40 } | 35 } |
41 | 36 |
42 } // namespace protocol | 37 } // namespace protocol |
43 } // namespace remoting | 38 } // namespace remoting |
OLD | NEW |