1 /** 2 * Copyright (C) 2023 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 #ifndef RTPEXTENSION_H 18 #define RTPEXTENSION_H 19 20 #include <binder/Parcel.h> 21 #include <binder/Parcelable.h> 22 #include <binder/Status.h> 23 #include <stdint.h> 24 25 namespace android 26 { 27 28 namespace telephony 29 { 30 31 namespace imsmedia 32 { 33 34 /** Native representation of android.telephony.imsmedia.RtpHeaderExtension */ 35 36 /** 37 * The class to encapsulate RTP header extension. 38 * Per RFC8285, an RTP header extension consists of both a local identifier in the range 1-14, an 39 * 8-bit length indicator and a number of extension data bytes equivalent to the stated length. 40 */ 41 class RtpHeaderExtension : public Parcelable 42 { 43 public: 44 RtpHeaderExtension(); 45 RtpHeaderExtension(const RtpHeaderExtension& extension); 46 virtual ~RtpHeaderExtension(); 47 RtpHeaderExtension& operator=(const RtpHeaderExtension& extension); 48 bool operator==(const RtpHeaderExtension& extension) const; 49 bool operator!=(const RtpHeaderExtension& extension) const; 50 virtual status_t writeToParcel(Parcel* parcel) const; 51 virtual status_t readFromParcel(const Parcel* in); 52 int32_t getLocalIdentifier(); 53 void setLocalIdentifier(int32_t id); 54 uint8_t* getExtensionData() const; 55 void setExtensionData(const uint8_t* data, const int32_t size); 56 int32_t getExtensionDataSize(); 57 void setExtensionDataSize(int32_t size); 58 59 protected: 60 // The local identifier for this RTP header extension. 61 int32_t mLocalIdentifier; 62 // The data for this RTP header extension. 63 uint8_t* mExtensionData; 64 // The length of the mExtensionData 65 int32_t mExtensionDataSize; 66 }; 67 } // namespace imsmedia 68 } // namespace telephony 69 } // namespace android 70 71 #endif