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/transport/rtp_sender/rtp_sender.h" | 5 #include "media/cast/net/rtp/rtp_sender.h" |
6 | 6 |
7 #include "base/big_endian.h" | 7 #include "base/big_endian.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/rand_util.h" | 9 #include "base/rand_util.h" |
10 #include "media/cast/transport/cast_transport_defines.h" | 10 #include "media/cast/net/cast_transport_defines.h" |
11 #include "media/cast/transport/pacing/paced_sender.h" | 11 #include "media/cast/net/pacing/paced_sender.h" |
12 | 12 |
13 namespace media { | 13 namespace media { |
14 namespace cast { | 14 namespace cast { |
15 namespace transport { | |
16 | 15 |
17 namespace { | 16 namespace { |
18 | 17 |
19 // If there is only one referecne to the packet then copy the | 18 // If there is only one referecne to the packet then copy the |
20 // reference and return. | 19 // reference and return. |
21 // Otherwise return a deep copy of the packet. | 20 // Otherwise return a deep copy of the packet. |
22 PacketRef FastCopyPacket(const PacketRef& packet) { | 21 PacketRef FastCopyPacket(const PacketRef& packet) { |
23 if (packet->HasOneRef()) | 22 if (packet->HasOneRef()) |
24 return packet; | 23 return packet; |
25 return make_scoped_refptr(new base::RefCountedData<Packet>(packet->data)); | 24 return make_scoped_refptr(new base::RefCountedData<Packet>(packet->data)); |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 void RtpSender::UpdateSequenceNumber(Packet* packet) { | 120 void RtpSender::UpdateSequenceNumber(Packet* packet) { |
122 // TODO(miu): This is an abstraction violation. This needs to be a part of | 121 // TODO(miu): This is an abstraction violation. This needs to be a part of |
123 // the overall packet (de)serialization consolidation. | 122 // the overall packet (de)serialization consolidation. |
124 static const int kByteOffsetToSequenceNumber = 2; | 123 static const int kByteOffsetToSequenceNumber = 2; |
125 base::BigEndianWriter big_endian_writer( | 124 base::BigEndianWriter big_endian_writer( |
126 reinterpret_cast<char*>((&packet->front()) + kByteOffsetToSequenceNumber), | 125 reinterpret_cast<char*>((&packet->front()) + kByteOffsetToSequenceNumber), |
127 sizeof(uint16)); | 126 sizeof(uint16)); |
128 big_endian_writer.WriteU16(packetizer_->NextSequenceNumber()); | 127 big_endian_writer.WriteU16(packetizer_->NextSequenceNumber()); |
129 } | 128 } |
130 | 129 |
131 } // namespace transport | |
132 } // namespace cast | 130 } // namespace cast |
133 } // namespace media | 131 } // namespace media |
OLD | NEW |