OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 652 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
663 rtc::scoped_ptr<RawPacket> RtcpPacket::Build() const { | 663 rtc::scoped_ptr<RawPacket> RtcpPacket::Build() const { |
664 size_t length = 0; | 664 size_t length = 0; |
665 rtc::scoped_ptr<RawPacket> packet(new RawPacket(IP_PACKET_SIZE)); | 665 rtc::scoped_ptr<RawPacket> packet(new RawPacket(IP_PACKET_SIZE)); |
666 | 666 |
667 class PacketVerifier : public PacketReadyCallback { | 667 class PacketVerifier : public PacketReadyCallback { |
668 public: | 668 public: |
669 explicit PacketVerifier(RawPacket* packet) | 669 explicit PacketVerifier(RawPacket* packet) |
670 : called_(false), packet_(packet) {} | 670 : called_(false), packet_(packet) {} |
671 virtual ~PacketVerifier() {} | 671 virtual ~PacketVerifier() {} |
672 void OnPacketReady(uint8_t* data, size_t length) override { | 672 void OnPacketReady(uint8_t* data, size_t length) override { |
673 CHECK(!called_) << "Fragmentation not supported."; | 673 RTC_CHECK(!called_) << "Fragmentation not supported."; |
674 called_ = true; | 674 called_ = true; |
675 packet_->SetLength(length); | 675 packet_->SetLength(length); |
676 } | 676 } |
677 | 677 |
678 private: | 678 private: |
679 bool called_; | 679 bool called_; |
680 RawPacket* const packet_; | 680 RawPacket* const packet_; |
681 } verifier(packet.get()); | 681 } verifier(packet.get()); |
682 CreateAndAddAppended(packet->MutableBuffer(), &length, packet->BufferLength(), | 682 CreateAndAddAppended(packet->MutableBuffer(), &length, packet->BufferLength(), |
683 &verifier); | 683 &verifier); |
(...skipping 536 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1220 return length_; | 1220 return length_; |
1221 } | 1221 } |
1222 | 1222 |
1223 void RawPacket::SetLength(size_t length) { | 1223 void RawPacket::SetLength(size_t length) { |
1224 assert(length <= buffer_length_); | 1224 assert(length <= buffer_length_); |
1225 length_ = length; | 1225 length_ = length; |
1226 } | 1226 } |
1227 | 1227 |
1228 } // namespace rtcp | 1228 } // namespace rtcp |
1229 } // namespace webrtc | 1229 } // namespace webrtc |
OLD | NEW |