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

Side by Side Diff: webrtc/pc/rtcstatscollector.cc

Issue 2975793002: Trace stats in RTCStatsCollector. (Closed)
Patch Set: Address Henrik's comments. Created 3 years, 5 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 | no next file » | 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 #include "webrtc/pc/rtcstatscollector.h" 11 #include "webrtc/pc/rtcstatscollector.h"
12 12
13 #include <memory> 13 #include <memory>
14 #include <sstream> 14 #include <sstream>
15 #include <utility> 15 #include <utility>
16 #include <vector> 16 #include <vector>
17 17
18 #include "webrtc/api/mediastreaminterface.h" 18 #include "webrtc/api/mediastreaminterface.h"
19 #include "webrtc/api/peerconnectioninterface.h" 19 #include "webrtc/api/peerconnectioninterface.h"
20 #include "webrtc/media/base/mediachannel.h" 20 #include "webrtc/media/base/mediachannel.h"
21 #include "webrtc/p2p/base/candidate.h" 21 #include "webrtc/p2p/base/candidate.h"
22 #include "webrtc/p2p/base/p2pconstants.h" 22 #include "webrtc/p2p/base/p2pconstants.h"
23 #include "webrtc/p2p/base/port.h" 23 #include "webrtc/p2p/base/port.h"
24 #include "webrtc/pc/peerconnection.h" 24 #include "webrtc/pc/peerconnection.h"
25 #include "webrtc/pc/webrtcsession.h" 25 #include "webrtc/pc/webrtcsession.h"
26 #include "webrtc/rtc_base/checks.h" 26 #include "webrtc/rtc_base/checks.h"
27 #include "webrtc/rtc_base/timeutils.h" 27 #include "webrtc/rtc_base/timeutils.h"
28 #include "webrtc/rtc_base/trace_event.h"
28 29
29 namespace webrtc { 30 namespace webrtc {
30 31
31 namespace { 32 namespace {
32 33
33 std::string RTCCertificateIDFromFingerprint(const std::string& fingerprint) { 34 std::string RTCCertificateIDFromFingerprint(const std::string& fingerprint) {
34 return "RTCCertificate_" + fingerprint; 35 return "RTCCertificate_" + fingerprint;
35 } 36 }
36 37
37 std::string RTCCodecStatsIDFromDirectionMediaAndPayload( 38 std::string RTCCodecStatsIDFromDirectionMediaAndPayload(
(...skipping 706 matching lines...) Expand 10 before | Expand all | Expand 10 after
744 else 745 else
745 partial_report_->TakeMembersFrom(partial_report); 746 partial_report_->TakeMembersFrom(partial_report);
746 --num_pending_partial_reports_; 747 --num_pending_partial_reports_;
747 if (!num_pending_partial_reports_) { 748 if (!num_pending_partial_reports_) {
748 cache_timestamp_us_ = partial_report_timestamp_us_; 749 cache_timestamp_us_ = partial_report_timestamp_us_;
749 cached_report_ = partial_report_; 750 cached_report_ = partial_report_;
750 partial_report_ = nullptr; 751 partial_report_ = nullptr;
751 channel_name_pairs_.reset(); 752 channel_name_pairs_.reset();
752 track_media_info_map_.reset(); 753 track_media_info_map_.reset();
753 track_to_id_.clear(); 754 track_to_id_.clear();
755 for (const RTCStats& stats : *cached_report_) {
756 for (const RTCStatsMemberInterface* member : stats.Members()) {
757 if (member->is_defined()) {
758 TRACE_EVENT_INSTANT2("webrtc_stats", member->name(),
759 "value", member->ValueToString(),
760 stats.type(), stats.id());
hbos 2017/07/12 11:26:51 I think stats name might be wrong to have as trace
ehmaldonado_webrtc 2017/07/12 12:45:51 Right. Done.
761 }
762 }
763 }
754 DeliverCachedReport(); 764 DeliverCachedReport();
755 } 765 }
756 } 766 }
757 767
758 void RTCStatsCollector::DeliverCachedReport() { 768 void RTCStatsCollector::DeliverCachedReport() {
759 RTC_DCHECK(signaling_thread_->IsCurrent()); 769 RTC_DCHECK(signaling_thread_->IsCurrent());
760 RTC_DCHECK(!callbacks_.empty()); 770 RTC_DCHECK(!callbacks_.empty());
761 RTC_DCHECK(cached_report_); 771 RTC_DCHECK(cached_report_);
762 for (const rtc::scoped_refptr<RTCStatsCollectorCallback>& callback : 772 for (const rtc::scoped_refptr<RTCStatsCollectorCallback>& callback :
763 callbacks_) { 773 callbacks_) {
(...skipping 484 matching lines...) Expand 10 before | Expand all | Expand 10 after
1248 const std::string& type) { 1258 const std::string& type) {
1249 return CandidateTypeToRTCIceCandidateType(type); 1259 return CandidateTypeToRTCIceCandidateType(type);
1250 } 1260 }
1251 1261
1252 const char* DataStateToRTCDataChannelStateForTesting( 1262 const char* DataStateToRTCDataChannelStateForTesting(
1253 DataChannelInterface::DataState state) { 1263 DataChannelInterface::DataState state) {
1254 return DataStateToRTCDataChannelState(state); 1264 return DataStateToRTCDataChannelState(state);
1255 } 1265 }
1256 1266
1257 } // namespace webrtc 1267 } // namespace webrtc
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698