| 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 // Sender report. | 19 // Sender report. |
| 19 static const int kNtpHigh = 0x01020304; | 20 static const int kNtpHigh = 0x01020304; |
| 20 static const int kNtpLow = 0x05060708; | 21 static const int kNtpLow = 0x05060708; |
| 21 static const int kRtpTimestamp = 0x10203; | 22 static const int kRtpTimestamp = 0x10203; |
| 22 static const int kSendPacketCount = 987; | 23 static const int kSendPacketCount = 987; |
| 23 static const int kSendOctetCount = 87654; | 24 static const int kSendOctetCount = 87654; |
| 24 | 25 |
| 25 // Report block. | 26 // Report block. |
| 26 static const int kLoss = 0x01000123; | 27 static const int kLoss = 0x01000123; |
| 27 static const int kExtendedMax = 0x15678; | 28 static const int kExtendedMax = 0x15678; |
| (...skipping 15 matching lines...) Expand all Loading... |
| 43 // NACK. | 44 // NACK. |
| 44 static const int kMissingPacket = 34567; | 45 static const int kMissingPacket = 34567; |
| 45 | 46 |
| 46 // CAST. | 47 // CAST. |
| 47 static const int kAckFrameId = 17; | 48 static const int kAckFrameId = 17; |
| 48 static const int kLostFrameId = 18; | 49 static const int kLostFrameId = 18; |
| 49 static const int kFrameIdWithLostPackets = 19; | 50 static const int kFrameIdWithLostPackets = 19; |
| 50 static const int kLostPacketId1 = 3; | 51 static const int kLostPacketId1 = 3; |
| 51 static const int kLostPacketId2 = 5; | 52 static const int kLostPacketId2 = 5; |
| 52 static const int kLostPacketId3 = 12; | 53 static const int kLostPacketId3 = 12; |
| 54 } // namespace |
| 53 | 55 |
| 54 class TestRtcpPacketBuilder { | 56 class TestRtcpPacketBuilder { |
| 55 public: | 57 public: |
| 56 TestRtcpPacketBuilder(); | 58 TestRtcpPacketBuilder(); |
| 57 | 59 |
| 58 void AddSr(uint32 sender_ssrc, int number_of_report_blocks); | 60 void AddSr(uint32 sender_ssrc, int number_of_report_blocks); |
| 59 void AddSrWithNtp(uint32 sender_ssrc, uint32 ntp_high, uint32 ntp_low, | 61 void AddSrWithNtp(uint32 sender_ssrc, uint32 ntp_high, uint32 ntp_low, |
| 60 uint32 rtp_timestamp); | 62 uint32 rtp_timestamp); |
| 61 void AddRr(uint32 sender_ssrc, int number_of_report_blocks); | 63 void AddRr(uint32 sender_ssrc, int number_of_report_blocks); |
| 62 void AddRb(uint32 rtp_ssrc); | 64 void AddRb(uint32 rtp_ssrc); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 87 // Note: 0 is not a legal value, it is used for "uninitialized". | 89 // Note: 0 is not a legal value, it is used for "uninitialized". |
| 88 uint8 buffer_[kIpPacketSize]; | 90 uint8 buffer_[kIpPacketSize]; |
| 89 char* ptr_of_length_; | 91 char* ptr_of_length_; |
| 90 net::BigEndianWriter big_endian_writer_; | 92 net::BigEndianWriter big_endian_writer_; |
| 91 }; | 93 }; |
| 92 | 94 |
| 93 } // namespace cast | 95 } // namespace cast |
| 94 } // namespace media | 96 } // namespace media |
| 95 | 97 |
| 96 #endif // MEDIA_CAST_RTCP_TEST_RTCP_PACKET_BUILDER_H_ | 98 #endif // MEDIA_CAST_RTCP_TEST_RTCP_PACKET_BUILDER_H_ |
| OLD | NEW |