You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

47 lines
1.4 KiB

​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  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. #include "test/pc/e2e/stats_poller.h"
  11. #include <utility>
  12. #include "rtc_base/logging.h"
  13. namespace webrtc {
  14. namespace webrtc_pc_e2e {
  15. void InternalStatsObserver::PollStats() {
  16. peer_->pc()->GetStats(this, nullptr,
  17. webrtc::PeerConnectionInterface::StatsOutputLevel::
  18. kStatsOutputLevelStandard);
  19. }
  20. void InternalStatsObserver::OnComplete(const StatsReports& reports) {
  21. for (auto* observer : observers_) {
  22. observer->OnStatsReports(pc_label_, reports);
  23. }
  24. }
  25. StatsPoller::StatsPoller(std::vector<StatsObserverInterface*> observers,
  26. std::map<std::string, TestPeer*> peers) {
  27. for (auto& peer : peers) {
  28. pollers_.push_back(new rtc::RefCountedObject<InternalStatsObserver>(
  29. peer.first, peer.second, observers));
  30. }
  31. }
  32. void StatsPoller::PollStatsAndNotifyObservers() {
  33. for (auto& poller : pollers_) {
  34. poller->PollStats();
  35. }
  36. }
  37. } // namespace webrtc_pc_e2e
  38. } // namespace webrtc