| 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(c_name.size()); // c_name length in bytes. | 48 big_endian_writer_.WriteU8( |
| 49 static_cast<uint8>(c_name.size())); // c_name length in bytes. |
| 49 for (size_t i = 0; i < c_name.size(); ++i) { | 50 for (size_t i = 0; i < c_name.size(); ++i) { |
| 50 big_endian_writer_.WriteU8(c_name.c_str()[i]); | 51 big_endian_writer_.WriteU8(c_name.c_str()[i]); |
| 51 } | 52 } |
| 52 int padding; | 53 int padding; |
| 53 switch (c_name.size() % 4) { | 54 switch (c_name.size() % 4) { |
| 54 case 0: | 55 case 0: |
| 55 padding = 2; | 56 padding = 2; |
| 56 break; | 57 break; |
| 57 case 1: | 58 case 1: |
| 58 padding = 1; | 59 padding = 1; |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 221 big_endian_writer_.WriteU8(0x80 | (format_or_count & 0x1F)); | 222 big_endian_writer_.WriteU8(0x80 | (format_or_count & 0x1F)); |
| 222 big_endian_writer_.WriteU8(payload); | 223 big_endian_writer_.WriteU8(payload); |
| 223 ptr_of_length_ = big_endian_writer_.ptr(); | 224 ptr_of_length_ = big_endian_writer_.ptr(); |
| 224 | 225 |
| 225 // Initialize length to "clearly illegal". | 226 // Initialize length to "clearly illegal". |
| 226 big_endian_writer_.WriteU16(0xDEAD); | 227 big_endian_writer_.WriteU16(0xDEAD); |
| 227 } | 228 } |
| 228 | 229 |
| 229 } // namespace cast | 230 } // namespace cast |
| 230 } // namespace media | 231 } // namespace media |
| OLD | NEW |