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

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

Issue 2789773004: Add functions to get/set rtp header extension by id. (Closed)
Patch Set: . Created 3 years, 8 months 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_
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 88
89 template <typename Extension, typename... Values> 89 template <typename Extension, typename... Values>
90 bool GetExtension(Values...) const; 90 bool GetExtension(Values...) const;
91 91
92 template <typename Extension, typename... Values> 92 template <typename Extension, typename... Values>
93 bool SetExtension(Values...); 93 bool SetExtension(Values...);
94 94
95 template <typename Extension> 95 template <typename Extension>
96 bool ReserveExtension(); 96 bool ReserveExtension();
97 97
98 bool HasRawExtension(int id) const;
nisse-webrtc 2017/04/03 09:38:00 |id| is the numerical value used on the wire (and
danilchap 2017/04/03 10:57:00 Failed to find verbose enough argument name, so ad
99
100 // Returns place where extension with |id| is stored.
101 // Returns empty arrayview if extension is not present.
nisse-webrtc 2017/04/03 09:38:00 The return convention makes sense, assuming that n
danilchap 2017/04/03 10:57:00 Yes, extension is not allowed to have 0 length.
102 rtc::ArrayView<const uint8_t> GetRawExtension(int id) const;
103
104 // Allocates and store header extension. Returns true on success.
105 bool SetRawExtension(int id, rtc::ArrayView<const uint8_t> data);
106
107 // Allocates and returns place to store rtp header extension.
108 // Returns empty arrayview on failure.
109 rtc::ArrayView<uint8_t> AllocateRawExtension(int id, size_t length);
110
98 // Reserve size_bytes for payload. Returns nullptr on failure. 111 // Reserve size_bytes for payload. Returns nullptr on failure.
99 uint8_t* SetPayloadSize(size_t size_bytes); 112 uint8_t* SetPayloadSize(size_t size_bytes);
100 // Same as SetPayloadSize but doesn't guarantee to keep current payload. 113 // Same as SetPayloadSize but doesn't guarantee to keep current payload.
101 uint8_t* AllocatePayload(size_t size_bytes); 114 uint8_t* AllocatePayload(size_t size_bytes);
102 bool SetPadding(uint8_t size_bytes, Random* random); 115 bool SetPadding(uint8_t size_bytes, Random* random);
103 116
104 protected: 117 protected:
105 // |extensions| required for SetExtension/ReserveExtension functions during 118 // |extensions| required for SetExtension/ReserveExtension functions during
106 // packet creating and used if available in Parse function. 119 // packet creating and used if available in Parse function.
107 // Adding and getting extensions will fail until |extensions| is 120 // Adding and getting extensions will fail until |extensions| is
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 uint16_t offset = 0; 200 uint16_t offset = 0;
188 if (!AllocateExtension(Extension::kId, Extension::kValueSizeBytes, &offset)) 201 if (!AllocateExtension(Extension::kId, Extension::kValueSizeBytes, &offset))
189 return false; 202 return false;
190 memset(WriteAt(offset), 0, Extension::kValueSizeBytes); 203 memset(WriteAt(offset), 0, Extension::kValueSizeBytes);
191 return true; 204 return true;
192 } 205 }
193 } // namespace rtp 206 } // namespace rtp
194 } // namespace webrtc 207 } // namespace webrtc
195 208
196 #endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_RTP_PACKET_H_ 209 #endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_RTP_PACKET_H_
OLDNEW
« no previous file with comments | « no previous file | webrtc/modules/rtp_rtcp/source/rtp_packet.cc » ('j') | webrtc/modules/rtp_rtcp/source/rtp_packet.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698