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" |
11 #include "net/socket/stream_socket.h" | 11 #include "net/socket/stream_socket.h" |
| 12 #include "remoting/base/compound_buffer.h" |
12 #include "remoting/base/constants.h" | 13 #include "remoting/base/constants.h" |
13 #include "remoting/proto/video.pb.h" | 14 #include "remoting/proto/video.pb.h" |
| 15 #include "remoting/protocol/message_pipe.h" |
14 #include "remoting/protocol/message_serialization.h" | 16 #include "remoting/protocol/message_serialization.h" |
15 #include "remoting/protocol/video_stub.h" | 17 #include "remoting/protocol/video_stub.h" |
16 | 18 |
17 namespace remoting { | 19 namespace remoting { |
18 namespace protocol { | 20 namespace protocol { |
19 | 21 |
20 struct ClientVideoDispatcher::PendingFrame { | 22 struct ClientVideoDispatcher::PendingFrame { |
21 PendingFrame(int frame_id) | 23 PendingFrame(int frame_id) |
22 : frame_id(frame_id), | 24 : frame_id(frame_id), |
23 done(false) {} | 25 done(false) {} |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 PendingFramesList::iterator pending_frame) { | 61 PendingFramesList::iterator pending_frame) { |
60 // Mark the frame as done. | 62 // Mark the frame as done. |
61 DCHECK(!pending_frame->done); | 63 DCHECK(!pending_frame->done); |
62 pending_frame->done = true; | 64 pending_frame->done = true; |
63 | 65 |
64 // Send VideoAck for all packets in the head of the queue that have finished | 66 // Send VideoAck for all packets in the head of the queue that have finished |
65 // rendering. | 67 // rendering. |
66 while (!pending_frames_.empty() && pending_frames_.front().done) { | 68 while (!pending_frames_.empty() && pending_frames_.front().done) { |
67 VideoAck ack_message; | 69 VideoAck ack_message; |
68 ack_message.set_frame_id(pending_frames_.front().frame_id); | 70 ack_message.set_frame_id(pending_frames_.front().frame_id); |
69 writer()->Write(SerializeAndFrameMessage(ack_message), base::Closure()); | 71 message_pipe()->Send(&ack_message, base::Closure()); |
70 pending_frames_.pop_front(); | 72 pending_frames_.pop_front(); |
71 } | 73 } |
72 } | 74 } |
73 | 75 |
74 } // namespace protocol | 76 } // namespace protocol |
75 } // namespace remoting | 77 } // namespace remoting |
OLD | NEW |