Upstream version 7.36.149.0
[platform/framework/web/crosswalk.git] / src / third_party / libjingle / source / talk / app / webrtc / statstypes.h
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   template <typename T>
57   void AddValue(const std::string& name, const std::vector<T>& value);
58   void AddBoolean(const std::string& name, bool value);
59
60   void ReplaceValue(const std::string& name, const std::string& value);
61
62   double timestamp;  // Time since 1970-01-01T00:00:00Z in milliseconds.
63   typedef std::vector<Value> Values;
64   Values values;
65
66   // StatsReport types.
67   // A StatsReport of |type| = "googSession" contains overall information
68   // about the thing libjingle calls a session (which may contain one
69   // or more RTP sessions.
70   static const char kStatsReportTypeSession[];
71
72   // A StatsReport of |type| = "googTransport" contains information
73   // about a libjingle "transport".
74   static const char kStatsReportTypeTransport[];
75
76   // A StatsReport of |type| = "googComponent" contains information
77   // about a libjingle "channel" (typically, RTP or RTCP for a transport).
78   // This is intended to be the same thing as an ICE "Component".
79   static const char kStatsReportTypeComponent[];
80
81   // A StatsReport of |type| = "googCandidatePair" contains information
82   // about a libjingle "connection" - a single source/destination port pair.
83   // This is intended to be the same thing as an ICE "candidate pair".
84   static const char kStatsReportTypeCandidatePair[];
85
86   // StatsReport of |type| = "VideoBWE" is statistics for video Bandwidth
87   // Estimation, which is global per-session.  The |id| field is "bweforvideo"
88   // (will probably change in the future).
89   static const char kStatsReportTypeBwe[];
90
91   // StatsReport of |type| = "ssrc" is statistics for a specific rtp stream.
92   // The |id| field is the SSRC in decimal form of the rtp stream.
93   static const char kStatsReportTypeSsrc[];
94
95   // StatsReport of |type| = "remoteSsrc" is statistics for a specific
96   // rtp stream, generated by the remote end of the connection.
97   static const char kStatsReportTypeRemoteSsrc[];
98
99   // StatsReport of |type| = "googTrack" is statistics for a specific media
100   // track. The |id| field is the track id.
101   static const char kStatsReportTypeTrack[];
102
103   // StatsReport of |type| = "iceCandidate" is statistics on a specific
104   // ICE Candidate. It links to its transport.
105   static const char kStatsReportTypeIceCandidate[];
106
107   // The id of StatsReport of type VideoBWE.
108   static const char kStatsReportVideoBweId[];
109
110   // A StatsReport of |type| = "googCertificate" contains an SSL certificate
111   // transmitted by one of the endpoints of this connection.  The |id| is
112   // controlled by the fingerprint, and is used to identify the certificate in
113   // the Channel stats (as "googLocalCertificateId" or
114   // "googRemoteCertificateId") and in any child certificates (as
115   // "googIssuerId").
116   static const char kStatsReportTypeCertificate[];
117
118   // StatsValue names
119   static const char kStatsValueNameAudioOutputLevel[];
120   static const char kStatsValueNameAudioInputLevel[];
121   static const char kStatsValueNameBytesSent[];
122   static const char kStatsValueNamePacketsSent[];
123   static const char kStatsValueNameBytesReceived[];
124   static const char kStatsValueNamePacketsReceived[];
125   static const char kStatsValueNamePacketsLost[];
126   static const char kStatsValueNameTransportId[];
127   static const char kStatsValueNameLocalAddress[];
128   static const char kStatsValueNameRemoteAddress[];
129   static const char kStatsValueNameWritable[];
130   static const char kStatsValueNameReadable[];
131   static const char kStatsValueNameActiveConnection[];
132
133
134   // Internal StatsValue names
135   static const char kStatsValueNameAvgEncodeMs[];
136   static const char kStatsValueNameEncodeUsagePercent[];
137   static const char kStatsValueNameCaptureJitterMs[];
138   static const char kStatsValueNameCaptureQueueDelayMsPerS[];
139   static const char kStatsValueNameCodecName[];
140   static const char kStatsValueNameBandwidthLimitedResolution[];
141   static const char kStatsValueNameCpuLimitedResolution[];
142   static const char kStatsValueNameViewLimitedResolution[];
143   static const char kStatsValueNameEchoCancellationQualityMin[];
144   static const char kStatsValueNameEchoDelayMedian[];
145   static const char kStatsValueNameEchoDelayStdDev[];
146   static const char kStatsValueNameEchoReturnLoss[];
147   static const char kStatsValueNameEchoReturnLossEnhancement[];
148   static const char kStatsValueNameExpandRate[];
149   static const char kStatsValueNameFirsReceived[];
150   static const char kStatsValueNameFirsSent[];
151   static const char kStatsValueNameFrameHeightInput[];
152   static const char kStatsValueNameFrameHeightReceived[];
153   static const char kStatsValueNameFrameHeightSent[];
154   static const char kStatsValueNameFrameRateReceived[];
155   static const char kStatsValueNameFrameRateDecoded[];
156   static const char kStatsValueNameFrameRateOutput[];
157   static const char kStatsValueNameDecodeMs[];
158   static const char kStatsValueNameMaxDecodeMs[];
159   static const char kStatsValueNameCurrentDelayMs[];
160   static const char kStatsValueNameTargetDelayMs[];
161   static const char kStatsValueNameJitterBufferMs[];
162   static const char kStatsValueNameMinPlayoutDelayMs[];
163   static const char kStatsValueNameRenderDelayMs[];
164   static const char kStatsValueNameCaptureStartNtpTimeMs[];
165   static const char kStatsValueNameFrameRateInput[];
166   static const char kStatsValueNameFrameRateSent[];
167   static const char kStatsValueNameFrameWidthInput[];
168   static const char kStatsValueNameFrameWidthReceived[];
169   static const char kStatsValueNameFrameWidthSent[];
170   static const char kStatsValueNameJitterReceived[];
171   static const char kStatsValueNameNacksReceived[];
172   static const char kStatsValueNameNacksSent[];
173   static const char kStatsValueNamePlisReceived[];
174   static const char kStatsValueNamePlisSent[];
175   static const char kStatsValueNamePreferredJitterBufferMs[];
176   static const char kStatsValueNameRtt[];
177   static const char kStatsValueNameAvailableSendBandwidth[];
178   static const char kStatsValueNameAvailableReceiveBandwidth[];
179   static const char kStatsValueNameTargetEncBitrate[];
180   static const char kStatsValueNameActualEncBitrate[];
181   static const char kStatsValueNameRetransmitBitrate[];
182   static const char kStatsValueNameTransmitBitrate[];
183   static const char kStatsValueNameBucketDelay[];
184   static const char kStatsValueNameInitiator[];
185   static const char kStatsValueNameTransportType[];
186   static const char kStatsValueNameContentName[];
187   static const char kStatsValueNameComponent[];
188   static const char kStatsValueNameChannelId[];
189   static const char kStatsValueNameTrackId[];
190   static const char kStatsValueNameSsrc[];
191   static const char kStatsValueNameTypingNoiseState[];
192   static const char kStatsValueNameDer[];
193   static const char kStatsValueNameFingerprint[];
194   static const char kStatsValueNameFingerprintAlgorithm[];
195   static const char kStatsValueNameIssuerId[];
196   static const char kStatsValueNameLocalCertificateId[];
197   static const char kStatsValueNameRemoteCertificateId[];
198   static const char kStatsValueNameLocalCandidateType[];
199   static const char kStatsValueNameRemoteCandidateType[];
200   static const char kStatsValueNameRecvPacketGroupArrivalTimeDebug[];
201   static const char kStatsValueNameRecvPacketGroupPropagationDeltaDebug[];
202   static const char kStatsValueNameRecvPacketGroupPropagationDeltaSumDebug[];
203 };
204
205 typedef std::vector<StatsReport> StatsReports;
206
207 }  // namespace webrtc
208
209 #endif  // TALK_APP_WEBRTC_STATSTYPES_H_