OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2016 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2016 The WebRTC Project Authors. All rights reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
11 #ifndef WEBRTC_PC_RTCSTATSCOLLECTOR_H_ | 11 #ifndef WEBRTC_PC_RTCSTATSCOLLECTOR_H_ |
12 #define WEBRTC_PC_RTCSTATSCOLLECTOR_H_ | 12 #define WEBRTC_PC_RTCSTATSCOLLECTOR_H_ |
13 | 13 |
14 #include <map> | 14 #include <map> |
15 #include <memory> | 15 #include <memory> |
16 #include <set> | 16 #include <set> |
17 #include <vector> | 17 #include <vector> |
18 | 18 |
19 #include "webrtc/api/stats/rtcstats_objects.h" | 19 #include "webrtc/api/stats/rtcstats_objects.h" |
20 #include "webrtc/api/stats/rtcstatscollectorcallback.h" | 20 #include "webrtc/api/stats/rtcstatscollectorcallback.h" |
21 #include "webrtc/api/stats/rtcstatsreport.h" | 21 #include "webrtc/api/stats/rtcstatsreport.h" |
22 #include "webrtc/base/asyncinvoker.h" | 22 #include "webrtc/base/asyncinvoker.h" |
23 #include "webrtc/base/optional.h" | 23 #include "webrtc/base/optional.h" |
24 #include "webrtc/base/refcount.h" | 24 #include "webrtc/base/refcount.h" |
25 #include "webrtc/base/scoped_ref_ptr.h" | 25 #include "webrtc/base/scoped_ref_ptr.h" |
26 #include "webrtc/base/sigslot.h" | 26 #include "webrtc/base/sigslot.h" |
27 #include "webrtc/base/sslidentity.h" | 27 #include "webrtc/base/sslidentity.h" |
28 #include "webrtc/base/timeutils.h" | 28 #include "webrtc/base/timeutils.h" |
29 #include "webrtc/call/call.h" | |
30 #include "webrtc/media/base/mediachannel.h" | 29 #include "webrtc/media/base/mediachannel.h" |
31 #include "webrtc/pc/datachannel.h" | 30 #include "webrtc/pc/datachannel.h" |
32 #include "webrtc/pc/trackmediainfomap.h" | 31 #include "webrtc/pc/trackmediainfomap.h" |
33 | 32 |
34 namespace cricket { | 33 namespace cricket { |
35 class Candidate; | 34 class Candidate; |
36 } // namespace cricket | 35 } // namespace cricket |
37 | 36 |
38 namespace rtc { | 37 namespace rtc { |
39 class SSLCertificate; | 38 class SSLCertificate; |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 RTCStatsReport* report) const; | 97 RTCStatsReport* report) const; |
99 // Produces |RTCCodecStats|. | 98 // Produces |RTCCodecStats|. |
100 void ProduceCodecStats_n( | 99 void ProduceCodecStats_n( |
101 int64_t timestamp_us, const TrackMediaInfoMap& track_media_info_map, | 100 int64_t timestamp_us, const TrackMediaInfoMap& track_media_info_map, |
102 RTCStatsReport* report) const; | 101 RTCStatsReport* report) const; |
103 // Produces |RTCDataChannelStats|. | 102 // Produces |RTCDataChannelStats|. |
104 void ProduceDataChannelStats_s( | 103 void ProduceDataChannelStats_s( |
105 int64_t timestamp_us, RTCStatsReport* report) const; | 104 int64_t timestamp_us, RTCStatsReport* report) const; |
106 // Produces |RTCIceCandidatePairStats| and |RTCIceCandidateStats|. | 105 // Produces |RTCIceCandidatePairStats| and |RTCIceCandidateStats|. |
107 void ProduceIceCandidateAndPairStats_n( | 106 void ProduceIceCandidateAndPairStats_n( |
108 int64_t timestamp_us, | 107 int64_t timestamp_us, const SessionStats& session_stats, |
109 const SessionStats& session_stats, | |
110 const cricket::VideoMediaInfo* video_media_info, | 108 const cricket::VideoMediaInfo* video_media_info, |
111 const Call::Stats& call_stats, | |
112 RTCStatsReport* report) const; | 109 RTCStatsReport* report) const; |
113 // Produces |RTCMediaStreamStats| and |RTCMediaStreamTrackStats|. | 110 // Produces |RTCMediaStreamStats| and |RTCMediaStreamTrackStats|. |
114 void ProduceMediaStreamAndTrackStats_s( | 111 void ProduceMediaStreamAndTrackStats_s( |
115 int64_t timestamp_us, RTCStatsReport* report) const; | 112 int64_t timestamp_us, RTCStatsReport* report) const; |
116 // Produces |RTCPeerConnectionStats|. | 113 // Produces |RTCPeerConnectionStats|. |
117 void ProducePeerConnectionStats_s( | 114 void ProducePeerConnectionStats_s( |
118 int64_t timestamp_us, RTCStatsReport* report) const; | 115 int64_t timestamp_us, RTCStatsReport* report) const; |
119 // Produces |RTCInboundRTPStreamStats| and |RTCOutboundRTPStreamStats|. | 116 // Produces |RTCInboundRTPStreamStats| and |RTCOutboundRTPStreamStats|. |
120 void ProduceRTPStreamStats_n( | 117 void ProduceRTPStreamStats_n( |
121 int64_t timestamp_us, const SessionStats& session_stats, | 118 int64_t timestamp_us, const SessionStats& session_stats, |
(...skipping 28 matching lines...) Expand all Loading... |
150 rtc::scoped_refptr<RTCStatsReport> partial_report_; | 147 rtc::scoped_refptr<RTCStatsReport> partial_report_; |
151 std::vector<rtc::scoped_refptr<RTCStatsCollectorCallback>> callbacks_; | 148 std::vector<rtc::scoped_refptr<RTCStatsCollectorCallback>> callbacks_; |
152 | 149 |
153 // Set in |GetStatsReport|, read in |ProducePartialResultsOnNetworkThread| and | 150 // Set in |GetStatsReport|, read in |ProducePartialResultsOnNetworkThread| and |
154 // |ProducePartialResultsOnSignalingThread|, reset after work is complete. Not | 151 // |ProducePartialResultsOnSignalingThread|, reset after work is complete. Not |
155 // passed as arguments to avoid copies. This is thread safe - when we | 152 // passed as arguments to avoid copies. This is thread safe - when we |
156 // set/reset we know there are no pending stats requests in progress. | 153 // set/reset we know there are no pending stats requests in progress. |
157 std::unique_ptr<ChannelNamePairs> channel_name_pairs_; | 154 std::unique_ptr<ChannelNamePairs> channel_name_pairs_; |
158 std::unique_ptr<TrackMediaInfoMap> track_media_info_map_; | 155 std::unique_ptr<TrackMediaInfoMap> track_media_info_map_; |
159 std::map<MediaStreamTrackInterface*, std::string> track_to_id_; | 156 std::map<MediaStreamTrackInterface*, std::string> track_to_id_; |
160 Call::Stats call_stats_; | |
161 | 157 |
162 // A timestamp, in microseconds, that is based on a timer that is | 158 // A timestamp, in microseconds, that is based on a timer that is |
163 // monotonically increasing. That is, even if the system clock is modified the | 159 // monotonically increasing. That is, even if the system clock is modified the |
164 // difference between the timer and this timestamp is how fresh the cached | 160 // difference between the timer and this timestamp is how fresh the cached |
165 // report is. | 161 // report is. |
166 int64_t cache_timestamp_us_; | 162 int64_t cache_timestamp_us_; |
167 int64_t cache_lifetime_us_; | 163 int64_t cache_lifetime_us_; |
168 rtc::scoped_refptr<const RTCStatsReport> cached_report_; | 164 rtc::scoped_refptr<const RTCStatsReport> cached_report_; |
169 | 165 |
170 // Data recorded and maintained by the stats collector during its lifetime. | 166 // Data recorded and maintained by the stats collector during its lifetime. |
(...skipping 17 matching lines...) Expand all Loading... |
188 }; | 184 }; |
189 | 185 |
190 const char* CandidateTypeToRTCIceCandidateTypeForTesting( | 186 const char* CandidateTypeToRTCIceCandidateTypeForTesting( |
191 const std::string& type); | 187 const std::string& type); |
192 const char* DataStateToRTCDataChannelStateForTesting( | 188 const char* DataStateToRTCDataChannelStateForTesting( |
193 DataChannelInterface::DataState state); | 189 DataChannelInterface::DataState state); |
194 | 190 |
195 } // namespace webrtc | 191 } // namespace webrtc |
196 | 192 |
197 #endif // WEBRTC_PC_RTCSTATSCOLLECTOR_H_ | 193 #endif // WEBRTC_PC_RTCSTATSCOLLECTOR_H_ |
OLD | NEW |