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

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

Issue 2408363002: RTCTransportStats added. (Closed)
Patch Set: Addressed comments, RTP and RTCP 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
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"
23 #include "webrtc/base/sslidentity.h"
22 #include "webrtc/base/timeutils.h" 24 #include "webrtc/base/timeutils.h"
23 25
24 namespace cricket { 26 namespace cricket {
25 class Candidate; 27 class Candidate;
26 } // namespace cricket 28 } // namespace cricket
27 29
28 namespace rtc { 30 namespace rtc {
29 class SSLCertificate; 31 class SSLCertificate;
30 } // namespace rtc 32 } // namespace rtc
31 33
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 // returning. Virtual for the sake of testing. 70 // returning. Virtual for the sake of testing.
69 virtual void ProducePartialResultsOnSignalingThread(int64_t timestamp_us); 71 virtual void ProducePartialResultsOnSignalingThread(int64_t timestamp_us);
70 virtual void ProducePartialResultsOnWorkerThread(int64_t timestamp_us); 72 virtual void ProducePartialResultsOnWorkerThread(int64_t timestamp_us);
71 virtual void ProducePartialResultsOnNetworkThread(int64_t timestamp_us); 73 virtual void ProducePartialResultsOnNetworkThread(int64_t timestamp_us);
72 74
73 // Can be called on any thread. 75 // Can be called on any thread.
74 void AddPartialResults( 76 void AddPartialResults(
75 const rtc::scoped_refptr<RTCStatsReport>& partial_report); 77 const rtc::scoped_refptr<RTCStatsReport>& partial_report);
76 78
77 private: 79 private:
80 struct CertificateStatsPair {
81 std::unique_ptr<rtc::SSLCertificateStats> local;
82 std::unique_ptr<rtc::SSLCertificateStats> 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 void ProduceCertificateStats_s(
83 int64_t timestamp_us, const SessionStats& session_stats, 90 int64_t timestamp_us,
91 const std::map<std::string, CertificateStatsPair>& transport_cert_stats,
84 RTCStatsReport* report) const; 92 RTCStatsReport* report) const;
85 void ProduceCertificateStatsFromSSLCertificateAndChain_s( 93 void ProduceCertificateStatsFromSSLCertificateStats_s(
86 int64_t timestamp_us, const rtc::SSLCertificate& certificate, 94 int64_t timestamp_us, const rtc::SSLCertificateStats& certificate_stats,
87 RTCStatsReport* report) const; 95 RTCStatsReport* report) const;
88 // Produces |RTCIceCandidatePairStats| and |RTCIceCandidateStats|. 96 // Produces |RTCIceCandidatePairStats| and |RTCIceCandidateStats|.
89 void ProduceIceCandidateAndPairStats_s( 97 void ProduceIceCandidateAndPairStats_s(
90 int64_t timestamp_us, const SessionStats& session_stats, 98 int64_t timestamp_us, const SessionStats& session_stats,
91 RTCStatsReport* report) const; 99 RTCStatsReport* report) const;
92 const std::string& ProduceIceCandidateStats_s( 100 const std::string& ProduceIceCandidateStats_s(
93 int64_t timestamp_us, const cricket::Candidate& candidate, bool is_local, 101 int64_t timestamp_us, const cricket::Candidate& candidate, bool is_local,
94 RTCStatsReport* report) const; 102 RTCStatsReport* report) const;
95 // Produces |RTCPeerConnectionStats|. 103 // Produces |RTCPeerConnectionStats|.
96 void ProducePeerConnectionStats_s( 104 void ProducePeerConnectionStats_s(
97 int64_t timestamp_us, RTCStatsReport* report) const; 105 int64_t timestamp_us, RTCStatsReport* report) const;
106 // Produces |RTCTransportStats|.
107 void ProduceTransportStats_s(
108 int64_t timestamp_us, const SessionStats& session_stats,
109 const std::map<std::string, CertificateStatsPair>& transport_cert_stats,
110 RTCStatsReport* report) const;
111
112 // Helper functions to stats producing functions.
hta-webrtc 2016/10/21 08:37:51 Nit: Hyphenate stats-producing. Hyper-nit: Only on
hbos_chromium 2016/10/21 16:56:06 Done.
113 std::map<std::string, CertificateStatsPair>
114 PrepareTransportCertificateStats_s(const SessionStats& session_stats) const;
98 115
99 PeerConnection* const pc_; 116 PeerConnection* const pc_;
100 rtc::Thread* const signaling_thread_; 117 rtc::Thread* const signaling_thread_;
101 rtc::Thread* const worker_thread_; 118 rtc::Thread* const worker_thread_;
102 rtc::Thread* const network_thread_; 119 rtc::Thread* const network_thread_;
103 rtc::AsyncInvoker invoker_; 120 rtc::AsyncInvoker invoker_;
104 121
105 int num_pending_partial_reports_; 122 int num_pending_partial_reports_;
106 int64_t partial_report_timestamp_us_; 123 int64_t partial_report_timestamp_us_;
107 rtc::scoped_refptr<RTCStatsReport> partial_report_; 124 rtc::scoped_refptr<RTCStatsReport> partial_report_;
108 std::vector<rtc::scoped_refptr<RTCStatsCollectorCallback>> callbacks_; 125 std::vector<rtc::scoped_refptr<RTCStatsCollectorCallback>> callbacks_;
109 126
110 // A timestamp, in microseconds, that is based on a timer that is 127 // 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 128 // 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 129 // difference between the timer and this timestamp is how fresh the cached
113 // report is. 130 // report is.
114 int64_t cache_timestamp_us_; 131 int64_t cache_timestamp_us_;
115 int64_t cache_lifetime_us_; 132 int64_t cache_lifetime_us_;
116 rtc::scoped_refptr<const RTCStatsReport> cached_report_; 133 rtc::scoped_refptr<const RTCStatsReport> cached_report_;
117 }; 134 };
118 135
119 // Helper function, exposed for unittests. 136 // Helper function, exposed for unittests.
120 const char* CandidateTypeToRTCIceCandidateType(const std::string& type); 137 const char* CandidateTypeToRTCIceCandidateType(const std::string& type);
121 138
122 } // namespace webrtc 139 } // namespace webrtc
123 140
124 #endif // WEBRTC_API_RTCSTATSCOLLECTOR_H_ 141 #endif // WEBRTC_API_RTCSTATSCOLLECTOR_H_
OLDNEW
« no previous file with comments | « no previous file | webrtc/api/rtcstatscollector.cc » ('j') | webrtc/api/rtcstatscollector_unittest.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698