OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 <stdint.h> | 10 #include <stdint.h> |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 void AddPli(uint32_t remote_ssrc, uint32_t local_ssrc); | 82 void AddPli(uint32_t remote_ssrc, uint32_t local_ssrc); |
83 | 83 |
84 void AddReceiverLog(uint32_t remote_ssrc); | 84 void AddReceiverLog(uint32_t remote_ssrc); |
85 void AddReceiverFrameLog(uint32_t rtp_timestamp, | 85 void AddReceiverFrameLog(uint32_t rtp_timestamp, |
86 int num_events, | 86 int num_events, |
87 uint32_t event_timesamp_base); | 87 uint32_t event_timesamp_base); |
88 void AddReceiverEventLog(uint16_t event_data, | 88 void AddReceiverEventLog(uint16_t event_data, |
89 CastLoggingEvent event, | 89 CastLoggingEvent event, |
90 uint16_t event_timesamp_delta); | 90 uint16_t event_timesamp_delta); |
91 | 91 |
92 scoped_ptr<Packet> GetPacket(); | 92 std::unique_ptr<Packet> GetPacket(); |
93 const uint8_t* Data(); | 93 const uint8_t* Data(); |
94 int Length() { return kMaxIpPacketSize - big_endian_writer_.remaining(); } | 94 int Length() { return kMaxIpPacketSize - big_endian_writer_.remaining(); } |
95 base::BigEndianReader* Reader(); | 95 base::BigEndianReader* Reader(); |
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_t buffer_[kMaxIpPacketSize]; | 103 uint8_t buffer_[kMaxIpPacketSize]; |
104 char* ptr_of_length_; | 104 char* ptr_of_length_; |
105 base::BigEndianWriter big_endian_writer_; | 105 base::BigEndianWriter big_endian_writer_; |
106 base::BigEndianReader big_endian_reader_; | 106 base::BigEndianReader big_endian_reader_; |
107 | 107 |
108 DISALLOW_COPY_AND_ASSIGN(TestRtcpPacketBuilder); | 108 DISALLOW_COPY_AND_ASSIGN(TestRtcpPacketBuilder); |
109 }; | 109 }; |
110 | 110 |
111 } // namespace cast | 111 } // namespace cast |
112 } // namespace media | 112 } // namespace media |
113 | 113 |
114 #endif // MEDIA_CAST_RTCP_TEST_RTCP_PACKET_BUILDER_H_ | 114 #endif // MEDIA_CAST_RTCP_TEST_RTCP_PACKET_BUILDER_H_ |
OLD | NEW |