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