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 "media/cast/rtcp/rtcp_defines.h" | 10 #include "media/cast/rtcp/rtcp_defines.h" |
11 #include "net/base/big_endian.h" | 11 #include "net/base/big_endian.h" |
12 | 12 |
13 namespace media { | 13 namespace media { |
14 namespace cast { | 14 namespace cast { |
15 | 15 |
16 // These values are arbitrary only for the purpose of testing. | 16 // These values are arbitrary only for the purpose of testing. |
17 | 17 |
18 namespace { | 18 namespace { |
19 // Sender report. | 19 // Sender report. |
20 static const int kNtpHigh = 0x01020304; | 20 static const int kNtpHigh = 0x01020304; |
21 static const int kNtpLow = 0x05060708; | 21 static const int kNtpLow = 0x05060708; |
22 static const int kRtpTimestamp = 0x10203; | 22 static const int kRtpTimestamp = 0x10203040; |
23 static const int kSendPacketCount = 987; | 23 static const int kSendPacketCount = 987; |
24 static const int kSendOctetCount = 87654; | 24 static const int kSendOctetCount = 87654; |
25 | 25 |
26 // Report block. | 26 // Report block. |
27 static const int kLoss = 0x01000123; | 27 static const int kLoss = 0x01000123; |
28 static const int kExtendedMax = 0x15678; | 28 static const int kExtendedMax = 0x15678; |
29 static const int kTestJitter = 0x10203; | 29 static const int kTestJitter = 0x10203; |
30 static const int kLastSr = 0x34561234; | 30 static const int kLastSr = 0x34561234; |
31 static const int kDelayLastSr = 1000; | 31 static const int kDelayLastSr = 1000; |
32 | 32 |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 void AddXrRrtrBlock(); | 70 void AddXrRrtrBlock(); |
71 void AddXrUnknownBlock(); | 71 void AddXrUnknownBlock(); |
72 | 72 |
73 void AddNack(uint32 sender_ssrc, uint32 media_ssrc); | 73 void AddNack(uint32 sender_ssrc, uint32 media_ssrc); |
74 void AddSendReportRequest(uint32 sender_ssrc, uint32 media_ssrc); | 74 void AddSendReportRequest(uint32 sender_ssrc, uint32 media_ssrc); |
75 | 75 |
76 void AddPli(uint32 sender_ssrc, uint32 media_ssrc); | 76 void AddPli(uint32 sender_ssrc, uint32 media_ssrc); |
77 void AddRpsi(uint32 sender_ssrc, uint32 media_ssrc); | 77 void AddRpsi(uint32 sender_ssrc, uint32 media_ssrc); |
78 void AddRemb(uint32 sender_ssrc, uint32 media_ssrc); | 78 void AddRemb(uint32 sender_ssrc, uint32 media_ssrc); |
79 void AddCast(uint32 sender_ssrc, uint32 media_ssrc); | 79 void AddCast(uint32 sender_ssrc, uint32 media_ssrc); |
| 80 void AddSenderLog(uint32 sender_ssrc); |
| 81 void AddSenderFrameLog(uint8 event_id, uint32 rtp_timestamp); |
| 82 void AddReceiverLog(uint32 sender_ssrc); |
| 83 void AddReceiverFrameLog(uint32 rtp_timestamp, int num_events, |
| 84 uint32 event_timesamp_base); |
| 85 void AddReceiverEventLog(uint16 event_data, uint8 event_id, |
| 86 uint16 event_timesamp_delta); |
80 | 87 |
81 const uint8* Packet(); | 88 const uint8* Packet(); |
82 int Length() { return kIpPacketSize - big_endian_writer_.remaining(); } | 89 int Length() { return kIpPacketSize - big_endian_writer_.remaining(); } |
83 | 90 |
84 private: | 91 private: |
85 void AddRtcpHeader(int payload, int format_or_count); | 92 void AddRtcpHeader(int payload, int format_or_count); |
86 void PatchLengthField(); | 93 void PatchLengthField(); |
87 | 94 |
88 // Where the length field of the current packet is. | 95 // Where the length field of the current packet is. |
89 // Note: 0 is not a legal value, it is used for "uninitialized". | 96 // Note: 0 is not a legal value, it is used for "uninitialized". |
90 uint8 buffer_[kIpPacketSize]; | 97 uint8 buffer_[kIpPacketSize]; |
91 char* ptr_of_length_; | 98 char* ptr_of_length_; |
92 net::BigEndianWriter big_endian_writer_; | 99 net::BigEndianWriter big_endian_writer_; |
93 }; | 100 }; |
94 | 101 |
95 } // namespace cast | 102 } // namespace cast |
96 } // namespace media | 103 } // namespace media |
97 | 104 |
98 #endif // MEDIA_CAST_RTCP_TEST_RTCP_PACKET_BUILDER_H_ | 105 #endif // MEDIA_CAST_RTCP_TEST_RTCP_PACKET_BUILDER_H_ |
OLD | NEW |