1 /* 2 * Copyright (c) 2019 The WebRTC project authors. All Rights Reserved. 3 * 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 6 * tree. An additional intellectual property rights grant can be found 7 * in the file PATENTS. All contributing project authors may 8 * be found in the AUTHORS file in the root of the source tree. 9 */ 10 11 #include "test/pc/e2e/stats_poller.h" 12 13 #include <utility> 14 15 #include "rtc_base/logging.h" 16 17 namespace webrtc { 18 namespace webrtc_pc_e2e { 19 PollStats()20void InternalStatsObserver::PollStats() { 21 peer_->pc()->GetStats(this); 22 } 23 OnStatsDelivered(const rtc::scoped_refptr<const RTCStatsReport> & report)24void InternalStatsObserver::OnStatsDelivered( 25 const rtc::scoped_refptr<const RTCStatsReport>& report) { 26 for (auto* observer : observers_) { 27 observer->OnStatsReports(pc_label_, report); 28 } 29 } 30 StatsPoller(std::vector<StatsObserverInterface * > observers,std::map<std::string,TestPeer * > peers)31StatsPoller::StatsPoller(std::vector<StatsObserverInterface*> observers, 32 std::map<std::string, TestPeer*> peers) { 33 for (auto& peer : peers) { 34 pollers_.push_back(new rtc::RefCountedObject<InternalStatsObserver>( 35 peer.first, peer.second, observers)); 36 } 37 } 38 PollStatsAndNotifyObservers()39void StatsPoller::PollStatsAndNotifyObservers() { 40 for (auto& poller : pollers_) { 41 poller->PollStats(); 42 } 43 } 44 45 } // namespace webrtc_pc_e2e 46 } // namespace webrtc 47