Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1189)

Side by Side Diff: webrtc/modules/rtp_rtcp/source/rtp_packet.cc

Issue 2506373004: RtpPacket::payload() return rtc::ArrayView instead of raw pointer (Closed)
Patch Set: Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 } 165 }
166 166
167 size_t Packet::payload_size() const { 167 size_t Packet::payload_size() const {
168 return payload_size_; 168 return payload_size_;
169 } 169 }
170 170
171 size_t Packet::padding_size() const { 171 size_t Packet::padding_size() const {
172 return padding_size_; 172 return padding_size_;
173 } 173 }
174 174
175 const uint8_t* Packet::payload() const { 175 rtc::ArrayView<const uint8_t> Packet::payload() const {
176 return data() + payload_offset_; 176 return rtc::MakeArrayView(data() + payload_offset_, payload_size_);
177 } 177 }
178 178
179 rtc::CopyOnWriteBuffer Packet::Buffer() const { 179 rtc::CopyOnWriteBuffer Packet::Buffer() const {
180 return buffer_; 180 return buffer_;
181 } 181 }
182 182
183 size_t Packet::capacity() const { 183 size_t Packet::capacity() const {
184 return buffer_.capacity(); 184 return buffer_.capacity();
185 } 185 }
186 186
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after
525 uint8_t* Packet::WriteAt(size_t offset) { 525 uint8_t* Packet::WriteAt(size_t offset) {
526 return buffer_.data() + offset; 526 return buffer_.data() + offset;
527 } 527 }
528 528
529 void Packet::WriteAt(size_t offset, uint8_t byte) { 529 void Packet::WriteAt(size_t offset, uint8_t byte) {
530 buffer_.data()[offset] = byte; 530 buffer_.data()[offset] = byte;
531 } 531 }
532 532
533 } // namespace rtp 533 } // namespace rtp
534 } // namespace webrtc 534 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698