| OLD | NEW |
| 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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 struct TypeForAdd { | 63 struct TypeForAdd { |
| 64 const StatsReport::StatsValueName name; | 64 const StatsReport::StatsValueName name; |
| 65 const ValueType& value; | 65 const ValueType& value; |
| 66 }; | 66 }; |
| 67 | 67 |
| 68 typedef TypeForAdd<bool> BoolForAdd; | 68 typedef TypeForAdd<bool> BoolForAdd; |
| 69 typedef TypeForAdd<float> FloatForAdd; | 69 typedef TypeForAdd<float> FloatForAdd; |
| 70 typedef TypeForAdd<int64_t> Int64ForAdd; | 70 typedef TypeForAdd<int64_t> Int64ForAdd; |
| 71 typedef TypeForAdd<int> IntForAdd; | 71 typedef TypeForAdd<int> IntForAdd; |
| 72 | 72 |
| 73 StatsReport::Id GetTransportIdFromProxy(const cricket::ProxyTransportMap& map, | 73 StatsReport::Id GetTransportIdFromProxy(const ProxyTransportMap& map, |
| 74 const std::string& proxy) { | 74 const std::string& proxy) { |
| 75 RTC_DCHECK(!proxy.empty()); | 75 RTC_DCHECK(!proxy.empty()); |
| 76 cricket::ProxyTransportMap::const_iterator found = map.find(proxy); | 76 auto found = map.find(proxy); |
| 77 if (found == map.end()) | 77 if (found == map.end()) { |
| 78 return StatsReport::Id(); | 78 return StatsReport::Id(); |
| 79 } |
| 79 | 80 |
| 80 return StatsReport::NewComponentId( | 81 return StatsReport::NewComponentId( |
| 81 found->second, cricket::ICE_CANDIDATE_COMPONENT_RTP); | 82 found->second, cricket::ICE_CANDIDATE_COMPONENT_RTP); |
| 82 } | 83 } |
| 83 | 84 |
| 84 StatsReport* AddTrackReport(StatsCollection* reports, | 85 StatsReport* AddTrackReport(StatsCollection* reports, |
| 85 const std::string& track_id) { | 86 const std::string& track_id) { |
| 86 // Adds an empty track report. | 87 // Adds an empty track report. |
| 87 StatsReport::Id id( | 88 StatsReport::Id id( |
| 88 StatsReport::NewTypedId(StatsReport::kStatsReportTypeTrack, track_id)); | 89 StatsReport::NewTypedId(StatsReport::kStatsReportTypeTrack, track_id)); |
| (...skipping 581 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 670 | 671 |
| 671 void StatsCollector::ExtractSessionInfo() { | 672 void StatsCollector::ExtractSessionInfo() { |
| 672 RTC_DCHECK(pc_->session()->signaling_thread()->IsCurrent()); | 673 RTC_DCHECK(pc_->session()->signaling_thread()->IsCurrent()); |
| 673 | 674 |
| 674 // Extract information from the base session. | 675 // Extract information from the base session. |
| 675 StatsReport::Id id(StatsReport::NewTypedId( | 676 StatsReport::Id id(StatsReport::NewTypedId( |
| 676 StatsReport::kStatsReportTypeSession, pc_->session()->id())); | 677 StatsReport::kStatsReportTypeSession, pc_->session()->id())); |
| 677 StatsReport* report = reports_.ReplaceOrAddNew(id); | 678 StatsReport* report = reports_.ReplaceOrAddNew(id); |
| 678 report->set_timestamp(stats_gathering_started_); | 679 report->set_timestamp(stats_gathering_started_); |
| 679 report->AddBoolean(StatsReport::kStatsValueNameInitiator, | 680 report->AddBoolean(StatsReport::kStatsValueNameInitiator, |
| 680 pc_->session()->initiator()); | 681 pc_->session()->initial_offerer()); |
| 681 | 682 |
| 682 cricket::SessionStats stats; | 683 SessionStats stats; |
| 683 if (!pc_->session()->GetTransportStats(&stats)) { | 684 if (!pc_->session()->GetTransportStats(&stats)) { |
| 684 return; | 685 return; |
| 685 } | 686 } |
| 686 | 687 |
| 687 // Store the proxy map away for use in SSRC reporting. | 688 // Store the proxy map away for use in SSRC reporting. |
| 688 // TODO(tommi): This shouldn't be necessary if we post the stats back to the | 689 // TODO(tommi): This shouldn't be necessary if we post the stats back to the |
| 689 // signaling thread after fetching them on the worker thread, then just use | 690 // signaling thread after fetching them on the worker thread, then just use |
| 690 // the proxy map directly from the session stats. | 691 // the proxy map directly from the session stats. |
| 691 // As is, if GetStats() failed, we could be using old (incorrect?) proxy | 692 // As is, if GetStats() failed, we could be using old (incorrect?) proxy |
| 692 // data. | 693 // data. |
| (...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 |
| OLD | NEW |