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 IMS_CALL_QULITY_H 18 #define IMS_CALL_QULITY_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 /** 35 * @brief Implementation of CallQualty class in native 36 * 37 */ 38 class CallQuality : public Parcelable 39 { 40 public: 41 CallQuality(); 42 CallQuality(const CallQuality& quality); 43 virtual ~CallQuality(); 44 enum 45 { 46 /** < 1% packet loss */ 47 kCallQualityExcellent = 0, 48 /** <= 3% packet loss */ 49 kCallQualityGood = 1, 50 /** <= 5% packet loss */ 51 kCallQualityFair = 2, 52 /** <= 8% packet loss */ 53 kCallQualityPoor = 3, 54 /** > 8% packet loss */ 55 kCallQualityBad = 4, 56 }; 57 58 enum 59 { 60 /** 61 * The codec type. This value corresponds to the AUDIO_QUALITY_* constants in 62 * {@link ImsStreamMediaProfile}. 63 */ 64 AUDIO_QUALITY_NONE = 0, 65 AUDIO_QUALITY_AMR, 66 AUDIO_QUALITY_AMR_WB, 67 AUDIO_QUALITY_QCELP13K, 68 AUDIO_QUALITY_EVRC, 69 AUDIO_QUALITY_EVRC_B, 70 AUDIO_QUALITY_EVRC_WB, 71 AUDIO_QUALITY_EVRC_NW, 72 AUDIO_QUALITY_GSM_EFR, 73 AUDIO_QUALITY_GSM_FR, 74 AUDIO_QUALITY_GSM_HR, 75 AUDIO_QUALITY_G711U, 76 AUDIO_QUALITY_G723, 77 AUDIO_QUALITY_G711A, 78 AUDIO_QUALITY_G722, 79 AUDIO_QUALITY_G711AB, 80 AUDIO_QUALITY_G729, 81 AUDIO_QUALITY_EVS_NB, 82 AUDIO_QUALITY_EVS_WB, 83 AUDIO_QUALITY_EVS_SWB, 84 AUDIO_QUALITY_EVS_FB, 85 }; 86 87 CallQuality& operator=(const CallQuality& quality); 88 bool operator==(const CallQuality& quality) const; 89 bool operator!=(const CallQuality& quality) const; 90 virtual status_t writeToParcel(Parcel* out) const; 91 virtual status_t readFromParcel(const Parcel* in); 92 93 int32_t getDownlinkCallQualityLevel(); 94 void setDownlinkCallQualityLevel(const int32_t level); 95 int32_t getUplinkCallQualityLevel(); 96 void setUplinkCallQualityLevel(const int32_t level); 97 int32_t getCallDuration(); 98 void setCallDuration(const int32_t duration); 99 int32_t getNumRtpPacketsTransmitted(); 100 void setNumRtpPacketsTransmitted(const int32_t num); 101 int32_t getNumRtpPacketsReceived(); 102 void setNumRtpPacketsReceived(const int32_t num); 103 int32_t getNumRtpPacketsTransmittedLost(); 104 void setNumRtpPacketsTransmittedLost(const int32_t num); 105 int32_t getNumRtpPacketsNotReceived(); 106 void setNumRtpPacketsNotReceived(const int32_t num); 107 int32_t getAverageRelativeJitter(); 108 void setAverageRelativeJitter(const int32_t jitter); 109 int32_t getMaxRelativeJitter(); 110 void setMaxRelativeJitter(const int32_t jitter); 111 int32_t getAverageRoundTripTime(); 112 void setAverageRoundTripTime(const int32_t time); 113 int32_t getCodecType(); 114 void setCodecType(const int32_t type); 115 bool getRtpInactivityDetected(); 116 void setRtpInactivityDetected(const bool detected); 117 bool getRxSilenceDetected(); 118 void setRxSilenceDetected(const bool detected); 119 bool getTxSilenceDetected(); 120 void setTxSilenceDetected(const bool detected); 121 int32_t getNumVoiceFrames(); 122 void setNumVoiceFrames(const int32_t num); 123 int32_t getNumNoDataFrames(); 124 void setNumNoDataFrames(const int32_t num); 125 int32_t getNumDroppedRtpPackets(); 126 void setNumDroppedRtpPackets(const int32_t num); 127 int64_t getMinPlayoutDelayMillis(); 128 void setMinPlayoutDelayMillis(const int64_t delay); 129 int64_t getMaxPlayoutDelayMillis(); 130 void setMaxPlayoutDelayMillis(const int64_t delay); 131 int32_t getNumRtpSidPacketsReceived(); 132 void setNumRtpSidPacketsReceived(const int32_t num); 133 int32_t getNumRtpDuplicatePackets(); 134 void setNumRtpDuplicatePackets(const int32_t num); 135 136 private: 137 /** The Downlink call quality level measured in 5 sec monitoring*/ 138 int32_t mDownlinkCallQualityLevel; 139 /** The Uplink call quality level */ 140 int32_t mUplinkCallQualityLevel; 141 /** The call duration in milliseconds since the call session began. */ 142 int32_t mCallDuration; 143 /** The number of RTP packets sent for an ongoing call. */ 144 int32_t mNumRtpPacketsTransmitted; 145 /** The number of RTP packets received for ongoing calls. */ 146 int32_t mNumRtpPacketsReceived; 147 /** The number of RTP packets which were lost in the network and never transmitted. */ 148 int32_t mNumRtpPacketsTransmittedLost; 149 /** The number of RTP packets which were lost in the network and never received. */ 150 int32_t mNumRtpPacketsNotReceived; 151 /** The average relative jitter in milliseconds. */ 152 int32_t mAverageRelativeJitter; 153 /** The maximum relative jitter in milliseconds. */ 154 int32_t mMaxRelativeJitter; 155 /** The average round trip delay in milliseconds. */ 156 int32_t mAverageRoundTripTime; 157 /** The codec type used in the ongoing call. */ 158 int32_t mCodecType; 159 /** To be true if no incoming RTP is received for a continuous duration of 4 seconds. */ 160 bool mRtpInactivityDetected; 161 /** To be true if only silence RTP packets are received for 20 seconds immediately after the 162 * call is connected. */ 163 bool mRxSilenceDetected; 164 /** True if only silence RTP packets are sent for 20 seconds immediately after the call is 165 * connected. The silence packet can be detected by observing that the RTP timestamp is not 166 * contiguous with the end of the interval covered by the previous packet even though the 167 * RTP sequence number has been incremented only by one. Check RFC 3389. */ 168 bool mTxSilenceDetected; 169 /** The number of voice frames sent by jitter buffer to audio. */ 170 int32_t mNumVoiceFrames; 171 /** The number of no-data frames sent by jitter buffer to audio. */ 172 int32_t mNumNoDataFrames; 173 /** The number of RTP Voice packets dropped by jitter buffer. */ 174 int32_t mNumDroppedRtpPackets; 175 /** The minimum playout delay in the reporting interval in milliseconds. */ 176 int64_t mMinPlayoutDelayMillis; 177 /** The maximum Playout delay in the reporting interval in milliseconds. */ 178 int64_t mMaxPlayoutDelayMillis; 179 /** The total number of RTP SID (Silence Insertion Descriptor) */ 180 int32_t mNumRtpSidPacketsReceived; 181 /** The total number of RTP duplicate packets received by this device for an ongoing call. */ 182 int32_t mNumRtpDuplicatePackets; 183 }; 184 185 } // namespace imsmedia 186 187 } // namespace telephony 188 189 } // namespace android 190 191 #endif