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 #include "media/cast/rtcp/test_rtcp_packet_builder.h" | 5 #include "media/cast/rtcp/test_rtcp_packet_builder.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 | 8 |
9 namespace media { | 9 namespace media { |
10 namespace cast { | 10 namespace cast { |
(...skipping 27 matching lines...) Expand all Loading... |
38 big_endian_writer_.WriteU32(kJitter); | 38 big_endian_writer_.WriteU32(kJitter); |
39 big_endian_writer_.WriteU32(kLastSr); | 39 big_endian_writer_.WriteU32(kLastSr); |
40 big_endian_writer_.WriteU32(kDelayLastSr); | 40 big_endian_writer_.WriteU32(kDelayLastSr); |
41 } | 41 } |
42 | 42 |
43 void TestRtcpPacketBuilder::AddSdesCname(uint32 sender_ssrc, | 43 void TestRtcpPacketBuilder::AddSdesCname(uint32 sender_ssrc, |
44 const std::string& c_name) { | 44 const std::string& c_name) { |
45 AddRtcpHeader(202, 1); | 45 AddRtcpHeader(202, 1); |
46 big_endian_writer_.WriteU32(sender_ssrc); | 46 big_endian_writer_.WriteU32(sender_ssrc); |
47 big_endian_writer_.WriteU8(1); // c_name. | 47 big_endian_writer_.WriteU8(1); // c_name. |
48 big_endian_writer_.WriteU8( | 48 big_endian_writer_.WriteU8(c_name.size()); // c_name length in bytes. |
49 static_cast<uint8>(c_name.size())); // c_name length in bytes. | |
50 for (size_t i = 0; i < c_name.size(); ++i) { | 49 for (size_t i = 0; i < c_name.size(); ++i) { |
51 big_endian_writer_.WriteU8(c_name.c_str()[i]); | 50 big_endian_writer_.WriteU8(c_name.c_str()[i]); |
52 } | 51 } |
53 int padding; | 52 int padding; |
54 switch (c_name.size() % 4) { | 53 switch (c_name.size() % 4) { |
55 case 0: | 54 case 0: |
56 padding = 2; | 55 padding = 2; |
57 break; | 56 break; |
58 case 1: | 57 case 1: |
59 padding = 1; | 58 padding = 1; |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
222 big_endian_writer_.WriteU8(0x80 | (format_or_count & 0x1F)); | 221 big_endian_writer_.WriteU8(0x80 | (format_or_count & 0x1F)); |
223 big_endian_writer_.WriteU8(payload); | 222 big_endian_writer_.WriteU8(payload); |
224 ptr_of_length_ = big_endian_writer_.ptr(); | 223 ptr_of_length_ = big_endian_writer_.ptr(); |
225 | 224 |
226 // Initialize length to "clearly illegal". | 225 // Initialize length to "clearly illegal". |
227 big_endian_writer_.WriteU16(0xDEAD); | 226 big_endian_writer_.WriteU16(0xDEAD); |
228 } | 227 } |
229 | 228 |
230 } // namespace cast | 229 } // namespace cast |
231 } // namespace media | 230 } // namespace media |
OLD | NEW |