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_READER_H_ | 5 #ifndef REMOTING_PROTOCOL_RTP_READER_H_ |
6 #define REMOTING_PROTOCOL_RTP_READER_H_ | 6 #define REMOTING_PROTOCOL_RTP_READER_H_ |
7 | 7 |
8 #include "base/scoped_ptr.h" | 8 #include "base/scoped_ptr.h" |
| 9 #include "remoting/base/compound_buffer.h" |
9 #include "remoting/protocol/rtp_utils.h" | 10 #include "remoting/protocol/rtp_utils.h" |
10 #include "remoting/protocol/socket_reader_base.h" | 11 #include "remoting/protocol/socket_reader_base.h" |
11 | 12 |
12 namespace remoting { | 13 namespace remoting { |
13 namespace protocol { | 14 namespace protocol { |
14 | 15 |
15 struct RtpPacket { | 16 class RtpPacket { |
| 17 public: |
16 RtpPacket(); | 18 RtpPacket(); |
17 ~RtpPacket(); | 19 ~RtpPacket(); |
18 | 20 |
19 RtpHeader header; | 21 const RtpHeader& header() const { return header_; } |
20 scoped_refptr<net::IOBuffer> data; | 22 RtpHeader* mutable_header() { return &header_; } |
21 char* payload; | 23 const CompoundBuffer& payload() const { return payload_; } |
22 int payload_size; | 24 CompoundBuffer* mutable_payload() { return &payload_; } |
| 25 |
| 26 private: |
| 27 RtpHeader header_; |
| 28 CompoundBuffer payload_; |
23 }; | 29 }; |
24 | 30 |
25 class RtpReader : public SocketReaderBase { | 31 class RtpReader : public SocketReaderBase { |
26 public: | 32 public: |
27 RtpReader(); | 33 RtpReader(); |
28 ~RtpReader(); | 34 ~RtpReader(); |
29 | 35 |
30 // The OnMessageCallback is called whenever a new message is received. | 36 // The OnMessageCallback is called whenever a new message is received. |
31 // Ownership of the message is passed the callback. | 37 // Ownership of the message is passed the callback. |
32 typedef Callback1<const RtpPacket&>::Type OnMessageCallback; | 38 typedef Callback1<const RtpPacket&>::Type OnMessageCallback; |
(...skipping 11 matching lines...) Expand all Loading... |
44 scoped_ptr<OnMessageCallback> on_message_callback_; | 50 scoped_ptr<OnMessageCallback> on_message_callback_; |
45 | 51 |
46 DISALLOW_COPY_AND_ASSIGN(RtpReader); | 52 DISALLOW_COPY_AND_ASSIGN(RtpReader); |
47 }; | 53 }; |
48 | 54 |
49 } // namespace protocol | 55 } // namespace protocol |
50 } // namespace remoting | 56 } // namespace remoting |
51 | 57 |
52 | 58 |
53 #endif // REMOTING_PROTOCOL_RTP_READER_H_ | 59 #endif // REMOTING_PROTOCOL_RTP_READER_H_ |
OLD | NEW |