OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2016 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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 bool Packet::Parse(const uint8_t* buffer, size_t buffer_size) { | 79 bool Packet::Parse(const uint8_t* buffer, size_t buffer_size) { |
80 if (!ParseBuffer(buffer, buffer_size)) { | 80 if (!ParseBuffer(buffer, buffer_size)) { |
81 Clear(); | 81 Clear(); |
82 return false; | 82 return false; |
83 } | 83 } |
84 buffer_.SetData(buffer, buffer_size); | 84 buffer_.SetData(buffer, buffer_size); |
85 RTC_DCHECK_EQ(size(), buffer_size); | 85 RTC_DCHECK_EQ(size(), buffer_size); |
86 return true; | 86 return true; |
87 } | 87 } |
88 | 88 |
89 bool Packet::Parse(rtc::ArrayView<const uint8_t> packet) { | |
90 return Parse(packet.data(), packet.size()); | |
91 } | |
92 | |
93 bool Packet::Parse(rtc::CopyOnWriteBuffer buffer) { | 89 bool Packet::Parse(rtc::CopyOnWriteBuffer buffer) { |
94 if (!ParseBuffer(buffer.cdata(), buffer.size())) { | 90 if (!ParseBuffer(buffer.cdata(), buffer.size())) { |
95 Clear(); | 91 Clear(); |
96 return false; | 92 return false; |
97 } | 93 } |
98 size_t buffer_size = buffer.size(); | 94 size_t buffer_size = buffer.size(); |
99 buffer_ = std::move(buffer); | 95 buffer_ = std::move(buffer); |
100 RTC_DCHECK_EQ(size(), buffer_size); | 96 RTC_DCHECK_EQ(size(), buffer_size); |
101 return true; | 97 return true; |
102 } | 98 } |
(...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
548 uint8_t* Packet::WriteAt(size_t offset) { | 544 uint8_t* Packet::WriteAt(size_t offset) { |
549 return buffer_.data() + offset; | 545 return buffer_.data() + offset; |
550 } | 546 } |
551 | 547 |
552 void Packet::WriteAt(size_t offset, uint8_t byte) { | 548 void Packet::WriteAt(size_t offset, uint8_t byte) { |
553 buffer_.data()[offset] = byte; | 549 buffer_.data()[offset] = byte; |
554 } | 550 } |
555 | 551 |
556 } // namespace rtp | 552 } // namespace rtp |
557 } // namespace webrtc | 553 } // namespace webrtc |
OLD | NEW |