Henrik Boström | b619936 | 2018-03-12 10:27:55 +0100 | [diff] [blame] | 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 | |
Steve Anton | 10542f2 | 2019-01-11 09:11:00 -0800 | [diff] [blame] | 11 | #ifndef PC_RTC_STATS_TRAVERSAL_H_ |
| 12 | #define PC_RTC_STATS_TRAVERSAL_H_ |
Henrik Boström | b619936 | 2018-03-12 10:27:55 +0100 | [diff] [blame] | 13 | |
| 14 | #include <string> |
| 15 | #include <vector> |
| 16 | |
Steve Anton | 10542f2 | 2019-01-11 09:11:00 -0800 | [diff] [blame] | 17 | #include "api/stats/rtc_stats.h" |
| 18 | #include "api/stats/rtc_stats_report.h" |
Henrik Boström | b619936 | 2018-03-12 10:27:55 +0100 | [diff] [blame] | 19 | #include "rtc_base/scoped_ref_ptr.h" |
| 20 | |
| 21 | namespace webrtc { |
| 22 | |
| 23 | // Traverses the stats graph, taking all stats objects that are directly or |
| 24 | // indirectly accessible from and including the stats objects identified by |
| 25 | // |ids|, returning them as a new stats report. |
| 26 | // This is meant to be used to implement the stats selection algorithm. |
| 27 | // https://w3c.github.io/webrtc-pc/#dfn-stats-selection-algorithm |
| 28 | rtc::scoped_refptr<RTCStatsReport> TakeReferencedStats( |
| 29 | rtc::scoped_refptr<RTCStatsReport> report, |
| 30 | const std::vector<std::string>& ids); |
| 31 | |
| 32 | // Gets pointers to the string values of any members in |stats| that are used as |
| 33 | // references for looking up other stats objects in the same report by ID. The |
| 34 | // pointers are valid for the lifetime of |stats| assumings its members are not |
| 35 | // modified. |
| 36 | // |
| 37 | // For example, RTCCodecStats contains "transportId" |
| 38 | // (RTCCodecStats::transport_id) referencing an RTCTransportStats. |
| 39 | // https://w3c.github.io/webrtc-stats/#dom-rtccodecstats-transportid |
| 40 | std::vector<const std::string*> GetStatsReferencedIds(const RTCStats& stats); |
| 41 | |
| 42 | } // namespace webrtc |
| 43 | |
Steve Anton | 10542f2 | 2019-01-11 09:11:00 -0800 | [diff] [blame] | 44 | #endif // PC_RTC_STATS_TRAVERSAL_H_ |