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

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

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 #ifndef WEBRTC_MODULES_RTP_RTCP_SOURCE_RTP_PACKET_H_ 10 #ifndef WEBRTC_MODULES_RTP_RTCP_SOURCE_RTP_PACKET_H_
11 #define WEBRTC_MODULES_RTP_RTCP_SOURCE_RTP_PACKET_H_ 11 #define WEBRTC_MODULES_RTP_RTCP_SOURCE_RTP_PACKET_H_
12 12
13 #include <vector> 13 #include <vector>
14 14
15 #include "webrtc/base/array_view.h"
15 #include "webrtc/base/basictypes.h" 16 #include "webrtc/base/basictypes.h"
16 #include "webrtc/base/copyonwritebuffer.h" 17 #include "webrtc/base/copyonwritebuffer.h"
17 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h" 18 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h"
18 19
19 namespace webrtc { 20 namespace webrtc {
20 struct RTPHeader; 21 struct RTPHeader;
21 class RtpHeaderExtensionMap; 22 class RtpHeaderExtensionMap;
22 class Random; 23 class Random;
23 24
24 namespace rtp { 25 namespace rtp {
(...skipping 24 matching lines...) Expand all
49 50
50 // TODO(danilchap): Remove this function when all code update to use RtpPacket 51 // TODO(danilchap): Remove this function when all code update to use RtpPacket
51 // directly. Function is there just for easier backward compatibilty. 52 // directly. Function is there just for easier backward compatibilty.
52 void GetHeader(RTPHeader* header) const; 53 void GetHeader(RTPHeader* header) const;
53 54
54 size_t headers_size() const; 55 size_t headers_size() const;
55 56
56 // Payload. 57 // Payload.
57 size_t payload_size() const; 58 size_t payload_size() const;
58 size_t padding_size() const; 59 size_t padding_size() const;
59 const uint8_t* payload() const; 60 rtc::ArrayView<const uint8_t> payload() const;
60 61
61 // Buffer. 62 // Buffer.
62 rtc::CopyOnWriteBuffer Buffer() const; 63 rtc::CopyOnWriteBuffer Buffer() const;
63 size_t capacity() const; 64 size_t capacity() const;
64 size_t size() const; 65 size_t size() const;
65 const uint8_t* data() const; 66 const uint8_t* data() const;
66 size_t FreeCapacity() const; 67 size_t FreeCapacity() const;
67 size_t MaxPayloadSize() const; 68 size_t MaxPayloadSize() const;
68 69
69 // Reset fields and buffer. 70 // Reset fields and buffer.
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 uint16_t offset = 0; 191 uint16_t offset = 0;
191 if (!AllocateExtension(Extension::kId, Extension::kValueSizeBytes, &offset)) 192 if (!AllocateExtension(Extension::kId, Extension::kValueSizeBytes, &offset))
192 return false; 193 return false;
193 memset(WriteAt(offset), 0, Extension::kValueSizeBytes); 194 memset(WriteAt(offset), 0, Extension::kValueSizeBytes);
194 return true; 195 return true;
195 } 196 }
196 } // namespace rtp 197 } // namespace rtp
197 } // namespace webrtc 198 } // namespace webrtc
198 199
199 #endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_RTP_PACKET_H_ 200 #endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_RTP_PACKET_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698