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

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

Issue 2408363002: RTCTransportStats added. (Closed)
Patch Set: Created 4 years, 2 months 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') | webrtc/api/rtcstatscollector.cc » ('J')
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/stats/rtcstats_objects.h" 18 #include "webrtc/api/stats/rtcstats_objects.h"
18 #include "webrtc/api/stats/rtcstatsreport.h" 19 #include "webrtc/api/stats/rtcstatsreport.h"
19 #include "webrtc/base/asyncinvoker.h" 20 #include "webrtc/base/asyncinvoker.h"
20 #include "webrtc/base/refcount.h" 21 #include "webrtc/base/refcount.h"
21 #include "webrtc/base/scoped_ref_ptr.h" 22 #include "webrtc/base/scoped_ref_ptr.h"
22 #include "webrtc/base/timeutils.h" 23 #include "webrtc/base/timeutils.h"
23 24
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 // returning. Virtual for the sake of testing. 69 // returning. Virtual for the sake of testing.
69 virtual void ProducePartialResultsOnSignalingThread(int64_t timestamp_us); 70 virtual void ProducePartialResultsOnSignalingThread(int64_t timestamp_us);
70 virtual void ProducePartialResultsOnWorkerThread(int64_t timestamp_us); 71 virtual void ProducePartialResultsOnWorkerThread(int64_t timestamp_us);
71 virtual void ProducePartialResultsOnNetworkThread(int64_t timestamp_us); 72 virtual void ProducePartialResultsOnNetworkThread(int64_t timestamp_us);
72 73
73 // Can be called on any thread. 74 // Can be called on any thread.
74 void AddPartialResults( 75 void AddPartialResults(
75 const rtc::scoped_refptr<RTCStatsReport>& partial_report); 76 const rtc::scoped_refptr<RTCStatsReport>& partial_report);
76 77
77 private: 78 private:
79 struct CertificateStatsPair {
80 CertificateStatsPair() : local(nullptr), remote(nullptr) {}
81 RTCCertificateStats* local;
82 RTCCertificateStats* remote;
83 };
84
78 void AddPartialResults_s(rtc::scoped_refptr<RTCStatsReport> partial_report); 85 void AddPartialResults_s(rtc::scoped_refptr<RTCStatsReport> partial_report);
79 void DeliverCachedReport(); 86 void DeliverCachedReport();
80 87
81 // Produces |RTCCertificateStats|. 88 // Produces |RTCCertificateStats|.
82 void ProduceCertificateStats_s( 89 std::map<std::string, CertificateStatsPair> ProduceCertificateStats_s(
83 int64_t timestamp_us, const SessionStats& session_stats, 90 int64_t timestamp_us, const SessionStats& session_stats,
84 RTCStatsReport* report) const; 91 RTCStatsReport* report) const;
hta-webrtc 2016/10/12 22:52:35 This is now doing more than producing certificate
hbos 2016/10/17 19:33:13 Code changed to not do two things.
85 void ProduceCertificateStatsFromSSLCertificateAndChain_s( 92 RTCCertificateStats* ProduceCertificateStatsFromSSLCertificateAndChain_s(
86 int64_t timestamp_us, const rtc::SSLCertificate& certificate, 93 int64_t timestamp_us, const rtc::SSLCertificate& certificate,
87 RTCStatsReport* report) const; 94 RTCStatsReport* report) const;
88 // Produces |RTCIceCandidatePairStats| and |RTCIceCandidateStats|. 95 // Produces |RTCIceCandidatePairStats| and |RTCIceCandidateStats|.
89 void ProduceIceCandidateAndPairStats_s( 96 void ProduceIceCandidateAndPairStats_s(
90 int64_t timestamp_us, const SessionStats& session_stats, 97 int64_t timestamp_us, const SessionStats& session_stats,
91 RTCStatsReport* report) const; 98 RTCStatsReport* report) const;
92 const std::string& ProduceIceCandidateStats_s( 99 const std::string& ProduceIceCandidateStats_s(
93 int64_t timestamp_us, const cricket::Candidate& candidate, bool is_local, 100 int64_t timestamp_us, const cricket::Candidate& candidate, bool is_local,
94 RTCStatsReport* report) const; 101 RTCStatsReport* report) const;
95 // Produces |RTCPeerConnectionStats|. 102 // Produces |RTCPeerConnectionStats|.
96 void ProducePeerConnectionStats_s( 103 void ProducePeerConnectionStats_s(
97 int64_t timestamp_us, RTCStatsReport* report) const; 104 int64_t timestamp_us, RTCStatsReport* report) const;
105 // Produces |RTCTransportStats|.
106 void ProduceTransportStats_s(
107 int64_t timestamp_us, const SessionStats& session_stats,
108 const std::map<std::string, CertificateStatsPair>& transport_certificates,
109 RTCStatsReport* report) const;
98 110
99 PeerConnection* const pc_; 111 PeerConnection* const pc_;
100 rtc::Thread* const signaling_thread_; 112 rtc::Thread* const signaling_thread_;
101 rtc::Thread* const worker_thread_; 113 rtc::Thread* const worker_thread_;
102 rtc::Thread* const network_thread_; 114 rtc::Thread* const network_thread_;
103 rtc::AsyncInvoker invoker_; 115 rtc::AsyncInvoker invoker_;
104 116
105 int num_pending_partial_reports_; 117 int num_pending_partial_reports_;
106 int64_t partial_report_timestamp_us_; 118 int64_t partial_report_timestamp_us_;
107 rtc::scoped_refptr<RTCStatsReport> partial_report_; 119 rtc::scoped_refptr<RTCStatsReport> partial_report_;
108 std::vector<rtc::scoped_refptr<RTCStatsCollectorCallback>> callbacks_; 120 std::vector<rtc::scoped_refptr<RTCStatsCollectorCallback>> callbacks_;
109 121
110 // A timestamp, in microseconds, that is based on a timer that is 122 // A timestamp, in microseconds, that is based on a timer that is
111 // monotonically increasing. That is, even if the system clock is modified the 123 // monotonically increasing. That is, even if the system clock is modified the
112 // difference between the timer and this timestamp is how fresh the cached 124 // difference between the timer and this timestamp is how fresh the cached
113 // report is. 125 // report is.
114 int64_t cache_timestamp_us_; 126 int64_t cache_timestamp_us_;
115 int64_t cache_lifetime_us_; 127 int64_t cache_lifetime_us_;
116 rtc::scoped_refptr<const RTCStatsReport> cached_report_; 128 rtc::scoped_refptr<const RTCStatsReport> cached_report_;
117 }; 129 };
118 130
119 // Helper function, exposed for unittests. 131 // Helper function, exposed for unittests.
120 const char* CandidateTypeToRTCIceCandidateType(const std::string& type); 132 const char* CandidateTypeToRTCIceCandidateType(const std::string& type);
121 133
122 } // namespace webrtc 134 } // namespace webrtc
123 135
124 #endif // WEBRTC_API_RTCSTATSCOLLECTOR_H_ 136 #endif // WEBRTC_API_RTCSTATSCOLLECTOR_H_
OLDNEW
« no previous file with comments | « no previous file | webrtc/api/rtcstatscollector.cc » ('j') | webrtc/api/rtcstatscollector.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698