| 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" |
| 29 #include "webrtc/media/base/mediachannel.h" | 30 #include "webrtc/media/base/mediachannel.h" |
| 30 #include "webrtc/pc/datachannel.h" | 31 #include "webrtc/pc/datachannel.h" |
| 31 #include "webrtc/pc/trackmediainfomap.h" | 32 #include "webrtc/pc/trackmediainfomap.h" |
| 32 | 33 |
| 33 namespace cricket { | 34 namespace cricket { |
| 34 class Candidate; | 35 class Candidate; |
| 35 } // namespace cricket | 36 } // namespace cricket |
| 36 | 37 |
| 37 namespace rtc { | 38 namespace rtc { |
| 38 class SSLCertificate; | 39 class SSLCertificate; |
| (...skipping 29 matching lines...) Expand all Loading... |
| 68 // completed. Must be called on the signaling thread. | 69 // completed. Must be called on the signaling thread. |
| 69 void WaitForPendingRequest(); | 70 void WaitForPendingRequest(); |
| 70 | 71 |
| 71 protected: | 72 protected: |
| 72 RTCStatsCollector(PeerConnection* pc, int64_t cache_lifetime_us); | 73 RTCStatsCollector(PeerConnection* pc, int64_t cache_lifetime_us); |
| 73 ~RTCStatsCollector(); | 74 ~RTCStatsCollector(); |
| 74 | 75 |
| 75 // Stats gathering on a particular thread. Calls |AddPartialResults| before | 76 // Stats gathering on a particular thread. Calls |AddPartialResults| before |
| 76 // returning. Virtual for the sake of testing. | 77 // returning. Virtual for the sake of testing. |
| 77 virtual void ProducePartialResultsOnSignalingThread(int64_t timestamp_us); | 78 virtual void ProducePartialResultsOnSignalingThread(int64_t timestamp_us); |
| 78 virtual void ProducePartialResultsOnNetworkThread(int64_t timestamp_us); | 79 virtual void ProducePartialResultsOnNetworkThread( |
| 80 int64_t timestamp_us, |
| 81 const Call::Stats& call_stats); |
| 79 | 82 |
| 80 // Can be called on any thread. | 83 // Can be called on any thread. |
| 81 void AddPartialResults( | 84 void AddPartialResults( |
| 82 const rtc::scoped_refptr<RTCStatsReport>& partial_report); | 85 const rtc::scoped_refptr<RTCStatsReport>& partial_report); |
| 83 | 86 |
| 84 private: | 87 private: |
| 85 struct CertificateStatsPair { | 88 struct CertificateStatsPair { |
| 86 std::unique_ptr<rtc::SSLCertificateStats> local; | 89 std::unique_ptr<rtc::SSLCertificateStats> local; |
| 87 std::unique_ptr<rtc::SSLCertificateStats> remote; | 90 std::unique_ptr<rtc::SSLCertificateStats> remote; |
| 88 }; | 91 }; |
| 89 | 92 |
| 90 void AddPartialResults_s(rtc::scoped_refptr<RTCStatsReport> partial_report); | 93 void AddPartialResults_s(rtc::scoped_refptr<RTCStatsReport> partial_report); |
| 91 void DeliverCachedReport(); | 94 void DeliverCachedReport(); |
| 92 | 95 |
| 93 // Produces |RTCCertificateStats|. | 96 // Produces |RTCCertificateStats|. |
| 94 void ProduceCertificateStats_n( | 97 void ProduceCertificateStats_n( |
| 95 int64_t timestamp_us, | 98 int64_t timestamp_us, |
| 96 const std::map<std::string, CertificateStatsPair>& transport_cert_stats, | 99 const std::map<std::string, CertificateStatsPair>& transport_cert_stats, |
| 97 RTCStatsReport* report) const; | 100 RTCStatsReport* report) const; |
| 98 // Produces |RTCCodecStats|. | 101 // Produces |RTCCodecStats|. |
| 99 void ProduceCodecStats_n( | 102 void ProduceCodecStats_n( |
| 100 int64_t timestamp_us, const TrackMediaInfoMap& track_media_info_map, | 103 int64_t timestamp_us, const TrackMediaInfoMap& track_media_info_map, |
| 101 RTCStatsReport* report) const; | 104 RTCStatsReport* report) const; |
| 102 // Produces |RTCDataChannelStats|. | 105 // Produces |RTCDataChannelStats|. |
| 103 void ProduceDataChannelStats_s( | 106 void ProduceDataChannelStats_s( |
| 104 int64_t timestamp_us, RTCStatsReport* report) const; | 107 int64_t timestamp_us, RTCStatsReport* report) const; |
| 105 // Produces |RTCIceCandidatePairStats| and |RTCIceCandidateStats|. | 108 // Produces |RTCIceCandidatePairStats| and |RTCIceCandidateStats|. |
| 106 void ProduceIceCandidateAndPairStats_n( | 109 void ProduceIceCandidateAndPairStats_n( |
| 107 int64_t timestamp_us, const SessionStats& session_stats, | 110 int64_t timestamp_us, |
| 111 const SessionStats& session_stats, |
| 108 const cricket::VideoMediaInfo* video_media_info, | 112 const cricket::VideoMediaInfo* video_media_info, |
| 113 const Call::Stats& call_stats, |
| 109 RTCStatsReport* report) const; | 114 RTCStatsReport* report) const; |
| 110 // Produces |RTCMediaStreamStats| and |RTCMediaStreamTrackStats|. | 115 // Produces |RTCMediaStreamStats| and |RTCMediaStreamTrackStats|. |
| 111 void ProduceMediaStreamAndTrackStats_s( | 116 void ProduceMediaStreamAndTrackStats_s( |
| 112 int64_t timestamp_us, RTCStatsReport* report) const; | 117 int64_t timestamp_us, RTCStatsReport* report) const; |
| 113 // Produces |RTCPeerConnectionStats|. | 118 // Produces |RTCPeerConnectionStats|. |
| 114 void ProducePeerConnectionStats_s( | 119 void ProducePeerConnectionStats_s( |
| 115 int64_t timestamp_us, RTCStatsReport* report) const; | 120 int64_t timestamp_us, RTCStatsReport* report) const; |
| 116 // Produces |RTCInboundRTPStreamStats| and |RTCOutboundRTPStreamStats|. | 121 // Produces |RTCInboundRTPStreamStats| and |RTCOutboundRTPStreamStats|. |
| 117 void ProduceRTPStreamStats_n( | 122 void ProduceRTPStreamStats_n( |
| 118 int64_t timestamp_us, const SessionStats& session_stats, | 123 int64_t timestamp_us, const SessionStats& session_stats, |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 }; | 189 }; |
| 185 | 190 |
| 186 const char* CandidateTypeToRTCIceCandidateTypeForTesting( | 191 const char* CandidateTypeToRTCIceCandidateTypeForTesting( |
| 187 const std::string& type); | 192 const std::string& type); |
| 188 const char* DataStateToRTCDataChannelStateForTesting( | 193 const char* DataStateToRTCDataChannelStateForTesting( |
| 189 DataChannelInterface::DataState state); | 194 DataChannelInterface::DataState state); |
| 190 | 195 |
| 191 } // namespace webrtc | 196 } // namespace webrtc |
| 192 | 197 |
| 193 #endif // WEBRTC_PC_RTCSTATSCOLLECTOR_H_ | 198 #endif // WEBRTC_PC_RTCSTATSCOLLECTOR_H_ |
| OLD | NEW |