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/datachannelinterface.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/optional.h" |
24 #include "webrtc/base/refcount.h" | 25 #include "webrtc/base/refcount.h" |
25 #include "webrtc/base/scoped_ref_ptr.h" | 26 #include "webrtc/base/scoped_ref_ptr.h" |
26 #include "webrtc/base/sigslot.h" | 27 #include "webrtc/base/sigslot.h" |
27 #include "webrtc/base/sslidentity.h" | 28 #include "webrtc/base/sslidentity.h" |
28 #include "webrtc/base/timeutils.h" | 29 #include "webrtc/base/timeutils.h" |
| 30 #include "webrtc/media/base/mediachannel.h" |
29 | 31 |
30 namespace cricket { | 32 namespace cricket { |
31 class Candidate; | 33 class Candidate; |
32 } // namespace cricket | 34 } // namespace cricket |
33 | 35 |
34 namespace rtc { | 36 namespace rtc { |
35 class SSLCertificate; | 37 class SSLCertificate; |
36 } // namespace rtc | 38 } // namespace rtc |
37 | 39 |
38 namespace webrtc { | 40 namespace webrtc { |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 | 81 |
80 // Can be called on any thread. | 82 // Can be called on any thread. |
81 void AddPartialResults( | 83 void AddPartialResults( |
82 const rtc::scoped_refptr<RTCStatsReport>& partial_report); | 84 const rtc::scoped_refptr<RTCStatsReport>& partial_report); |
83 | 85 |
84 private: | 86 private: |
85 struct CertificateStatsPair { | 87 struct CertificateStatsPair { |
86 std::unique_ptr<rtc::SSLCertificateStats> local; | 88 std::unique_ptr<rtc::SSLCertificateStats> local; |
87 std::unique_ptr<rtc::SSLCertificateStats> remote; | 89 std::unique_ptr<rtc::SSLCertificateStats> remote; |
88 }; | 90 }; |
| 91 struct MediaInfo { |
| 92 rtc::Optional<cricket::VoiceMediaInfo> voice; |
| 93 rtc::Optional<cricket::VideoMediaInfo> video; |
| 94 }; |
89 | 95 |
90 void AddPartialResults_s(rtc::scoped_refptr<RTCStatsReport> partial_report); | 96 void AddPartialResults_s(rtc::scoped_refptr<RTCStatsReport> partial_report); |
91 void DeliverCachedReport(); | 97 void DeliverCachedReport(); |
92 | 98 |
93 // Produces |RTCCertificateStats|. | 99 // Produces |RTCCertificateStats|. |
94 void ProduceCertificateStats_s( | 100 void ProduceCertificateStats_s( |
95 int64_t timestamp_us, | 101 int64_t timestamp_us, |
96 const std::map<std::string, CertificateStatsPair>& transport_cert_stats, | 102 const std::map<std::string, CertificateStatsPair>& transport_cert_stats, |
97 RTCStatsReport* report) const; | 103 RTCStatsReport* report) const; |
| 104 // Produces |RTCCodecStats|. |
| 105 void ProduceCodecStats_s( |
| 106 int64_t timestamp_us, const MediaInfo& media_info, |
| 107 RTCStatsReport* report) const; |
98 // Produces |RTCDataChannelStats|. | 108 // Produces |RTCDataChannelStats|. |
99 void ProduceDataChannelStats_s( | 109 void ProduceDataChannelStats_s( |
100 int64_t timestamp_us, RTCStatsReport* report) const; | 110 int64_t timestamp_us, RTCStatsReport* report) const; |
101 // Produces |RTCIceCandidatePairStats| and |RTCIceCandidateStats|. | 111 // Produces |RTCIceCandidatePairStats| and |RTCIceCandidateStats|. |
102 void ProduceIceCandidateAndPairStats_s( | 112 void ProduceIceCandidateAndPairStats_s( |
103 int64_t timestamp_us, const SessionStats& session_stats, | 113 int64_t timestamp_us, const SessionStats& session_stats, |
104 RTCStatsReport* report) const; | 114 RTCStatsReport* report) const; |
105 // Produces |RTCMediaStreamStats| and |RTCMediaStreamTrackStats|. | 115 // Produces |RTCMediaStreamStats| and |RTCMediaStreamTrackStats|. |
106 void ProduceMediaStreamAndTrackStats_s( | 116 void ProduceMediaStreamAndTrackStats_s( |
107 int64_t timestamp_us, RTCStatsReport* report) const; | 117 int64_t timestamp_us, RTCStatsReport* report) const; |
108 // Produces |RTCPeerConnectionStats|. | 118 // Produces |RTCPeerConnectionStats|. |
109 void ProducePeerConnectionStats_s( | 119 void ProducePeerConnectionStats_s( |
110 int64_t timestamp_us, RTCStatsReport* report) const; | 120 int64_t timestamp_us, RTCStatsReport* report) const; |
111 // Produces |RTCInboundRTPStreamStats| and |RTCOutboundRTPStreamStats|. | 121 // Produces |RTCInboundRTPStreamStats| and |RTCOutboundRTPStreamStats|. |
112 void ProduceRTPStreamStats_s( | 122 void ProduceRTPStreamStats_s( |
113 int64_t timestamp_us, const SessionStats& session_stats, | 123 int64_t timestamp_us, const SessionStats& session_stats, |
114 RTCStatsReport* report) const; | 124 const MediaInfo& media_info, RTCStatsReport* report) const; |
115 // Produces |RTCTransportStats|. | 125 // Produces |RTCTransportStats|. |
116 void ProduceTransportStats_s( | 126 void ProduceTransportStats_s( |
117 int64_t timestamp_us, const SessionStats& session_stats, | 127 int64_t timestamp_us, const SessionStats& session_stats, |
118 const std::map<std::string, CertificateStatsPair>& transport_cert_stats, | 128 const std::map<std::string, CertificateStatsPair>& transport_cert_stats, |
119 RTCStatsReport* report) const; | 129 RTCStatsReport* report) const; |
120 | 130 |
121 // Helper function to stats-producing functions. | 131 // Helper function to stats-producing functions. |
122 std::map<std::string, CertificateStatsPair> | 132 std::map<std::string, CertificateStatsPair> |
123 PrepareTransportCertificateStats_s(const SessionStats& session_stats) const; | 133 PrepareTransportCertificateStats(const SessionStats& session_stats) const; |
| 134 MediaInfo PrepareMediaInfo(const SessionStats& session_stats) const; |
124 | 135 |
125 // Slots for signals (sigslot) that are wired up to |pc_|. | 136 // Slots for signals (sigslot) that are wired up to |pc_|. |
126 void OnDataChannelCreated(DataChannel* channel); | 137 void OnDataChannelCreated(DataChannel* channel); |
127 // Slots for signals (sigslot) that are wired up to |channel|. | 138 // Slots for signals (sigslot) that are wired up to |channel|. |
128 void OnDataChannelOpened(DataChannel* channel); | 139 void OnDataChannelOpened(DataChannel* channel); |
129 void OnDataChannelClosed(DataChannel* channel); | 140 void OnDataChannelClosed(DataChannel* channel); |
130 | 141 |
131 PeerConnection* const pc_; | 142 PeerConnection* const pc_; |
132 rtc::Thread* const signaling_thread_; | 143 rtc::Thread* const signaling_thread_; |
133 rtc::Thread* const worker_thread_; | 144 rtc::Thread* const worker_thread_; |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 }; | 179 }; |
169 | 180 |
170 const char* CandidateTypeToRTCIceCandidateTypeForTesting( | 181 const char* CandidateTypeToRTCIceCandidateTypeForTesting( |
171 const std::string& type); | 182 const std::string& type); |
172 const char* DataStateToRTCDataChannelStateForTesting( | 183 const char* DataStateToRTCDataChannelStateForTesting( |
173 DataChannelInterface::DataState state); | 184 DataChannelInterface::DataState state); |
174 | 185 |
175 } // namespace webrtc | 186 } // namespace webrtc |
176 | 187 |
177 #endif // WEBRTC_API_RTCSTATSCOLLECTOR_H_ | 188 #endif // WEBRTC_API_RTCSTATSCOLLECTOR_H_ |
OLD | NEW |