| 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 #ifndef WEBRTC_MODULES_RTP_RTCP_SOURCE_RTP_PACKET_H_ | 10 #ifndef WEBRTC_MODULES_RTP_RTCP_SOURCE_RTP_PACKET_H_ |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 // Reserve size_bytes for payload. Returns nullptr on failure. | 98 // Reserve size_bytes for payload. Returns nullptr on failure. |
| 99 uint8_t* SetPayloadSize(size_t size_bytes); |
| 100 // Same as SetPayloadSize but doesn't guarantee to keep current payload. |
| 99 uint8_t* AllocatePayload(size_t size_bytes); | 101 uint8_t* AllocatePayload(size_t size_bytes); |
| 100 void SetPayloadSize(size_t size_bytes); | |
| 101 bool SetPadding(uint8_t size_bytes, Random* random); | 102 bool SetPadding(uint8_t size_bytes, Random* random); |
| 102 | 103 |
| 103 protected: | 104 protected: |
| 104 // |extensions| required for SetExtension/ReserveExtension functions during | 105 // |extensions| required for SetExtension/ReserveExtension functions during |
| 105 // packet creating and used if available in Parse function. | 106 // packet creating and used if available in Parse function. |
| 106 // Adding and getting extensions will fail until |extensions| is | 107 // Adding and getting extensions will fail until |extensions| is |
| 107 // provided via constructor or IdentifyExtensions function. | 108 // provided via constructor or IdentifyExtensions function. |
| 108 Packet(); | 109 Packet(); |
| 109 explicit Packet(const ExtensionManager* extensions); | 110 explicit Packet(const ExtensionManager* extensions); |
| 110 Packet(const Packet&) = default; | 111 Packet(const Packet&) = default; |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 uint16_t offset = 0; | 187 uint16_t offset = 0; |
| 187 if (!AllocateExtension(Extension::kId, Extension::kValueSizeBytes, &offset)) | 188 if (!AllocateExtension(Extension::kId, Extension::kValueSizeBytes, &offset)) |
| 188 return false; | 189 return false; |
| 189 memset(WriteAt(offset), 0, Extension::kValueSizeBytes); | 190 memset(WriteAt(offset), 0, Extension::kValueSizeBytes); |
| 190 return true; | 191 return true; |
| 191 } | 192 } |
| 192 } // namespace rtp | 193 } // namespace rtp |
| 193 } // namespace webrtc | 194 } // namespace webrtc |
| 194 | 195 |
| 195 #endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_RTP_PACKET_H_ | 196 #endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_RTP_PACKET_H_ |
| OLD | NEW |