| 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 #include "media/cast/net/rtcp/test_rtcp_packet_builder.h" | 5 #include "media/cast/net/rtcp/test_rtcp_packet_builder.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "media/cast/net/rtcp/rtcp_utility.h" | 8 #include "media/cast/net/rtcp/rtcp_utility.h" |
| 9 | 9 |
| 10 namespace media { | 10 namespace media { |
| (...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 222 void TestRtcpPacketBuilder::AddReceiverEventLog(uint16_t event_data, | 222 void TestRtcpPacketBuilder::AddReceiverEventLog(uint16_t event_data, |
| 223 CastLoggingEvent event, | 223 CastLoggingEvent event, |
| 224 uint16_t event_timesamp_delta) { | 224 uint16_t event_timesamp_delta) { |
| 225 big_endian_writer_.WriteU16(event_data); | 225 big_endian_writer_.WriteU16(event_data); |
| 226 uint8_t event_id = ConvertEventTypeToWireFormat(event); | 226 uint8_t event_id = ConvertEventTypeToWireFormat(event); |
| 227 uint16_t type_and_delta = static_cast<uint16_t>(event_id) << 12; | 227 uint16_t type_and_delta = static_cast<uint16_t>(event_id) << 12; |
| 228 type_and_delta += event_timesamp_delta & 0x0fff; | 228 type_and_delta += event_timesamp_delta & 0x0fff; |
| 229 big_endian_writer_.WriteU16(type_and_delta); | 229 big_endian_writer_.WriteU16(type_and_delta); |
| 230 } | 230 } |
| 231 | 231 |
| 232 scoped_ptr<media::cast::Packet> TestRtcpPacketBuilder::GetPacket() { | 232 std::unique_ptr<media::cast::Packet> TestRtcpPacketBuilder::GetPacket() { |
| 233 PatchLengthField(); | 233 PatchLengthField(); |
| 234 return scoped_ptr<media::cast::Packet>( | 234 return std::unique_ptr<media::cast::Packet>( |
| 235 new media::cast::Packet(buffer_, buffer_ + Length())); | 235 new media::cast::Packet(buffer_, buffer_ + Length())); |
| 236 } | 236 } |
| 237 | 237 |
| 238 const uint8_t* TestRtcpPacketBuilder::Data() { | 238 const uint8_t* TestRtcpPacketBuilder::Data() { |
| 239 PatchLengthField(); | 239 PatchLengthField(); |
| 240 return buffer_; | 240 return buffer_; |
| 241 } | 241 } |
| 242 | 242 |
| 243 base::BigEndianReader* TestRtcpPacketBuilder::Reader() { | 243 base::BigEndianReader* TestRtcpPacketBuilder::Reader() { |
| 244 big_endian_reader_ = base::BigEndianReader( | 244 big_endian_reader_ = base::BigEndianReader( |
| (...skipping 22 matching lines...) Expand all Loading... |
| 267 big_endian_writer_.WriteU8(0x80 | (format_or_count & 0x1F)); | 267 big_endian_writer_.WriteU8(0x80 | (format_or_count & 0x1F)); |
| 268 big_endian_writer_.WriteU8(payload); | 268 big_endian_writer_.WriteU8(payload); |
| 269 ptr_of_length_ = big_endian_writer_.ptr(); | 269 ptr_of_length_ = big_endian_writer_.ptr(); |
| 270 | 270 |
| 271 // Initialize length to "clearly illegal". | 271 // Initialize length to "clearly illegal". |
| 272 big_endian_writer_.WriteU16(0xDEAD); | 272 big_endian_writer_.WriteU16(0xDEAD); |
| 273 } | 273 } |
| 274 | 274 |
| 275 } // namespace cast | 275 } // namespace cast |
| 276 } // namespace media | 276 } // namespace media |
| OLD | NEW |