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/proto/video.pb.h" | 12 #include "remoting/proto/video.pb.h" |
| 13 #include "remoting/protocol/message_pipe.h" |
13 #include "remoting/protocol/message_serialization.h" | 14 #include "remoting/protocol/message_serialization.h" |
14 #include "remoting/protocol/video_feedback_stub.h" | 15 #include "remoting/protocol/video_feedback_stub.h" |
15 | 16 |
16 namespace remoting { | 17 namespace remoting { |
17 namespace protocol { | 18 namespace protocol { |
18 | 19 |
19 HostVideoDispatcher::HostVideoDispatcher() | 20 HostVideoDispatcher::HostVideoDispatcher() |
20 : ChannelDispatcherBase(kVideoChannelName) {} | 21 : ChannelDispatcherBase(kVideoChannelName) {} |
21 HostVideoDispatcher::~HostVideoDispatcher() {} | 22 HostVideoDispatcher::~HostVideoDispatcher() {} |
22 | 23 |
23 void HostVideoDispatcher::ProcessVideoPacket(scoped_ptr<VideoPacket> packet, | 24 void HostVideoDispatcher::ProcessVideoPacket(scoped_ptr<VideoPacket> packet, |
24 const base::Closure& done) { | 25 const base::Closure& done) { |
25 writer()->Write(SerializeAndFrameMessage(*packet), done); | 26 message_pipe()->Send(packet.get(), done); |
26 } | 27 } |
27 | 28 |
28 void HostVideoDispatcher::OnIncomingMessage( | 29 void HostVideoDispatcher::OnIncomingMessage( |
29 scoped_ptr<CompoundBuffer> message) { | 30 scoped_ptr<CompoundBuffer> message) { |
30 scoped_ptr<VideoAck> ack = ParseMessage<VideoAck>(message.get()); | 31 scoped_ptr<VideoAck> ack = ParseMessage<VideoAck>(message.get()); |
31 if (!ack) | 32 if (!ack) |
32 return; | 33 return; |
33 if (video_feedback_stub_) | 34 if (video_feedback_stub_) |
34 video_feedback_stub_->ProcessVideoAck(std::move(ack)); | 35 video_feedback_stub_->ProcessVideoAck(std::move(ack)); |
35 } | 36 } |
36 | 37 |
37 } // namespace protocol | 38 } // namespace protocol |
38 } // namespace remoting | 39 } // namespace remoting |
OLD | NEW |