statstypes.cc revision c9d155faebd5556c9ea86306dc15aa9dac0e13f7
15c3ee4bce6c61bb4095eb3746ba39d3eeab2ee93tommi@webrtc.org/*
25c3ee4bce6c61bb4095eb3746ba39d3eeab2ee93tommi@webrtc.org * libjingle
35c3ee4bce6c61bb4095eb3746ba39d3eeab2ee93tommi@webrtc.org * Copyright 2014, Google Inc.
45c3ee4bce6c61bb4095eb3746ba39d3eeab2ee93tommi@webrtc.org *
55c3ee4bce6c61bb4095eb3746ba39d3eeab2ee93tommi@webrtc.org * Redistribution and use in source and binary forms, with or without
65c3ee4bce6c61bb4095eb3746ba39d3eeab2ee93tommi@webrtc.org * modification, are permitted provided that the following conditions are met:
75c3ee4bce6c61bb4095eb3746ba39d3eeab2ee93tommi@webrtc.org *
85c3ee4bce6c61bb4095eb3746ba39d3eeab2ee93tommi@webrtc.org *  1. Redistributions of source code must retain the above copyright notice,
95c3ee4bce6c61bb4095eb3746ba39d3eeab2ee93tommi@webrtc.org *     this list of conditions and the following disclaimer.
105c3ee4bce6c61bb4095eb3746ba39d3eeab2ee93tommi@webrtc.org *  2. Redistributions in binary form must reproduce the above copyright notice,
115c3ee4bce6c61bb4095eb3746ba39d3eeab2ee93tommi@webrtc.org *     this list of conditions and the following disclaimer in the documentation
125c3ee4bce6c61bb4095eb3746ba39d3eeab2ee93tommi@webrtc.org *     and/or other materials provided with the distribution.
135c3ee4bce6c61bb4095eb3746ba39d3eeab2ee93tommi@webrtc.org *  3. The name of the author may not be used to endorse or promote products
145c3ee4bce6c61bb4095eb3746ba39d3eeab2ee93tommi@webrtc.org *     derived from this software without specific prior written permission.
155c3ee4bce6c61bb4095eb3746ba39d3eeab2ee93tommi@webrtc.org *
165c3ee4bce6c61bb4095eb3746ba39d3eeab2ee93tommi@webrtc.org * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
175c3ee4bce6c61bb4095eb3746ba39d3eeab2ee93tommi@webrtc.org * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
185c3ee4bce6c61bb4095eb3746ba39d3eeab2ee93tommi@webrtc.org * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
195c3ee4bce6c61bb4095eb3746ba39d3eeab2ee93tommi@webrtc.org * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
205c3ee4bce6c61bb4095eb3746ba39d3eeab2ee93tommi@webrtc.org * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
215c3ee4bce6c61bb4095eb3746ba39d3eeab2ee93tommi@webrtc.org * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
225c3ee4bce6c61bb4095eb3746ba39d3eeab2ee93tommi@webrtc.org * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
235c3ee4bce6c61bb4095eb3746ba39d3eeab2ee93tommi@webrtc.org * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
245c3ee4bce6c61bb4095eb3746ba39d3eeab2ee93tommi@webrtc.org * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
255c3ee4bce6c61bb4095eb3746ba39d3eeab2ee93tommi@webrtc.org * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
265c3ee4bce6c61bb4095eb3746ba39d3eeab2ee93tommi@webrtc.org */
275c3ee4bce6c61bb4095eb3746ba39d3eeab2ee93tommi@webrtc.org
285c3ee4bce6c61bb4095eb3746ba39d3eeab2ee93tommi@webrtc.org#include "talk/app/webrtc/statstypes.h"
295c3ee4bce6c61bb4095eb3746ba39d3eeab2ee93tommi@webrtc.org
305c3ee4bce6c61bb4095eb3746ba39d3eeab2ee93tommi@webrtc.orgnamespace webrtc {
315c3ee4bce6c61bb4095eb3746ba39d3eeab2ee93tommi@webrtc.org
32c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org// The items below are in alphabetical order.
33c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.orgconst char StatsReport::kStatsValueNameActiveConnection[] =
34c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org    "googActiveConnection";
35c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.orgconst char StatsReport::kStatsValueNameActualEncBitrate[] =
36c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org    "googActualEncBitrate";
37c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.orgconst char StatsReport::kStatsValueNameAudioOutputLevel[] = "audioOutputLevel";
38c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.orgconst char StatsReport::kStatsValueNameAudioInputLevel[] = "audioInputLevel";
39c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.orgconst char StatsReport::kStatsValueNameAvailableReceiveBandwidth[] =
40c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org    "googAvailableReceiveBandwidth";
41c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.orgconst char StatsReport::kStatsValueNameAvailableSendBandwidth[] =
42c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org    "googAvailableSendBandwidth";
43c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.orgconst char StatsReport::kStatsValueNameAvgEncodeMs[] = "googAvgEncodeMs";
44c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.orgconst char StatsReport::kStatsValueNameBucketDelay[] = "googBucketDelay";
45c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.orgconst char StatsReport::kStatsValueNameBytesReceived[] = "bytesReceived";
46c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.orgconst char StatsReport::kStatsValueNameBytesSent[] = "bytesSent";
47c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.orgconst char StatsReport::kStatsValueNameBandwidthLimitedResolution[] =
48c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org    "googBandwidthLimitedResolution";
49c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.orgconst char StatsReport::kStatsValueNameCaptureJitterMs[] =
50c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org    "googCaptureJitterMs";
51c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.orgconst char StatsReport::kStatsValueNameCaptureQueueDelayMsPerS[] =
52c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org    "googCaptureQueueDelayMsPerS";
53c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.orgconst char StatsReport::kStatsValueNameChannelId[] = "googChannelId";
54c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.orgconst char StatsReport::kStatsValueNameCodecName[] = "googCodecName";
55c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.orgconst char StatsReport::kStatsValueNameComponent[] = "googComponent";
56c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.orgconst char StatsReport::kStatsValueNameContentName[] = "googContentName";
57c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.orgconst char StatsReport::kStatsValueNameCpuLimitedResolution[] =
58c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org    "googCpuLimitedResolution";
59c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.orgconst char StatsReport::kStatsValueNameDecodingCTSG[] =
60c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org    "googDecodingCTSG";
61c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.orgconst char StatsReport::kStatsValueNameDecodingCTN[] =
62c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org    "googDecodingCTN";
63c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.orgconst char StatsReport::kStatsValueNameDecodingNormal[] =
64c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org    "googDecodingNormal";
65c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.orgconst char StatsReport::kStatsValueNameDecodingPLC[] =
66c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org    "googDecodingPLC";
67c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.orgconst char StatsReport::kStatsValueNameDecodingCNG[] =
68c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org    "googDecodingCNG";
69c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.orgconst char StatsReport::kStatsValueNameDecodingPLCCNG[] =
70c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org    "googDecodingPLCCNG";
71c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.orgconst char StatsReport::kStatsValueNameDer[] = "googDerBase64";
72c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org// Echo metrics from the audio processing module.
73c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.orgconst char StatsReport::kStatsValueNameEchoCancellationQualityMin[] =
74c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org    "googEchoCancellationQualityMin";
75c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.orgconst char StatsReport::kStatsValueNameEchoDelayMedian[] =
76c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org    "googEchoCancellationEchoDelayMedian";
77c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.orgconst char StatsReport::kStatsValueNameEchoDelayStdDev[] =
78c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org    "googEchoCancellationEchoDelayStdDev";
79c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.orgconst char StatsReport::kStatsValueNameEchoReturnLoss[] =
80c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org    "googEchoCancellationReturnLoss";
81c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.orgconst char StatsReport::kStatsValueNameEchoReturnLossEnhancement[] =
82c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org    "googEchoCancellationReturnLossEnhancement";
83c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org
84c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.orgconst char StatsReport::kStatsValueNameEncodeUsagePercent[] =
85c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org    "googEncodeUsagePercent";
86c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.orgconst char StatsReport::kStatsValueNameExpandRate[] = "googExpandRate";
87c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.orgconst char StatsReport::kStatsValueNameFingerprint[] = "googFingerprint";
88c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.orgconst char StatsReport::kStatsValueNameFingerprintAlgorithm[] =
89c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org    "googFingerprintAlgorithm";
90c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.orgconst char StatsReport::kStatsValueNameFirsReceived[] = "googFirsReceived";
91c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.orgconst char StatsReport::kStatsValueNameFirsSent[] = "googFirsSent";
92c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.orgconst char StatsReport::kStatsValueNameFrameHeightInput[] =
93c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org    "googFrameHeightInput";
94c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.orgconst char StatsReport::kStatsValueNameFrameHeightReceived[] =
95c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org    "googFrameHeightReceived";
96c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.orgconst char StatsReport::kStatsValueNameFrameHeightSent[] =
97c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org    "googFrameHeightSent";
98c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.orgconst char StatsReport::kStatsValueNameFrameRateReceived[] =
99c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org    "googFrameRateReceived";
100c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.orgconst char StatsReport::kStatsValueNameFrameRateDecoded[] =
101c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org    "googFrameRateDecoded";
102c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.orgconst char StatsReport::kStatsValueNameFrameRateOutput[] =
103c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org    "googFrameRateOutput";
104c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.orgconst char StatsReport::kStatsValueNameDecodeMs[] = "googDecodeMs";
105c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.orgconst char StatsReport::kStatsValueNameMaxDecodeMs[] = "googMaxDecodeMs";
106c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.orgconst char StatsReport::kStatsValueNameCurrentDelayMs[] = "googCurrentDelayMs";
107c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.orgconst char StatsReport::kStatsValueNameTargetDelayMs[] = "googTargetDelayMs";
108c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.orgconst char StatsReport::kStatsValueNameJitterBufferMs[] = "googJitterBufferMs";
109c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.orgconst char StatsReport::kStatsValueNameMinPlayoutDelayMs[] =
110c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org    "googMinPlayoutDelayMs";
111c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.orgconst char StatsReport::kStatsValueNameRenderDelayMs[] = "googRenderDelayMs";
112c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org
113c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.orgconst char StatsReport::kStatsValueNameCaptureStartNtpTimeMs[] =
114c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org    "googCaptureStartNtpTimeMs";
115c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org
116c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.orgconst char StatsReport::kStatsValueNameFrameRateInput[] = "googFrameRateInput";
117c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.orgconst char StatsReport::kStatsValueNameFrameRateSent[] = "googFrameRateSent";
118c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.orgconst char StatsReport::kStatsValueNameFrameWidthInput[] =
119c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org    "googFrameWidthInput";
120c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.orgconst char StatsReport::kStatsValueNameFrameWidthReceived[] =
121c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org    "googFrameWidthReceived";
122c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.orgconst char StatsReport::kStatsValueNameFrameWidthSent[] = "googFrameWidthSent";
123c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.orgconst char StatsReport::kStatsValueNameInitiator[] = "googInitiator";
124c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.orgconst char StatsReport::kStatsValueNameIssuerId[] = "googIssuerId";
125c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.orgconst char StatsReport::kStatsValueNameJitterReceived[] = "googJitterReceived";
126c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.orgconst char StatsReport::kStatsValueNameLocalAddress[] = "googLocalAddress";
127c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.orgconst char StatsReport::kStatsValueNameLocalCandidateType[] =
128c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org    "googLocalCandidateType";
129c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.orgconst char StatsReport::kStatsValueNameLocalCertificateId[] =
130c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org    "googLocalCertificateId";
131c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.orgconst char StatsReport::kStatsValueNameAdaptationChanges[] =
132c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org    "googAdaptationChanges";
133c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.orgconst char StatsReport::kStatsValueNameNacksReceived[] = "googNacksReceived";
134c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.orgconst char StatsReport::kStatsValueNameNacksSent[] = "googNacksSent";
135c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.orgconst char StatsReport::kStatsValueNamePlisReceived[] = "googPlisReceived";
136c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.orgconst char StatsReport::kStatsValueNamePlisSent[] = "googPlisSent";
137c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.orgconst char StatsReport::kStatsValueNamePacketsReceived[] = "packetsReceived";
138c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.orgconst char StatsReport::kStatsValueNamePacketsSent[] = "packetsSent";
139c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.orgconst char StatsReport::kStatsValueNamePacketsLost[] = "packetsLost";
140c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.orgconst char StatsReport::kStatsValueNamePreferredJitterBufferMs[] =
141c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org    "googPreferredJitterBufferMs";
142c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.orgconst char StatsReport::kStatsValueNameReadable[] = "googReadable";
143c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.orgconst char StatsReport::kStatsValueNameRecvPacketGroupArrivalTimeDebug[] =
144c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org    "googReceivedPacketGroupArrivalTimeDebug";
145c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.orgconst char StatsReport::kStatsValueNameRecvPacketGroupPropagationDeltaDebug[] =
146c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org    "googReceivedPacketGroupPropagationDeltaDebug";
147c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.orgconst char
148c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.orgStatsReport::kStatsValueNameRecvPacketGroupPropagationDeltaSumDebug[] =
149c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org    "googReceivedPacketGroupPropagationDeltaSumDebug";
150c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.orgconst char StatsReport::kStatsValueNameRemoteAddress[] = "googRemoteAddress";
151c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.orgconst char StatsReport::kStatsValueNameRemoteCandidateType[] =
152c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org    "googRemoteCandidateType";
153c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.orgconst char StatsReport::kStatsValueNameRemoteCertificateId[] =
154c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org    "googRemoteCertificateId";
155c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.orgconst char StatsReport::kStatsValueNameRetransmitBitrate[] =
156c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org    "googRetransmitBitrate";
157c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.orgconst char StatsReport::kStatsValueNameRtt[] = "googRtt";
158c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.orgconst char StatsReport::kStatsValueNameSsrc[] = "ssrc";
159c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.orgconst char StatsReport::kStatsValueNameSendPacketsDiscarded[] =
160c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org    "packetsDiscardedOnSend";
161c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.orgconst char StatsReport::kStatsValueNameTargetEncBitrate[] =
162c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org    "googTargetEncBitrate";
163c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.orgconst char StatsReport::kStatsValueNameTransmitBitrate[] =
164c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org    "googTransmitBitrate";
165c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.orgconst char StatsReport::kStatsValueNameTransportId[] = "transportId";
166c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.orgconst char StatsReport::kStatsValueNameTransportType[] = "googTransportType";
167c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.orgconst char StatsReport::kStatsValueNameTrackId[] = "googTrackId";
168c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.orgconst char StatsReport::kStatsValueNameTypingNoiseState[] =
169c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org    "googTypingNoiseState";
170c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.orgconst char StatsReport::kStatsValueNameViewLimitedResolution[] =
171c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org    "googViewLimitedResolution";
172c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.orgconst char StatsReport::kStatsValueNameWritable[] = "googWritable";
173c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org
174c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.orgconst char StatsReport::kStatsReportTypeSession[] = "googLibjingleSession";
175c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.orgconst char StatsReport::kStatsReportTypeBwe[] = "VideoBwe";
176c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.orgconst char StatsReport::kStatsReportTypeRemoteSsrc[] = "remoteSsrc";
177c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.orgconst char StatsReport::kStatsReportTypeSsrc[] = "ssrc";
178c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.orgconst char StatsReport::kStatsReportTypeTrack[] = "googTrack";
179c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.orgconst char StatsReport::kStatsReportTypeIceCandidate[] = "iceCandidate";
180c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.orgconst char StatsReport::kStatsReportTypeTransport[] = "googTransport";
181c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.orgconst char StatsReport::kStatsReportTypeComponent[] = "googComponent";
182c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.orgconst char StatsReport::kStatsReportTypeCandidatePair[] = "googCandidatePair";
183c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.orgconst char StatsReport::kStatsReportTypeCertificate[] = "googCertificate";
184c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org
185c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.orgconst char StatsReport::kStatsReportVideoBweId[] = "bweforvideo";
186c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org
187c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.orgStatsReport::StatsReport(const StatsReport& src)
188c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org  : id(src.id),
189c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org    type(src.type),
190c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org    timestamp(src.timestamp),
191c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org    values(src.values) {
192c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org}
193c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org
194c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.orgStatsReport::StatsReport(const std::string& id)
195c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org    : id(id), timestamp(0) {
196c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org}
197c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org
198c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.orgStatsReport& StatsReport::operator=(const StatsReport& src) {
199c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org  ASSERT(id == src.id);
200c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org  type = src.type;
201c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org  timestamp = src.timestamp;
202c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org  values = src.values;
203c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org  return *this;
204c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org}
205c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org
206c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org// Operators provided for STL container/algorithm support.
207c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.orgbool StatsReport::operator<(const StatsReport& other) const {
208c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org  return id < other.id;
209c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org}
210c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org
211c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.orgbool StatsReport::operator==(const StatsReport& other) const {
212c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org  return id == other.id;
213c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org}
214c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org
215c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org// Special support for being able to use std::find on a container
216c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org// without requiring a new StatsReport instance.
217c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.orgbool StatsReport::operator==(const std::string& other_id) const {
218c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org  return id == other_id;
219c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org}
220c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org
221c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.orgStatsReport::Value::Value()
222c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org    : name(NULL) {
223c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org}
224c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org
225c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org// The copy ctor can't be declared as explicit due to problems with STL.
226c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.orgStatsReport::Value::Value(const Value& other)
227c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org    : name(other.name), value(other.value) {
228c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org}
229c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org
230c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.orgStatsReport::Value::Value(StatsValueName name)
231c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org    : name(name) {
232c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org}
233c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org
234c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.orgStatsReport::Value::Value(StatsValueName name, const std::string& value)
235c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org    : name(name), value(value) {
236c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org}
237c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org
238c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.orgStatsReport::Value& StatsReport::Value::operator=(const Value& other) {
239c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org  const_cast<StatsValueName&>(name) = other.name;
240c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org  value = other.value;
241c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org  return *this;
242c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org}
243c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org
244c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org// TODO(tommi): Change implementation to do a simple enum value-to-static-
245c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org// string conversion when client code has been updated to use this method
246c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org// instead of the |name| member variable.
247c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.orgconst char* StatsReport::Value::display_name() const {
248c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org  return name;
249c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org}
250c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org
251c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.orgvoid StatsReport::AddValue(StatsReport::StatsValueName name,
252c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org                           const std::string& value) {
253c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org  values.push_back(Value(name, value));
254c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org}
255c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org
256c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.orgvoid StatsReport::AddValue(StatsReport::StatsValueName name, int64 value) {
257c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org  AddValue(name, rtc::ToString<int64>(value));
258c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org}
259c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org
260c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.orgtemplate <typename T>
261c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.orgvoid StatsReport::AddValue(StatsReport::StatsValueName name,
262c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org                           const std::vector<T>& value) {
263c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org  std::ostringstream oss;
264c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org  oss << "[";
265c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org  for (size_t i = 0; i < value.size(); ++i) {
266c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org    oss << rtc::ToString<T>(value[i]);
267c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org    if (i != value.size() - 1)
268c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org      oss << ", ";
269c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org  }
270c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org  oss << "]";
271c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org  AddValue(name, oss.str());
272c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org}
273c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org
274c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org// Implementation specializations for the variants of AddValue that we use.
275c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org// TODO(tommi): Converting these ints to strings and copying strings, is not
276c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org// very efficient.  Figure out a way to reduce the string churn.
277c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.orgtemplate
278c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.orgvoid StatsReport::AddValue<std::string>(
279c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org    StatsReport::StatsValueName, const std::vector<std::string>&);
280c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org
281c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.orgtemplate
282c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.orgvoid StatsReport::AddValue<int>(
283c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org    StatsReport::StatsValueName, const std::vector<int>&);
284c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org
285c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.orgtemplate
286c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.orgvoid StatsReport::AddValue<int64_t>(
287c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org    StatsReport::StatsValueName, const std::vector<int64_t>&);
288c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org
289c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.orgvoid StatsReport::AddBoolean(StatsReport::StatsValueName name, bool value) {
290c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org  AddValue(name, value ? "true" : "false");
291c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org}
292c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org
293c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.orgvoid StatsReport::ReplaceValue(StatsReport::StatsValueName name,
294c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org                               const std::string& value) {
295c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org  for (Values::iterator it = values.begin(); it != values.end(); ++it) {
296c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org    if ((*it).name == name) {
297c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org      it->value = value;
298c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org      return;
299c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org    }
300c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org  }
301c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org  // It is not reachable here, add an ASSERT to make sure the overwriting is
302c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org  // always a success.
303c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org  ASSERT(false);
304c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org}
305c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org
306c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.orgStatsSet::StatsSet() {
307c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org}
308c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org
309c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.orgStatsSet::~StatsSet() {
310c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org}
311c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org
312c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.orgStatsSet::const_iterator StatsSet::begin() const {
313c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org  return list_.begin();
314c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org}
315c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org
316c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.orgStatsSet::const_iterator StatsSet::end() const {
317c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org  return list_.end();
318c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org}
319c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org
320c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.orgStatsReport* StatsSet::InsertNew(const std::string& id) {
321c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org  ASSERT(Find(id) == NULL);
322c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org  const StatsReport* ret = &(*list_.insert(StatsReportCopyable(id)).first);
323c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org  return const_cast<StatsReport*>(ret);
324c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org}
325c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org
326c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.orgStatsReport* StatsSet::FindOrAddNew(const std::string& id) {
327c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org  StatsReport* ret = Find(id);
328c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org  return ret ? ret : InsertNew(id);
329c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org}
330c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org
331c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.orgStatsReport* StatsSet::ReplaceOrAddNew(const std::string& id) {
332c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org  list_.erase(id);
333c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org  return InsertNew(id);
334c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org}
335c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org
336c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org// Looks for a report with the given |id|.  If one is not found, NULL
337c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org// will be returned.
338c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.orgStatsReport* StatsSet::Find(const std::string& id) {
339c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org  const_iterator it = std::find(begin(), end(), id);
340c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org  return it == end() ? NULL :
341c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org      const_cast<StatsReport*>(static_cast<const StatsReport*>(&(*it)));
342c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org}
3435c3ee4bce6c61bb4095eb3746ba39d3eeab2ee93tommi@webrtc.org
3445c3ee4bce6c61bb4095eb3746ba39d3eeab2ee93tommi@webrtc.org}  // namespace webrtc
345