| 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 #ifndef REMOTING_PROTOCOL_RTP_WRITER_H_ | 5 #ifndef REMOTING_PROTOCOL_RTP_WRITER_H_ |
| 6 #define REMOTING_PROTOCOL_RTP_WRITER_H_ | 6 #define REMOTING_PROTOCOL_RTP_WRITER_H_ |
| 7 | 7 |
| 8 #include "net/socket/socket.h" | 8 #include "net/socket/socket.h" |
| 9 #include "remoting/protocol/buffered_socket_writer.h" | 9 #include "remoting/protocol/buffered_socket_writer.h" |
| 10 #include "remoting/protocol/rtp_utils.h" |
| 10 | 11 |
| 11 namespace remoting { | 12 namespace remoting { |
| 12 | 13 |
| 13 class CompoundBuffer; | 14 class CompoundBuffer; |
| 14 | 15 |
| 15 namespace protocol { | 16 namespace protocol { |
| 16 | 17 |
| 17 class RtpWriter { | 18 class RtpWriter { |
| 18 public: | 19 public: |
| 19 RtpWriter(); | 20 RtpWriter(); |
| 20 virtual ~RtpWriter(); | 21 virtual ~RtpWriter(); |
| 21 | 22 |
| 22 // Initializes the writer. Must be called on the thread the sockets belong | 23 // Initializes the writer. Must be called on the thread the sockets belong |
| 23 // to. | 24 // to. |
| 24 void Init(net::Socket* rtp_socket, net::Socket* rtcp_socket); | 25 void Init(net::Socket* rtp_socket, net::Socket* rtcp_socket); |
| 25 | 26 |
| 26 // Sends next packet. | 27 // Sends next packet. The packet is mutated by |
| 27 void SendPacket(const CompoundBuffer& payload, uint32 timestamp); | 28 void SendPacket(uint32 timestamp, bool marker, |
| 29 const Vp8Descriptor& vp8_descriptor, |
| 30 const CompoundBuffer& payload); |
| 28 | 31 |
| 29 // Returns number of packets queued in the buffer. | 32 // Returns number of packets queued in the buffer. |
| 30 int GetPendingPackets(); | 33 int GetPendingPackets(); |
| 31 | 34 |
| 32 // Stop writing and drop pending data. Must be called from the same thread as | 35 // Stop writing and drop pending data. Must be called from the same thread as |
| 33 // Init(). | 36 // Init(). |
| 34 void Close(); | 37 void Close(); |
| 35 | 38 |
| 36 private: | 39 private: |
| 37 net::Socket* rtp_socket_; | 40 net::Socket* rtp_socket_; |
| 38 net::Socket* rtcp_socket_; | 41 net::Socket* rtcp_socket_; |
| 39 | 42 |
| 40 uint32 last_packet_number_; | 43 uint32 last_packet_number_; |
| 41 | 44 |
| 42 scoped_refptr<BufferedDatagramWriter> buffered_rtp_writer_; | 45 scoped_refptr<BufferedDatagramWriter> buffered_rtp_writer_; |
| 43 }; | 46 }; |
| 44 | 47 |
| 45 } // namespace protocol | 48 } // namespace protocol |
| 46 } // namespace remoting | 49 } // namespace remoting |
| 47 | 50 |
| 48 #endif // REMOTING_PROTOCOL_RTP_WRITER_H_ | 51 #endif // REMOTING_PROTOCOL_RTP_WRITER_H_ |
| OLD | NEW |