| 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_API_RTCSTATSCOLLECTOR_H_ | 11 #ifndef WEBRTC_API_RTCSTATSCOLLECTOR_H_ |
| 12 #define WEBRTC_API_RTCSTATSCOLLECTOR_H_ | 12 #define WEBRTC_API_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/datachannel.h" | 19 #include "webrtc/api/datachannel.h" |
| 20 #include "webrtc/api/datachannelinterface.h" | 20 #include "webrtc/api/stats/rtcstatscollectorcallback.h" |
| 21 #include "webrtc/api/stats/rtcstats_objects.h" | 21 #include "webrtc/api/stats/rtcstats_objects.h" |
| 22 #include "webrtc/api/stats/rtcstatsreport.h" | 22 #include "webrtc/api/stats/rtcstatsreport.h" |
| 23 #include "webrtc/base/asyncinvoker.h" | 23 #include "webrtc/base/asyncinvoker.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 | 29 |
| 30 namespace cricket { | 30 namespace cricket { |
| 31 class Candidate; | 31 class Candidate; |
| 32 } // namespace cricket | 32 } // namespace cricket |
| 33 | 33 |
| 34 namespace rtc { | 34 namespace rtc { |
| 35 class SSLCertificate; | 35 class SSLCertificate; |
| 36 } // namespace rtc | 36 } // namespace rtc |
| 37 | 37 |
| 38 namespace webrtc { | 38 namespace webrtc { |
| 39 | 39 |
| 40 class PeerConnection; | 40 class PeerConnection; |
| 41 struct SessionStats; | 41 struct SessionStats; |
| 42 | 42 |
| 43 class RTCStatsCollectorCallback : public virtual rtc::RefCountInterface { | |
| 44 public: | |
| 45 virtual ~RTCStatsCollectorCallback() {} | |
| 46 | |
| 47 virtual void OnStatsDelivered( | |
| 48 const rtc::scoped_refptr<const RTCStatsReport>& report) = 0; | |
| 49 }; | |
| 50 | |
| 51 // All public methods of the collector are to be called on the signaling thread. | 43 // All public methods of the collector are to be called on the signaling thread. |
| 52 // Stats are gathered on the signaling, worker and network threads | 44 // Stats are gathered on the signaling, worker and network threads |
| 53 // asynchronously. The callback is invoked on the signaling thread. Resulting | 45 // asynchronously. The callback is invoked on the signaling thread. Resulting |
| 54 // reports are cached for |cache_lifetime_| ms. | 46 // reports are cached for |cache_lifetime_| ms. |
| 55 class RTCStatsCollector : public virtual rtc::RefCountInterface, | 47 class RTCStatsCollector : public virtual rtc::RefCountInterface, |
| 56 public sigslot::has_slots<> { | 48 public sigslot::has_slots<> { |
| 57 public: | 49 public: |
| 58 static rtc::scoped_refptr<RTCStatsCollector> Create( | 50 static rtc::scoped_refptr<RTCStatsCollector> Create( |
| 59 PeerConnection* pc, | 51 PeerConnection* pc, |
| 60 int64_t cache_lifetime_us = 50 * rtc::kNumMicrosecsPerMillisec); | 52 int64_t cache_lifetime_us = 50 * rtc::kNumMicrosecsPerMillisec); |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 }; | 160 }; |
| 169 | 161 |
| 170 const char* CandidateTypeToRTCIceCandidateTypeForTesting( | 162 const char* CandidateTypeToRTCIceCandidateTypeForTesting( |
| 171 const std::string& type); | 163 const std::string& type); |
| 172 const char* DataStateToRTCDataChannelStateForTesting( | 164 const char* DataStateToRTCDataChannelStateForTesting( |
| 173 DataChannelInterface::DataState state); | 165 DataChannelInterface::DataState state); |
| 174 | 166 |
| 175 } // namespace webrtc | 167 } // namespace webrtc |
| 176 | 168 |
| 177 #endif // WEBRTC_API_RTCSTATSCOLLECTOR_H_ | 169 #endif // WEBRTC_API_RTCSTATSCOLLECTOR_H_ |
| OLD | NEW |