| 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 #include "base/logging.h" | 6 #include "base/logging.h" |
| 7 | 7 |
| 8 namespace media { | 8 namespace media { |
| 9 namespace cast { | 9 namespace cast { |
| 10 | 10 |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 180 big_endian_writer_.WriteU8('E'); | 180 big_endian_writer_.WriteU8('E'); |
| 181 big_endian_writer_.WriteU8('M'); | 181 big_endian_writer_.WriteU8('M'); |
| 182 big_endian_writer_.WriteU8('B'); | 182 big_endian_writer_.WriteU8('B'); |
| 183 big_endian_writer_.WriteU8(1); // Number of SSRCs. | 183 big_endian_writer_.WriteU8(1); // Number of SSRCs. |
| 184 big_endian_writer_.WriteU8(1); // BR Exp. | 184 big_endian_writer_.WriteU8(1); // BR Exp. |
| 185 // BR Mantissa. | 185 // BR Mantissa. |
| 186 big_endian_writer_.WriteU16(static_cast<uint16>(kTestRembBitrate / 2)); | 186 big_endian_writer_.WriteU16(static_cast<uint16>(kTestRembBitrate / 2)); |
| 187 big_endian_writer_.WriteU32(media_ssrc); | 187 big_endian_writer_.WriteU32(media_ssrc); |
| 188 } | 188 } |
| 189 | 189 |
| 190 void TestRtcpPacketBuilder::AddCast(uint32 sender_ssrc, uint32 media_ssrc) { | 190 void TestRtcpPacketBuilder::AddCast(uint32 sender_ssrc, |
| 191 uint32 media_ssrc, |
| 192 uint16 target_delay_ms) { |
| 191 AddRtcpHeader(206, 15); | 193 AddRtcpHeader(206, 15); |
| 192 big_endian_writer_.WriteU32(sender_ssrc); | 194 big_endian_writer_.WriteU32(sender_ssrc); |
| 193 big_endian_writer_.WriteU32(media_ssrc); | 195 big_endian_writer_.WriteU32(media_ssrc); |
| 194 big_endian_writer_.WriteU8('C'); | 196 big_endian_writer_.WriteU8('C'); |
| 195 big_endian_writer_.WriteU8('A'); | 197 big_endian_writer_.WriteU8('A'); |
| 196 big_endian_writer_.WriteU8('S'); | 198 big_endian_writer_.WriteU8('S'); |
| 197 big_endian_writer_.WriteU8('T'); | 199 big_endian_writer_.WriteU8('T'); |
| 198 big_endian_writer_.WriteU8(kAckFrameId); | 200 big_endian_writer_.WriteU8(kAckFrameId); |
| 199 big_endian_writer_.WriteU8(3); // Loss fields. | 201 big_endian_writer_.WriteU8(3); // Loss fields. |
| 200 big_endian_writer_.WriteU16(0); // Reserved. | 202 big_endian_writer_.WriteU16(target_delay_ms); |
| 201 big_endian_writer_.WriteU8(kLostFrameId); | 203 big_endian_writer_.WriteU8(kLostFrameId); |
| 202 big_endian_writer_.WriteU16(kRtcpCastAllPacketsLost); | 204 big_endian_writer_.WriteU16(kRtcpCastAllPacketsLost); |
| 203 big_endian_writer_.WriteU8(0); // Lost packet id mask. | 205 big_endian_writer_.WriteU8(0); // Lost packet id mask. |
| 204 big_endian_writer_.WriteU8(kFrameIdWithLostPackets); | 206 big_endian_writer_.WriteU8(kFrameIdWithLostPackets); |
| 205 big_endian_writer_.WriteU16(kLostPacketId1); | 207 big_endian_writer_.WriteU16(kLostPacketId1); |
| 206 big_endian_writer_.WriteU8(0x2); // Lost packet id mask. | 208 big_endian_writer_.WriteU8(0x2); // Lost packet id mask. |
| 207 big_endian_writer_.WriteU8(kFrameIdWithLostPackets); | 209 big_endian_writer_.WriteU8(kFrameIdWithLostPackets); |
| 208 big_endian_writer_.WriteU16(kLostPacketId3); | 210 big_endian_writer_.WriteU16(kLostPacketId3); |
| 209 big_endian_writer_.WriteU8(0); // Lost packet id mask. | 211 big_endian_writer_.WriteU8(0); // Lost packet id mask. |
| 210 } | 212 } |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 284 big_endian_writer_.WriteU8(0x80 | (format_or_count & 0x1F)); | 286 big_endian_writer_.WriteU8(0x80 | (format_or_count & 0x1F)); |
| 285 big_endian_writer_.WriteU8(payload); | 287 big_endian_writer_.WriteU8(payload); |
| 286 ptr_of_length_ = big_endian_writer_.ptr(); | 288 ptr_of_length_ = big_endian_writer_.ptr(); |
| 287 | 289 |
| 288 // Initialize length to "clearly illegal". | 290 // Initialize length to "clearly illegal". |
| 289 big_endian_writer_.WriteU16(0xDEAD); | 291 big_endian_writer_.WriteU16(0xDEAD); |
| 290 } | 292 } |
| 291 | 293 |
| 292 } // namespace cast | 294 } // namespace cast |
| 293 } // namespace media | 295 } // namespace media |
| OLD | NEW |