Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(169)

Side by Side Diff: remoting/protocol/host_video_dispatcher.cc

Issue 1654513003: Simplify message parsing. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@no_done
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « remoting/protocol/host_video_dispatcher.h ('k') | remoting/protocol/ice_connection_to_host.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/protocol/message_serialization.h" 13 #include "remoting/protocol/message_serialization.h"
13 #include "remoting/protocol/video_feedback_stub.h" 14 #include "remoting/protocol/video_feedback_stub.h"
14 15
15 namespace remoting { 16 namespace remoting {
16 namespace protocol { 17 namespace protocol {
17 18
18 HostVideoDispatcher::HostVideoDispatcher() 19 HostVideoDispatcher::HostVideoDispatcher()
19 : ChannelDispatcherBase(kVideoChannelName), 20 : ChannelDispatcherBase(kVideoChannelName) {}
20 parser_(
21 base::Bind(&HostVideoDispatcher::OnVideoAck, base::Unretained(this)),
22 reader()),
23 video_feedback_stub_(nullptr) {}
24
25 HostVideoDispatcher::~HostVideoDispatcher() {} 21 HostVideoDispatcher::~HostVideoDispatcher() {}
26 22
27 void HostVideoDispatcher::ProcessVideoPacket(scoped_ptr<VideoPacket> packet, 23 void HostVideoDispatcher::ProcessVideoPacket(scoped_ptr<VideoPacket> packet,
28 const base::Closure& done) { 24 const base::Closure& done) {
29 writer()->Write(SerializeAndFrameMessage(*packet), done); 25 writer()->Write(SerializeAndFrameMessage(*packet), done);
30 } 26 }
31 27
32 void HostVideoDispatcher::OnVideoAck(scoped_ptr<VideoAck> ack) { 28 void HostVideoDispatcher::OnIncomingMessage(
29 scoped_ptr<CompoundBuffer> message) {
30 scoped_ptr<VideoAck> ack = ParseMessage<VideoAck>(message.get());
31 if (!ack)
32 return;
33 if (video_feedback_stub_) 33 if (video_feedback_stub_)
34 video_feedback_stub_->ProcessVideoAck(std::move(ack)); 34 video_feedback_stub_->ProcessVideoAck(std::move(ack));
35 } 35 }
36 36
37 } // namespace protocol 37 } // namespace protocol
38 } // namespace remoting 38 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/protocol/host_video_dispatcher.h ('k') | remoting/protocol/ice_connection_to_host.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698