| 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_writer.h" | 5 #include "remoting/protocol/rtp_writer.h" |
| 6 | 6 |
| 7 #include "net/base/io_buffer.h" | 7 #include "net/base/io_buffer.h" |
| 8 #include "net/base/net_errors.h" | 8 #include "net/base/net_errors.h" |
| 9 #include "remoting/base/compound_buffer.h" | 9 #include "remoting/base/compound_buffer.h" |
| 10 #include "remoting/protocol/rtp_utils.h" | 10 #include "remoting/protocol/rtp_utils.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 | 22 |
| 23 RtpWriter::~RtpWriter() { } | 23 RtpWriter::~RtpWriter() { } |
| 24 | 24 |
| 25 // Initializes the writer. Must be called on the thread the sockets belong | 25 // Initializes the writer. Must be called on the thread the sockets belong |
| 26 // to. | 26 // to. |
| 27 void RtpWriter::Init(net::Socket* rtp_socket) { | 27 void RtpWriter::Init(net::Socket* rtp_socket) { |
| 28 buffered_rtp_writer_ = new BufferedDatagramWriter(); | 28 buffered_rtp_writer_ = new BufferedDatagramWriter(); |
| 29 buffered_rtp_writer_->Init(rtp_socket, NULL); | 29 buffered_rtp_writer_->Init(rtp_socket, NULL); |
| 30 } | 30 } |
| 31 | 31 |
| 32 void RtpWriter::Close() { |
| 33 buffered_rtp_writer_->Close(); |
| 34 } |
| 35 |
| 32 void RtpWriter::SendPacket(uint32 timestamp, bool marker, | 36 void RtpWriter::SendPacket(uint32 timestamp, bool marker, |
| 33 const Vp8Descriptor& vp8_descriptor, | 37 const Vp8Descriptor& vp8_descriptor, |
| 34 const CompoundBuffer& payload) { | 38 const CompoundBuffer& payload) { |
| 35 RtpHeader header; | 39 RtpHeader header; |
| 36 header.padding = false; | 40 header.padding = false; |
| 37 header.extension = false; | 41 header.extension = false; |
| 38 header.sources = 0; | 42 header.sources = 0; |
| 39 header.marker = marker; | 43 header.marker = marker; |
| 40 header.payload_type = kRtpPayloadTypePrivate; | 44 header.payload_type = kRtpPayloadTypePrivate; |
| 41 header.timestamp = timestamp; | 45 header.timestamp = timestamp; |
| (...skipping 29 matching lines...) Expand all Loading... |
| 71 // And write the packet. | 75 // And write the packet. |
| 72 buffered_rtp_writer_->Write(buffer, NULL); | 76 buffered_rtp_writer_->Write(buffer, NULL); |
| 73 } | 77 } |
| 74 | 78 |
| 75 int RtpWriter::GetPendingPackets() { | 79 int RtpWriter::GetPendingPackets() { |
| 76 return buffered_rtp_writer_->GetBufferChunks(); | 80 return buffered_rtp_writer_->GetBufferChunks(); |
| 77 } | 81 } |
| 78 | 82 |
| 79 } // namespace protocol | 83 } // namespace protocol |
| 80 } // namespace remoting | 84 } // namespace remoting |
| OLD | NEW |