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

Side by Side Diff: talk/app/webrtc/statscollector.cc

Issue 1397973002: Merging BaseSession code into WebRtcSession. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Cleaning up WebRtcSession states, and getting rid of "saved candidates" Created 5 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 * libjingle 2 * libjingle
3 * Copyright 2012 Google Inc. 3 * Copyright 2012 Google Inc.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met: 6 * modification, are permitted provided that the following conditions are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright notice, 8 * 1. Redistributions of source code must retain the above copyright notice,
9 * this list of conditions and the following disclaimer. 9 * this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright notice, 10 * 2. Redistributions in binary form must reproduce the above copyright notice,
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 struct TypeForAdd { 62 struct TypeForAdd {
63 const StatsReport::StatsValueName name; 63 const StatsReport::StatsValueName name;
64 const ValueType& value; 64 const ValueType& value;
65 }; 65 };
66 66
67 typedef TypeForAdd<bool> BoolForAdd; 67 typedef TypeForAdd<bool> BoolForAdd;
68 typedef TypeForAdd<float> FloatForAdd; 68 typedef TypeForAdd<float> FloatForAdd;
69 typedef TypeForAdd<int64_t> Int64ForAdd; 69 typedef TypeForAdd<int64_t> Int64ForAdd;
70 typedef TypeForAdd<int> IntForAdd; 70 typedef TypeForAdd<int> IntForAdd;
71 71
72 StatsReport::Id GetTransportIdFromProxy(const cricket::ProxyTransportMap& map, 72 StatsReport::Id GetTransportIdFromProxy(const ProxyTransportMap& map,
73 const std::string& proxy) { 73 const std::string& proxy) {
74 RTC_DCHECK(!proxy.empty()); 74 RTC_DCHECK(!proxy.empty());
75 cricket::ProxyTransportMap::const_iterator found = map.find(proxy); 75 auto found = map.find(proxy);
76 if (found == map.end()) 76 if (found == map.end()) {
77 return StatsReport::Id(); 77 return StatsReport::Id();
78 }
78 79
79 return StatsReport::NewComponentId( 80 return StatsReport::NewComponentId(
80 found->second, cricket::ICE_CANDIDATE_COMPONENT_RTP); 81 found->second, cricket::ICE_CANDIDATE_COMPONENT_RTP);
81 } 82 }
82 83
83 StatsReport* AddTrackReport(StatsCollection* reports, 84 StatsReport* AddTrackReport(StatsCollection* reports,
84 const std::string& track_id) { 85 const std::string& track_id) {
85 // Adds an empty track report. 86 // Adds an empty track report.
86 StatsReport::Id id( 87 StatsReport::Id id(
87 StatsReport::NewTypedId(StatsReport::kStatsReportTypeTrack, track_id)); 88 StatsReport::NewTypedId(StatsReport::kStatsReportTypeTrack, track_id));
(...skipping 581 matching lines...) Expand 10 before | Expand all | Expand 10 after
669 670
670 void StatsCollector::ExtractSessionInfo() { 671 void StatsCollector::ExtractSessionInfo() {
671 RTC_DCHECK(session_->signaling_thread()->IsCurrent()); 672 RTC_DCHECK(session_->signaling_thread()->IsCurrent());
672 673
673 // Extract information from the base session. 674 // Extract information from the base session.
674 StatsReport::Id id(StatsReport::NewTypedId( 675 StatsReport::Id id(StatsReport::NewTypedId(
675 StatsReport::kStatsReportTypeSession, session_->id())); 676 StatsReport::kStatsReportTypeSession, session_->id()));
676 StatsReport* report = reports_.ReplaceOrAddNew(id); 677 StatsReport* report = reports_.ReplaceOrAddNew(id);
677 report->set_timestamp(stats_gathering_started_); 678 report->set_timestamp(stats_gathering_started_);
678 report->AddBoolean(StatsReport::kStatsValueNameInitiator, 679 report->AddBoolean(StatsReport::kStatsValueNameInitiator,
679 session_->initiator()); 680 session_->initial_offerer());
680 681
681 cricket::SessionStats stats; 682 SessionStats stats;
682 if (!session_->GetTransportStats(&stats)) { 683 if (!session_->GetTransportStats(&stats)) {
683 return; 684 return;
684 } 685 }
685 686
686 // Store the proxy map away for use in SSRC reporting. 687 // Store the proxy map away for use in SSRC reporting.
687 // TODO(tommi): This shouldn't be necessary if we post the stats back to the 688 // TODO(tommi): This shouldn't be necessary if we post the stats back to the
688 // signaling thread after fetching them on the worker thread, then just use 689 // signaling thread after fetching them on the worker thread, then just use
689 // the proxy map directly from the session stats. 690 // the proxy map directly from the session stats.
690 // As is, if GetStats() failed, we could be using old (incorrect?) proxy 691 // As is, if GetStats() failed, we could be using old (incorrect?) proxy
691 // data. 692 // data.
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after
935 StatsReport* report = entry.second; 936 StatsReport* report = entry.second;
936 report->set_timestamp(stats_gathering_started_); 937 report->set_timestamp(stats_gathering_started_);
937 } 938 }
938 } 939 }
939 940
940 void StatsCollector::ClearUpdateStatsCacheForTest() { 941 void StatsCollector::ClearUpdateStatsCacheForTest() {
941 stats_gathering_started_ = 0; 942 stats_gathering_started_ = 0;
942 } 943 }
943 944
944 } // namespace webrtc 945 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698