| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/task.h" | 8 #include "base/task.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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 initialized_callback_.Run(true); | 67 initialized_callback_.Run(true); |
| 68 } | 68 } |
| 69 } | 69 } |
| 70 | 70 |
| 71 void RtpVideoWriter::Close() { | 71 void RtpVideoWriter::Close() { |
| 72 rtp_writer_.Close(); | 72 rtp_writer_.Close(); |
| 73 rtp_channel_.reset(); | 73 rtp_channel_.reset(); |
| 74 rtcp_channel_.reset(); | 74 rtcp_channel_.reset(); |
| 75 } | 75 } |
| 76 | 76 |
| 77 void RtpVideoWriter::ProcessVideoPacket(const VideoPacket* packet, Task* done) { | 77 void RtpVideoWriter::ProcessVideoPacket(const VideoPacket* packet, |
| 78 const base::Closure& done) { |
| 78 CHECK(packet->format().encoding() == VideoPacketFormat::ENCODING_VP8) | 79 CHECK(packet->format().encoding() == VideoPacketFormat::ENCODING_VP8) |
| 79 << "Only VP8 is supported in RTP."; | 80 << "Only VP8 is supported in RTP."; |
| 80 | 81 |
| 81 CompoundBuffer payload; | 82 CompoundBuffer payload; |
| 82 // TODO(sergeyu): This copy would not be necessary CompoundBuffer was used | 83 // TODO(sergeyu): This copy would not be necessary CompoundBuffer was used |
| 83 // inside of VideoPacket. | 84 // inside of VideoPacket. |
| 84 payload.AppendCopyOf(packet->data().data(), packet->data().size()); | 85 payload.AppendCopyOf(packet->data().data(), packet->data().size()); |
| 85 | 86 |
| 86 Vp8Descriptor vp8_desriptor; | 87 Vp8Descriptor vp8_desriptor; |
| 87 // TODO(sergeyu): Add a flag in VideoPacket that indicates whether this is a | 88 // TODO(sergeyu): Add a flag in VideoPacket that indicates whether this is a |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 CompoundBuffer chunk; | 122 CompoundBuffer chunk; |
| 122 chunk.CopyFrom(payload, position, position + size); | 123 chunk.CopyFrom(payload, position, position + size); |
| 123 | 124 |
| 124 // And send it. | 125 // And send it. |
| 125 rtp_writer_.SendPacket(packet->timestamp(), marker, vp8_desriptor, chunk); | 126 rtp_writer_.SendPacket(packet->timestamp(), marker, vp8_desriptor, chunk); |
| 126 | 127 |
| 127 position += size; | 128 position += size; |
| 128 } | 129 } |
| 129 DCHECK_EQ(position, payload.total_bytes()); | 130 DCHECK_EQ(position, payload.total_bytes()); |
| 130 | 131 |
| 131 done->Run(); | 132 done.Run(); |
| 132 delete done; | |
| 133 } | 133 } |
| 134 | 134 |
| 135 int RtpVideoWriter::GetPendingPackets() { | 135 int RtpVideoWriter::GetPendingPackets() { |
| 136 return rtp_writer_.GetPendingPackets(); | 136 return rtp_writer_.GetPendingPackets(); |
| 137 } | 137 } |
| 138 | 138 |
| 139 } // namespace protocol | 139 } // namespace protocol |
| 140 } // namespace remoting | 140 } // namespace remoting |
| OLD | NEW |