OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 // A very simple packet builder class for building RTCP packets. | 5 // A very simple packet builder class for building RTCP packets. |
6 // Used for testing only. | 6 // Used for testing only. |
7 #ifndef MEDIA_CAST_RTCP_TEST_RTCP_PACKET_BUILDER_H_ | 7 #ifndef MEDIA_CAST_RTCP_TEST_RTCP_PACKET_BUILDER_H_ |
8 #define MEDIA_CAST_RTCP_TEST_RTCP_PACKET_BUILDER_H_ | 8 #define MEDIA_CAST_RTCP_TEST_RTCP_PACKET_BUILDER_H_ |
9 | 9 |
| 10 #include "base/big_endian.h" |
10 #include "media/cast/cast_config.h" | 11 #include "media/cast/cast_config.h" |
11 #include "media/cast/rtcp/rtcp_defines.h" | 12 #include "media/cast/rtcp/rtcp_defines.h" |
12 #include "net/base/big_endian.h" | |
13 | 13 |
14 namespace media { | 14 namespace media { |
15 namespace cast { | 15 namespace cast { |
16 | 16 |
17 // These values are arbitrary only for the purpose of testing. | 17 // These values are arbitrary only for the purpose of testing. |
18 | 18 |
19 namespace { | 19 namespace { |
20 // Sender report. | 20 // Sender report. |
21 static const int kNtpHigh = 0x01020304; | 21 static const int kNtpHigh = 0x01020304; |
22 static const int kNtpLow = 0x05060708; | 22 static const int kNtpLow = 0x05060708; |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 int Length() { return kMaxIpPacketSize - big_endian_writer_.remaining(); } | 95 int Length() { return kMaxIpPacketSize - big_endian_writer_.remaining(); } |
96 | 96 |
97 private: | 97 private: |
98 void AddRtcpHeader(int payload, int format_or_count); | 98 void AddRtcpHeader(int payload, int format_or_count); |
99 void PatchLengthField(); | 99 void PatchLengthField(); |
100 | 100 |
101 // Where the length field of the current packet is. | 101 // Where the length field of the current packet is. |
102 // Note: 0 is not a legal value, it is used for "uninitialized". | 102 // Note: 0 is not a legal value, it is used for "uninitialized". |
103 uint8 buffer_[kMaxIpPacketSize]; | 103 uint8 buffer_[kMaxIpPacketSize]; |
104 char* ptr_of_length_; | 104 char* ptr_of_length_; |
105 net::BigEndianWriter big_endian_writer_; | 105 base::BigEndianWriter big_endian_writer_; |
106 | 106 |
107 DISALLOW_COPY_AND_ASSIGN(TestRtcpPacketBuilder); | 107 DISALLOW_COPY_AND_ASSIGN(TestRtcpPacketBuilder); |
108 }; | 108 }; |
109 | 109 |
110 } // namespace cast | 110 } // namespace cast |
111 } // namespace media | 111 } // namespace media |
112 | 112 |
113 #endif // MEDIA_CAST_RTCP_TEST_RTCP_PACKET_BUILDER_H_ | 113 #endif // MEDIA_CAST_RTCP_TEST_RTCP_PACKET_BUILDER_H_ |
OLD | NEW |