Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(131)

Side by Side Diff: webrtc/api/rtcstatscollector.h

Issue 2408363002: RTCTransportStats added. (Closed)
Patch Set: nits and rebase with master Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | webrtc/api/rtcstatscollector.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <memory> 15 #include <memory>
15 #include <vector> 16 #include <vector>
16 17
17 #include "webrtc/api/datachannelinterface.h" 18 #include "webrtc/api/datachannelinterface.h"
18 #include "webrtc/api/stats/rtcstats_objects.h" 19 #include "webrtc/api/stats/rtcstats_objects.h"
19 #include "webrtc/api/stats/rtcstatsreport.h" 20 #include "webrtc/api/stats/rtcstatsreport.h"
20 #include "webrtc/base/asyncinvoker.h" 21 #include "webrtc/base/asyncinvoker.h"
21 #include "webrtc/base/refcount.h" 22 #include "webrtc/base/refcount.h"
22 #include "webrtc/base/scoped_ref_ptr.h" 23 #include "webrtc/base/scoped_ref_ptr.h"
24 #include "webrtc/base/sslidentity.h"
23 #include "webrtc/base/timeutils.h" 25 #include "webrtc/base/timeutils.h"
24 26
25 namespace cricket { 27 namespace cricket {
26 class Candidate; 28 class Candidate;
27 } // namespace cricket 29 } // namespace cricket
28 30
29 namespace rtc { 31 namespace rtc {
30 class SSLCertificate; 32 class SSLCertificate;
31 } // namespace rtc 33 } // namespace rtc
32 34
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 // returning. Virtual for the sake of testing. 71 // returning. Virtual for the sake of testing.
70 virtual void ProducePartialResultsOnSignalingThread(int64_t timestamp_us); 72 virtual void ProducePartialResultsOnSignalingThread(int64_t timestamp_us);
71 virtual void ProducePartialResultsOnWorkerThread(int64_t timestamp_us); 73 virtual void ProducePartialResultsOnWorkerThread(int64_t timestamp_us);
72 virtual void ProducePartialResultsOnNetworkThread(int64_t timestamp_us); 74 virtual void ProducePartialResultsOnNetworkThread(int64_t timestamp_us);
73 75
74 // Can be called on any thread. 76 // Can be called on any thread.
75 void AddPartialResults( 77 void AddPartialResults(
76 const rtc::scoped_refptr<RTCStatsReport>& partial_report); 78 const rtc::scoped_refptr<RTCStatsReport>& partial_report);
77 79
78 private: 80 private:
81 struct CertificateStatsPair {
82 std::unique_ptr<rtc::SSLCertificateStats> local;
83 std::unique_ptr<rtc::SSLCertificateStats> remote;
84 };
85
79 void AddPartialResults_s(rtc::scoped_refptr<RTCStatsReport> partial_report); 86 void AddPartialResults_s(rtc::scoped_refptr<RTCStatsReport> partial_report);
80 void DeliverCachedReport(); 87 void DeliverCachedReport();
81 88
82 // Produces |RTCCertificateStats|. 89 // Produces |RTCCertificateStats|.
83 void ProduceCertificateStats_s( 90 void ProduceCertificateStats_s(
84 int64_t timestamp_us, const SessionStats& session_stats, 91 int64_t timestamp_us,
92 const std::map<std::string, CertificateStatsPair>& transport_cert_stats,
85 RTCStatsReport* report) const; 93 RTCStatsReport* report) const;
86 void ProduceCertificateStatsFromSSLCertificateAndChain_s( 94 void ProduceCertificateStatsFromSSLCertificateStats_s(
87 int64_t timestamp_us, const rtc::SSLCertificate& certificate, 95 int64_t timestamp_us, const rtc::SSLCertificateStats& certificate_stats,
88 RTCStatsReport* report) const; 96 RTCStatsReport* report) const;
89 // Produces |RTCDataChannelStats|. 97 // Produces |RTCDataChannelStats|.
90 void ProduceDataChannelStats_s( 98 void ProduceDataChannelStats_s(
91 int64_t timestamp_us, RTCStatsReport* report) const; 99 int64_t timestamp_us, RTCStatsReport* report) const;
92 // Produces |RTCIceCandidatePairStats| and |RTCIceCandidateStats|. 100 // Produces |RTCIceCandidatePairStats| and |RTCIceCandidateStats|.
93 void ProduceIceCandidateAndPairStats_s( 101 void ProduceIceCandidateAndPairStats_s(
94 int64_t timestamp_us, const SessionStats& session_stats, 102 int64_t timestamp_us, const SessionStats& session_stats,
95 RTCStatsReport* report) const; 103 RTCStatsReport* report) const;
96 const std::string& ProduceIceCandidateStats_s( 104 const std::string& ProduceIceCandidateStats_s(
97 int64_t timestamp_us, const cricket::Candidate& candidate, bool is_local, 105 int64_t timestamp_us, const cricket::Candidate& candidate, bool is_local,
98 RTCStatsReport* report) const; 106 RTCStatsReport* report) const;
99 // Produces |RTCPeerConnectionStats|. 107 // Produces |RTCPeerConnectionStats|.
100 void ProducePeerConnectionStats_s( 108 void ProducePeerConnectionStats_s(
101 int64_t timestamp_us, RTCStatsReport* report) const; 109 int64_t timestamp_us, RTCStatsReport* report) const;
110 // Produces |RTCTransportStats|.
111 void ProduceTransportStats_s(
112 int64_t timestamp_us, const SessionStats& session_stats,
113 const std::map<std::string, CertificateStatsPair>& transport_cert_stats,
114 RTCStatsReport* report) const;
115
116 // Helper function to stats-producing functions.
117 std::map<std::string, CertificateStatsPair>
118 PrepareTransportCertificateStats_s(const SessionStats& session_stats) const;
102 119
103 PeerConnection* const pc_; 120 PeerConnection* const pc_;
104 rtc::Thread* const signaling_thread_; 121 rtc::Thread* const signaling_thread_;
105 rtc::Thread* const worker_thread_; 122 rtc::Thread* const worker_thread_;
106 rtc::Thread* const network_thread_; 123 rtc::Thread* const network_thread_;
107 rtc::AsyncInvoker invoker_; 124 rtc::AsyncInvoker invoker_;
108 125
109 int num_pending_partial_reports_; 126 int num_pending_partial_reports_;
110 int64_t partial_report_timestamp_us_; 127 int64_t partial_report_timestamp_us_;
111 rtc::scoped_refptr<RTCStatsReport> partial_report_; 128 rtc::scoped_refptr<RTCStatsReport> partial_report_;
112 std::vector<rtc::scoped_refptr<RTCStatsCollectorCallback>> callbacks_; 129 std::vector<rtc::scoped_refptr<RTCStatsCollectorCallback>> callbacks_;
113 130
114 // A timestamp, in microseconds, that is based on a timer that is 131 // A timestamp, in microseconds, that is based on a timer that is
115 // monotonically increasing. That is, even if the system clock is modified the 132 // monotonically increasing. That is, even if the system clock is modified the
116 // difference between the timer and this timestamp is how fresh the cached 133 // difference between the timer and this timestamp is how fresh the cached
117 // report is. 134 // report is.
118 int64_t cache_timestamp_us_; 135 int64_t cache_timestamp_us_;
119 int64_t cache_lifetime_us_; 136 int64_t cache_lifetime_us_;
120 rtc::scoped_refptr<const RTCStatsReport> cached_report_; 137 rtc::scoped_refptr<const RTCStatsReport> cached_report_;
121 }; 138 };
122 139
123 const char* CandidateTypeToRTCIceCandidateTypeForTesting( 140 const char* CandidateTypeToRTCIceCandidateTypeForTesting(
124 const std::string& type); 141 const std::string& type);
125 const char* DataStateToRTCDataChannelStateForTesting( 142 const char* DataStateToRTCDataChannelStateForTesting(
126 DataChannelInterface::DataState state); 143 DataChannelInterface::DataState state);
127 144
128 } // namespace webrtc 145 } // namespace webrtc
129 146
130 #endif // WEBRTC_API_RTCSTATSCOLLECTOR_H_ 147 #endif // WEBRTC_API_RTCSTATSCOLLECTOR_H_
OLDNEW
« no previous file with comments | « no previous file | webrtc/api/rtcstatscollector.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698