metrics.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 #ifndef OPAL_RTP_METRICS_H
00028 #define OPAL_RTP_METRICS_H
00029
00030 #ifdef P_USE_PRAGMA
00031 #pragma interface
00032 #endif
00033
00034 #include <rtp/rtp.h>
00035
00036 #if OPAL_RTCP_XR
00037
00038 #include <list>
00039
00040 class RTP_Session;
00041 class RTP_DataFrame;
00042
00044
00045
00049 class RTCP_XR_Metrics
00050 {
00051 public:
00052 RTCP_XR_Metrics();
00053 ~RTCP_XR_Metrics();
00054
00055 enum PacketEvent {
00056 PACKET_RECEIVED,
00057 PACKET_DISCARDED,
00058 PACKET_LOST
00059 };
00060
00061 enum PeriodType {
00062 GAP,
00063 BURST,
00064 };
00065
00066
00067 typedef struct TimePeriod {
00068 PeriodType type;
00069 PTimeInterval duration;
00070 } TimePeriod;
00071
00075 typedef struct IdPeriod {
00076 PTimeInterval duration;
00077 float Id;
00078 } IdPeriod;
00079
00083 typedef struct IePeriod {
00084 PeriodType type;
00085 PTimeInterval duration;
00086 float Ieff;
00087 } IePeriod;
00088
00089 enum QualityType {
00090 LQ,
00091 CQ
00092 };
00093
00094 std::list<TimePeriod> timePeriods;
00095 std::list<IePeriod> iePeriods;
00096 std::list<IdPeriod> idPeriods;
00097
00101 void SetPayloadInfo(
00102 RTP_DataFrame frame
00103 );
00104
00108 void SetJitterDelay(
00109 DWORD delay
00110 );
00111
00114 void OnPacketReceived();
00115
00118 void OnPacketDiscarded();
00119
00122 void OnPacketLost();
00123
00126 void OnPacketLost(
00127 DWORD dropped
00128 );
00129
00132 void OnRxSenderReport(
00133 PUInt32b lsr,
00134 PUInt32b dlsr
00135 );
00136
00139 BYTE GetLossRate();
00140
00143 BYTE GetDiscardRate();
00144
00148 BYTE GetBurstDensity();
00149
00153 BYTE GetGapDensity();
00154
00158 PUInt16b GetBurstDuration();
00159
00163 PUInt16b GetGapDuration();
00164
00168 PUInt16b GetRoundTripDelay ();
00169
00172 PUInt16b GetEndSystemDelay();
00173
00176 BYTE RFactor();
00177
00182 BYTE MOS_LQ();
00183
00188 BYTE MOS_CQ();
00189
00190 private:
00199 void markov(
00200 PacketEvent event
00201 );
00202
00205 void ResetCounters();
00206
00209 BYTE RFactor(
00210 QualityType qt
00211 );
00212
00215 BYTE EndOfCallRFactor();
00216
00220 float MOS(
00221 QualityType qt
00222 );
00223
00227 float EndOfCallMOS();
00228
00231 float IdFactor();
00232
00235 float GetPonderateId();
00236
00239 float Ieff(
00240 PeriodType type
00241 );
00242
00245 float GetEndOfCallIe();
00246
00249 float GetPonderateIe();
00250
00253 TimePeriod createTimePeriod(
00254 PeriodType type,
00255 PTime beginTimestamp,
00256 PTime endTimestamp
00257 );
00258
00261 IdPeriod createIdPeriod(
00262 PTime beginTimestamp,
00263 PTime endTimestamp
00264 );
00265
00268 IePeriod createIePeriod(
00269 TimePeriod timePeriod
00270 );
00271
00272 DWORD gmin;
00273 DWORD lost;
00274 DWORD packetsReceived;
00275 DWORD packetsSinceLastLoss;
00276 DWORD packetsLost;
00277 DWORD packetsDiscarded;
00278 DWORD srPacketsReceived;
00279
00280 DWORD packetsReceivedInGap;
00281 DWORD packetsLostInGap;
00282
00283 DWORD packetsReceivedInBurst;
00284 DWORD packetsLostInBurst;
00285
00295 DWORD c5;
00296 DWORD c11;
00297 DWORD c13;
00298 DWORD c14;
00299 DWORD c22;
00300 DWORD c23;
00301 DWORD c31;
00302 DWORD c32;
00303 DWORD c33;
00304
00305
00306 PTime lsrTime;
00307 PTimeInterval dlsrTime;
00308 PTime arrivalTime;
00309
00310
00311 float Ie;
00312 float Bpl;
00313 unsigned payloadBitrate;
00314 PINDEX payloadSize;
00315 float lookAheadTime;
00316
00317 bool isPayloadTypeOK;
00318
00319 DWORD jitterDelay;
00320 float lastId;
00321 float lastIe;
00322
00323 PeriodType currentPeriodType;
00324 PTime periodBeginTimestamp;
00325 PTime lastLossTimestamp;
00326 PTime lastLossInBurstTimestamp;
00327 PTime lastJitterBufferChangeTimestamp;
00328
00329 };
00330
00331
00332 #endif // OPAL_RTCP_XR
00333
00334 #endif // OPAL_METRICS_H
00335
00336