1 /* 2 * libjingle 3 * Copyright 2012, Google Inc. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions are met: 7 * 8 * 1. Redistributions of source code must retain the above copyright notice, 9 * this list of conditions and the following disclaimer. 10 * 2. Redistributions in binary form must reproduce the above copyright notice, 11 * this list of conditions and the following disclaimer in the documentation 12 * and/or other materials provided with the distribution. 13 * 3. The name of the author may not be used to endorse or promote products 14 * derived from this software without specific prior written permission. 15 * 16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 17 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 18 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO 19 * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 20 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 21 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 22 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 23 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 24 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 25 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 */ 27 28 // This file contains structures used for retrieving statistics from an ongoing 29 // libjingle session. 30 31 #ifndef TALK_APP_WEBRTC_STATSTYPES_H_ 32 #define TALK_APP_WEBRTC_STATSTYPES_H_ 33 34 #include <string> 35 #include <vector> 36 37 #include "talk/base/basictypes.h" 38 #include "talk/base/stringencode.h" 39 40 namespace webrtc { 41 42 class StatsReport { 43 public: 44 StatsReport() : timestamp(0) { } 45 46 std::string id; // See below for contents. 47 std::string type; // See below for contents. 48 49 struct Value { 50 std::string name; 51 std::string value; 52 }; 53 54 void AddValue(const std::string& name, const std::string& value); 55 void AddValue(const std::string& name, int64 value); 56 void AddBoolean(const std::string& name, bool value); 57 58 double timestamp; // Time since 1970-01-01T00:00:00Z in milliseconds. 59 typedef std::vector<Value> Values; 60 Values values; 61 62 // StatsReport types. 63 // A StatsReport of |type| = "googSession" contains overall information 64 // about the thing libjingle calls a session (which may contain one 65 // or more RTP sessions. 66 static const char kStatsReportTypeSession[]; 67 68 // A StatsReport of |type| = "googTransport" contains information 69 // about a libjingle "transport". 70 static const char kStatsReportTypeTransport[]; 71 72 // A StatsReport of |type| = "googComponent" contains information 73 // about a libjingle "channel" (typically, RTP or RTCP for a transport). 74 // This is intended to be the same thing as an ICE "Component". 75 static const char kStatsReportTypeComponent[]; 76 77 // A StatsReport of |type| = "googCandidatePair" contains information 78 // about a libjingle "connection" - a single source/destination port pair. 79 // This is intended to be the same thing as an ICE "candidate pair". 80 static const char kStatsReportTypeCandidatePair[]; 81 82 // StatsReport of |type| = "VideoBWE" is statistics for video Bandwidth 83 // Estimation, which is global per-session. The |id| field is "bweforvideo" 84 // (will probably change in the future). 85 static const char kStatsReportTypeBwe[]; 86 87 // StatsReport of |type| = "ssrc" is statistics for a specific rtp stream. 88 // The |id| field is the SSRC in decimal form of the rtp stream. 89 static const char kStatsReportTypeSsrc[]; 90 91 // StatsReport of |type| = "googTrack" is statistics for a specific media 92 // track. The |id| field is the track id. 93 static const char kStatsReportTypeTrack[]; 94 95 // StatsReport of |type| = "iceCandidate" is statistics on a specific 96 // ICE Candidate. It links to its transport. 97 static const char kStatsReportTypeIceCandidate[]; 98 99 // The id of StatsReport of type VideoBWE. 100 static const char kStatsReportVideoBweId[]; 101 102 // StatsValue names 103 static const char kStatsValueNameAudioOutputLevel[]; 104 static const char kStatsValueNameAudioInputLevel[]; 105 static const char kStatsValueNameBytesSent[]; 106 static const char kStatsValueNamePacketsSent[]; 107 static const char kStatsValueNameBytesReceived[]; 108 static const char kStatsValueNamePacketsReceived[]; 109 static const char kStatsValueNamePacketsLost[]; 110 static const char kStatsValueNameTransportId[]; 111 static const char kStatsValueNameLocalAddress[]; 112 static const char kStatsValueNameRemoteAddress[]; 113 static const char kStatsValueNameWritable[]; 114 static const char kStatsValueNameReadable[]; 115 static const char kStatsValueNameActiveConnection[]; 116 117 118 // Internal StatsValue names 119 static const char kStatsValueNameCodecName[]; 120 static const char kStatsValueNameEchoCancellationQualityMin[]; 121 static const char kStatsValueNameEchoDelayMedian[]; 122 static const char kStatsValueNameEchoDelayStdDev[]; 123 static const char kStatsValueNameEchoReturnLoss[]; 124 static const char kStatsValueNameEchoReturnLossEnhancement[]; 125 static const char kStatsValueNameFirsReceived[]; 126 static const char kStatsValueNameFirsSent[]; 127 static const char kStatsValueNameFrameHeightReceived[]; 128 static const char kStatsValueNameFrameHeightSent[]; 129 static const char kStatsValueNameFrameRateReceived[]; 130 static const char kStatsValueNameFrameRateDecoded[]; 131 static const char kStatsValueNameFrameRateOutput[]; 132 static const char kStatsValueNameFrameRateInput[]; 133 static const char kStatsValueNameFrameRateSent[]; 134 static const char kStatsValueNameFrameWidthReceived[]; 135 static const char kStatsValueNameFrameWidthSent[]; 136 static const char kStatsValueNameJitterReceived[]; 137 static const char kStatsValueNameNacksReceived[]; 138 static const char kStatsValueNameNacksSent[]; 139 static const char kStatsValueNameRtt[]; 140 static const char kStatsValueNameAvailableSendBandwidth[]; 141 static const char kStatsValueNameAvailableReceiveBandwidth[]; 142 static const char kStatsValueNameTargetEncBitrate[]; 143 static const char kStatsValueNameActualEncBitrate[]; 144 static const char kStatsValueNameRetransmitBitrate[]; 145 static const char kStatsValueNameTransmitBitrate[]; 146 static const char kStatsValueNameBucketDelay[]; 147 static const char kStatsValueNameInitiator[]; 148 static const char kStatsValueNameTransportType[]; 149 static const char kStatsValueNameContentName[]; 150 static const char kStatsValueNameComponent[]; 151 static const char kStatsValueNameChannelId[]; 152 static const char kStatsValueNameTrackId[]; 153 static const char kStatsValueNameSsrc[]; 154 }; 155 156 typedef std::vector<StatsReport> StatsReports; 157 158 } // namespace webrtc 159 160 #endif // TALK_APP_WEBRTC_STATSTYPES_H_ 161