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 |
89 bool Packet::Parse(rtc::CopyOnWriteBuffer buffer) { | 93 bool Packet::Parse(rtc::CopyOnWriteBuffer buffer) { |
90 if (!ParseBuffer(buffer.cdata(), buffer.size())) { | 94 if (!ParseBuffer(buffer.cdata(), buffer.size())) { |
91 Clear(); | 95 Clear(); |
92 return false; | 96 return false; |
93 } | 97 } |
94 size_t buffer_size = buffer.size(); | 98 size_t buffer_size = buffer.size(); |
95 buffer_ = std::move(buffer); | 99 buffer_ = std::move(buffer); |
96 RTC_DCHECK_EQ(size(), buffer_size); | 100 RTC_DCHECK_EQ(size(), buffer_size); |
97 return true; | 101 return true; |
98 } | 102 } |
(...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
544 uint8_t* Packet::WriteAt(size_t offset) { | 548 uint8_t* Packet::WriteAt(size_t offset) { |
545 return buffer_.data() + offset; | 549 return buffer_.data() + offset; |
546 } | 550 } |
547 | 551 |
548 void Packet::WriteAt(size_t offset, uint8_t byte) { | 552 void Packet::WriteAt(size_t offset, uint8_t byte) { |
549 buffer_.data()[offset] = byte; | 553 buffer_.data()[offset] = byte; |
550 } | 554 } |
551 | 555 |
552 } // namespace rtp | 556 } // namespace rtp |
553 } // namespace webrtc | 557 } // namespace webrtc |
OLD | NEW |