| 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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 bool Packet::Parse(const uint8_t* buffer, size_t buffer_size) { | 77 bool Packet::Parse(const uint8_t* buffer, size_t buffer_size) { |
| 78 if (!ParseBuffer(buffer, buffer_size)) { | 78 if (!ParseBuffer(buffer, buffer_size)) { |
| 79 Clear(); | 79 Clear(); |
| 80 return false; | 80 return false; |
| 81 } | 81 } |
| 82 buffer_.SetData(buffer, buffer_size); | 82 buffer_.SetData(buffer, buffer_size); |
| 83 RTC_DCHECK_EQ(size(), buffer_size); | 83 RTC_DCHECK_EQ(size(), buffer_size); |
| 84 return true; | 84 return true; |
| 85 } | 85 } |
| 86 | 86 |
| 87 bool Packet::Parse(rtc::ArrayView<const uint8_t> packet) { |
| 88 return Parse(packet.data(), packet.size()); |
| 89 } |
| 90 |
| 87 bool Packet::Parse(rtc::CopyOnWriteBuffer buffer) { | 91 bool Packet::Parse(rtc::CopyOnWriteBuffer buffer) { |
| 88 if (!ParseBuffer(buffer.cdata(), buffer.size())) { | 92 if (!ParseBuffer(buffer.cdata(), buffer.size())) { |
| 89 Clear(); | 93 Clear(); |
| 90 return false; | 94 return false; |
| 91 } | 95 } |
| 92 size_t buffer_size = buffer.size(); | 96 size_t buffer_size = buffer.size(); |
| 93 buffer_ = std::move(buffer); | 97 buffer_ = std::move(buffer); |
| 94 RTC_DCHECK_EQ(size(), buffer_size); | 98 RTC_DCHECK_EQ(size(), buffer_size); |
| 95 return true; | 99 return true; |
| 96 } | 100 } |
| (...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 525 uint8_t* Packet::WriteAt(size_t offset) { | 529 uint8_t* Packet::WriteAt(size_t offset) { |
| 526 return buffer_.data() + offset; | 530 return buffer_.data() + offset; |
| 527 } | 531 } |
| 528 | 532 |
| 529 void Packet::WriteAt(size_t offset, uint8_t byte) { | 533 void Packet::WriteAt(size_t offset, uint8_t byte) { |
| 530 buffer_.data()[offset] = byte; | 534 buffer_.data()[offset] = byte; |
| 531 } | 535 } |
| 532 | 536 |
| 533 } // namespace rtp | 537 } // namespace rtp |
| 534 } // namespace webrtc | 538 } // namespace webrtc |
| OLD | NEW |