1 /** 2 * Copyright (C) 2022 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 AUDIOCONFIG_H 18 #define AUDIOCONFIG_H 19 20 #include <binder/Parcel.h> 21 #include <binder/Parcelable.h> 22 #include <binder/Status.h> 23 #include <RtpConfig.h> 24 #include <EvsParams.h> 25 #include <AmrParams.h> 26 27 namespace android 28 { 29 30 namespace telephony 31 { 32 33 namespace imsmedia 34 { 35 36 /** Native representation of android.telephony.imsmedia.AudioConfig */ 37 38 /** 39 * The class represents RTP (Real Time Control) configuration for audio stream. 40 */ 41 class AudioConfig : public RtpConfig 42 { 43 public: 44 enum CodecType 45 { 46 /** Adaptive Multi-Rate */ 47 CODEC_AMR = 1 << 0, 48 /** Adaptive Multi-Rate Wide Band */ 49 CODEC_AMR_WB = 1 << 1, 50 /** Enhanced Voice Services */ 51 CODEC_EVS = 1 << 2, 52 /** G.711 A-law i.e. Pulse Code Modulation using A-law */ 53 CODEC_PCMA = 1 << 3, 54 /** G.711 μ-law i.e. Pulse Code Modulation using μ-law */ 55 CODEC_PCMU = 1 << 4, 56 }; 57 58 AudioConfig(); 59 AudioConfig(AudioConfig* config); 60 AudioConfig(const AudioConfig& config); 61 virtual ~AudioConfig(); 62 AudioConfig& operator=(const AudioConfig& config); 63 bool operator==(const AudioConfig& config) const; 64 bool operator!=(const AudioConfig& config) const; 65 virtual status_t writeToParcel(Parcel* parcel) const; 66 virtual status_t readFromParcel(const Parcel* in); 67 void setPtimeMillis(const int8_t ptime); 68 int8_t getPtimeMillis(); 69 void setMaxPtimeMillis(const int32_t maxPtime); 70 int32_t getMaxPtimeMillis(); 71 void setDtxEnabled(const bool enable); 72 bool getDtxEnabled(); 73 void setCodecType(const int32_t type); 74 int32_t getCodecType(); 75 void setTxDtmfPayloadTypeNumber(const int8_t num); 76 void setRxDtmfPayloadTypeNumber(const int8_t num); 77 int8_t getTxDtmfPayloadTypeNumber(); 78 int8_t getRxDtmfPayloadTypeNumber(); 79 void setDtmfsamplingRateKHz(const int8_t sampling); 80 int8_t getDtmfsamplingRateKHz(); 81 void setAmrParams(const AmrParams& param); 82 AmrParams getAmrParams(); 83 void setEvsParams(const EvsParams& param); 84 EvsParams getEvsParams(); 85 86 protected: 87 /** 88 * @brief Recommended length of time in milliseconds represented by the media 89 * in each packet, see RFC 4566 90 */ 91 int8_t pTimeMillis; 92 /** 93 * @brief Maximum amount of media that can be encapsulated in each packet 94 * represented in milliseconds, see RFC 4566 95 */ 96 int32_t maxPtimeMillis; 97 /** 98 * @brief Whether discontinuous transmission is enabled or not 99 */ 100 bool dtxEnabled; 101 /** 102 * @brief Audio codec type 103 */ 104 int32_t codecType; 105 /** 106 * @brief Dynamic payload type number to be used for DTMF RTP packets. The values is 107 * in the range from 96 to 127 chosen during the session establishment. The PT 108 * value of the RTP header of all DTMF packets shall be set with this value. 109 */ 110 int8_t mDtmfTxPayloadTypeNumber; 111 112 /** 113 * @brief Dynamic payload type number to be used for DTMF RTP packets. The values is 114 * in the range from 96 to 127 chosen during the session establishment. The PT 115 * value of the RTP header of all DTMF packets shall be set with this value. 116 */ 117 int8_t mDtmfRxPayloadTypeNumber; 118 /** 119 * @brief Sampling rate for DTMF tone in kHz 120 */ 121 int8_t dtmfsamplingRateKHz; 122 /** 123 * @brief Negotiated AMR codec parameters 124 */ 125 AmrParams amrParams; 126 /** 127 * @brief Negotiated EVS codec parameters 128 */ 129 EvsParams evsParams; 130 }; 131 132 } // namespace imsmedia 133 134 } // namespace telephony 135 136 } // namespace android 137 138 #endif 139