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/client_video_dispatcher.h" | 5 #include "remoting/protocol/client_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 "base/callback_helpers.h" | 10 #include "base/callback_helpers.h" |
(...skipping 13 matching lines...) Expand all Loading... | |
24 int frame_id; | 24 int frame_id; |
25 bool done; | 25 bool done; |
26 }; | 26 }; |
27 | 27 |
28 ClientVideoDispatcher::ClientVideoDispatcher(VideoStub* video_stub) | 28 ClientVideoDispatcher::ClientVideoDispatcher(VideoStub* video_stub) |
29 : ChannelDispatcherBase(kVideoChannelName), | 29 : ChannelDispatcherBase(kVideoChannelName), |
30 video_stub_(video_stub), | 30 video_stub_(video_stub), |
31 parser_(base::Bind(&ClientVideoDispatcher::ProcessVideoPacket, | 31 parser_(base::Bind(&ClientVideoDispatcher::ProcessVideoPacket, |
32 base::Unretained(this)), | 32 base::Unretained(this)), |
33 reader()), | 33 reader()), |
34 weak_factory_(this) { | 34 weak_factory_(this) {} |
35 } | |
36 | 35 |
37 ClientVideoDispatcher::~ClientVideoDispatcher() { | 36 ClientVideoDispatcher::~ClientVideoDispatcher() {} |
38 } | |
39 | 37 |
40 void ClientVideoDispatcher::ProcessVideoPacket( | 38 void ClientVideoDispatcher::ProcessVideoPacket( |
41 scoped_ptr<VideoPacket> video_packet, | 39 scoped_ptr<VideoPacket> video_packet) { |
42 const base::Closure& done) { | |
43 base::ScopedClosureRunner done_runner(done); | |
44 | |
45 int frame_id = video_packet->frame_id(); | 40 int frame_id = video_packet->frame_id(); |
46 | 41 |
47 if (!video_packet->has_frame_id()) { | 42 if (!video_packet->has_frame_id()) { |
48 video_stub_->ProcessVideoPacket(std::move(video_packet), | 43 video_stub_->ProcessVideoPacket(std::move(video_packet), |
49 done_runner.Release()); | 44 base::Bind(&base::DoNothing)); |
Jamie
2016/01/29 23:48:12
Similarly here, can you remove the callback parame
Sergey Ulanov
2016/01/30 00:14:47
VideoStub is used on the sender side, and this cal
| |
50 return; | 45 return; |
51 } | 46 } |
52 | 47 |
53 PendingFramesList::iterator pending_frame = | 48 PendingFramesList::iterator pending_frame = |
54 pending_frames_.insert(pending_frames_.end(), PendingFrame(frame_id)); | 49 pending_frames_.insert(pending_frames_.end(), PendingFrame(frame_id)); |
55 | 50 |
56 video_stub_->ProcessVideoPacket( | 51 video_stub_->ProcessVideoPacket( |
57 std::move(video_packet), | 52 std::move(video_packet), |
58 base::Bind(&ClientVideoDispatcher::OnPacketDone, | 53 base::Bind(&ClientVideoDispatcher::OnPacketDone, |
59 weak_factory_.GetWeakPtr(), pending_frame)); | 54 weak_factory_.GetWeakPtr(), pending_frame)); |
(...skipping 10 matching lines...) Expand all Loading... | |
70 while (!pending_frames_.empty() && pending_frames_.front().done) { | 65 while (!pending_frames_.empty() && pending_frames_.front().done) { |
71 VideoAck ack_message; | 66 VideoAck ack_message; |
72 ack_message.set_frame_id(pending_frames_.front().frame_id); | 67 ack_message.set_frame_id(pending_frames_.front().frame_id); |
73 writer()->Write(SerializeAndFrameMessage(ack_message), base::Closure()); | 68 writer()->Write(SerializeAndFrameMessage(ack_message), base::Closure()); |
74 pending_frames_.pop_front(); | 69 pending_frames_.pop_front(); |
75 } | 70 } |
76 } | 71 } |
77 | 72 |
78 } // namespace protocol | 73 } // namespace protocol |
79 } // namespace remoting | 74 } // namespace remoting |
OLD | NEW |