rtc_stats_traversal.h 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. /*
  2. * Copyright 2018 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. #ifndef PC_RTC_STATS_TRAVERSAL_H_
  11. #define PC_RTC_STATS_TRAVERSAL_H_
  12. #include <string>
  13. #include <vector>
  14. #include "api/scoped_refptr.h"
  15. #include "api/stats/rtc_stats.h"
  16. #include "api/stats/rtc_stats_report.h"
  17. namespace webrtc {
  18. // Traverses the stats graph, taking all stats objects that are directly or
  19. // indirectly accessible from and including the stats objects identified by
  20. // |ids|, returning them as a new stats report.
  21. // This is meant to be used to implement the stats selection algorithm.
  22. // https://w3c.github.io/webrtc-pc/#dfn-stats-selection-algorithm
  23. rtc::scoped_refptr<RTCStatsReport> TakeReferencedStats(
  24. rtc::scoped_refptr<RTCStatsReport> report,
  25. const std::vector<std::string>& ids);
  26. // Gets pointers to the string values of any members in |stats| that are used as
  27. // references for looking up other stats objects in the same report by ID. The
  28. // pointers are valid for the lifetime of |stats| assumings its members are not
  29. // modified.
  30. //
  31. // For example, RTCCodecStats contains "transportId"
  32. // (RTCCodecStats::transport_id) referencing an RTCTransportStats.
  33. // https://w3c.github.io/webrtc-stats/#dom-rtccodecstats-transportid
  34. std::vector<const std::string*> GetStatsReferencedIds(const RTCStats& stats);
  35. } // namespace webrtc
  36. #endif // PC_RTC_STATS_TRAVERSAL_H_