OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/rtp_video_writer.h" | 5 #include "remoting/protocol/rtp_video_writer.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "net/base/io_buffer.h" | 9 #include "net/base/io_buffer.h" |
10 #include "remoting/base/compound_buffer.h" | 10 #include "remoting/base/compound_buffer.h" |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 session_->CancelChannelCreation(kVideoRtpChannelName); | 78 session_->CancelChannelCreation(kVideoRtpChannelName); |
79 session_->CancelChannelCreation(kVideoRtcpChannelName); | 79 session_->CancelChannelCreation(kVideoRtcpChannelName); |
80 session_ = NULL; | 80 session_ = NULL; |
81 } | 81 } |
82 } | 82 } |
83 | 83 |
84 bool RtpVideoWriter::is_connected() { | 84 bool RtpVideoWriter::is_connected() { |
85 return rtp_channel_.get() && rtcp_channel_.get(); | 85 return rtp_channel_.get() && rtcp_channel_.get(); |
86 } | 86 } |
87 | 87 |
88 void RtpVideoWriter::ProcessVideoPacket(const VideoPacket* packet, | 88 void RtpVideoWriter::ProcessVideoPacket(const scoped_ptr<VideoPacket> packet, |
89 const base::Closure& done) { | 89 const base::Closure& done) { |
90 CHECK(packet->format().encoding() == VideoPacketFormat::ENCODING_VP8) | 90 CHECK(packet->format().encoding() == VideoPacketFormat::ENCODING_VP8) |
91 << "Only VP8 is supported in RTP."; | 91 << "Only VP8 is supported in RTP."; |
92 | 92 |
93 CompoundBuffer payload; | 93 CompoundBuffer payload; |
94 // TODO(sergeyu): This copy would not be necessary CompoundBuffer was used | 94 // TODO(sergeyu): This copy would not be necessary CompoundBuffer was used |
95 // inside of VideoPacket. | 95 // inside of VideoPacket. |
96 payload.AppendCopyOf(packet->data().data(), packet->data().size()); | 96 payload.AppendCopyOf(packet->data().data(), packet->data().size()); |
97 | 97 |
98 Vp8Descriptor vp8_desriptor; | 98 Vp8Descriptor vp8_desriptor; |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 CompoundBuffer chunk; | 133 CompoundBuffer chunk; |
134 chunk.CopyFrom(payload, position, position + size); | 134 chunk.CopyFrom(payload, position, position + size); |
135 | 135 |
136 // And send it. | 136 // And send it. |
137 rtp_writer_.SendPacket(packet->timestamp(), marker, vp8_desriptor, chunk); | 137 rtp_writer_.SendPacket(packet->timestamp(), marker, vp8_desriptor, chunk); |
138 | 138 |
139 position += size; | 139 position += size; |
140 } | 140 } |
141 DCHECK_EQ(position, payload.total_bytes()); | 141 DCHECK_EQ(position, payload.total_bytes()); |
142 | 142 |
143 done.Run(); | 143 if (!done.is_null()) |
| 144 done.Run(); |
144 } | 145 } |
145 | 146 |
146 int RtpVideoWriter::GetPendingPackets() { | 147 int RtpVideoWriter::GetPendingPackets() { |
147 return rtp_writer_.GetPendingPackets(); | 148 return rtp_writer_.GetPendingPackets(); |
148 } | 149 } |
149 | 150 |
150 } // namespace protocol | 151 } // namespace protocol |
151 } // namespace remoting | 152 } // namespace remoting |
OLD | NEW |