| 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/task.h" | 7 #include "base/task.h" |
| 8 #include "net/base/io_buffer.h" | 8 #include "net/base/io_buffer.h" |
| 9 #include "remoting/base/compound_buffer.h" | 9 #include "remoting/base/compound_buffer.h" |
| 10 #include "remoting/proto/video.pb.h" | 10 #include "remoting/proto/video.pb.h" |
| 11 #include "remoting/protocol/rtp_writer.h" | 11 #include "remoting/protocol/rtp_writer.h" |
| 12 #include "remoting/protocol/session.h" | 12 #include "remoting/protocol/session.h" |
| 13 | 13 |
| 14 namespace remoting { | 14 namespace remoting { |
| 15 namespace protocol { | 15 namespace protocol { |
| 16 | 16 |
| 17 namespace { | 17 namespace { |
| 18 const int kMtu = 1200; | 18 const int kMtu = 1200; |
| 19 } // namespace | 19 } // namespace |
| 20 | 20 |
| 21 RtpVideoWriter::RtpVideoWriter() { } | 21 RtpVideoWriter::RtpVideoWriter() { } |
| 22 | 22 |
| 23 RtpVideoWriter::~RtpVideoWriter() { } | 23 RtpVideoWriter::~RtpVideoWriter() { |
| 24 Close(); |
| 25 } |
| 24 | 26 |
| 25 void RtpVideoWriter::Init(protocol::Session* session) { | 27 void RtpVideoWriter::Init(protocol::Session* session) { |
| 26 rtp_writer_.Init(session->video_rtp_channel()); | 28 rtp_writer_.Init(session->video_rtp_channel()); |
| 27 } | 29 } |
| 28 | 30 |
| 31 void RtpVideoWriter::Close() { |
| 32 rtp_writer_.Close(); |
| 33 } |
| 34 |
| 29 void RtpVideoWriter::ProcessVideoPacket(const VideoPacket* packet, Task* done) { | 35 void RtpVideoWriter::ProcessVideoPacket(const VideoPacket* packet, Task* done) { |
| 30 CHECK(packet->format().encoding() == VideoPacketFormat::ENCODING_VP8) | 36 CHECK(packet->format().encoding() == VideoPacketFormat::ENCODING_VP8) |
| 31 << "Only VP8 is supported in RTP."; | 37 << "Only VP8 is supported in RTP."; |
| 32 | 38 |
| 33 CompoundBuffer payload; | 39 CompoundBuffer payload; |
| 34 // TODO(sergeyu): This copy would not be necessary CompoundBuffer was used | 40 // TODO(sergeyu): This copy would not be necessary CompoundBuffer was used |
| 35 // inside of VideoPacket. | 41 // inside of VideoPacket. |
| 36 payload.AppendCopyOf(packet->data().data(), packet->data().size()); | 42 payload.AppendCopyOf(packet->data().data(), packet->data().size()); |
| 37 | 43 |
| 38 Vp8Descriptor vp8_desriptor; | 44 Vp8Descriptor vp8_desriptor; |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 done->Run(); | 89 done->Run(); |
| 84 delete done; | 90 delete done; |
| 85 } | 91 } |
| 86 | 92 |
| 87 int RtpVideoWriter::GetPendingPackets() { | 93 int RtpVideoWriter::GetPendingPackets() { |
| 88 return rtp_writer_.GetPendingPackets(); | 94 return rtp_writer_.GetPendingPackets(); |
| 89 } | 95 } |
| 90 | 96 |
| 91 } // namespace protocol | 97 } // namespace protocol |
| 92 } // namespace remoting | 98 } // namespace remoting |
| OLD | NEW |