2016-08-30 14:04:35 -07:00
|
|
|
/*
|
|
|
|
|
* Copyright 2016 The WebRTC Project Authors. All rights reserved.
|
|
|
|
|
*
|
|
|
|
|
* Use of this source code is governed by a BSD-style license
|
|
|
|
|
* that can be found in the LICENSE file in the root of the source
|
|
|
|
|
* tree. An additional intellectual property rights grant can be found
|
|
|
|
|
* in the file PATENTS. All contributing project authors may
|
|
|
|
|
* be found in the AUTHORS file in the root of the source tree.
|
|
|
|
|
*/
|
|
|
|
|
|
2017-09-15 06:47:31 +02:00
|
|
|
#ifndef API_STATS_RTCSTATS_OBJECTS_H_
|
|
|
|
|
#define API_STATS_RTCSTATS_OBJECTS_H_
|
2016-08-30 14:04:35 -07:00
|
|
|
|
2018-11-28 16:47:49 +01:00
|
|
|
#include <stdint.h>
|
2019-07-05 19:08:33 +02:00
|
|
|
|
2021-05-28 21:32:04 +09:00
|
|
|
#include <map>
|
2018-03-20 13:24:20 +01:00
|
|
|
#include <memory>
|
2016-08-30 14:04:35 -07:00
|
|
|
#include <string>
|
2017-02-01 01:55:59 -08:00
|
|
|
#include <vector>
|
2016-08-30 14:04:35 -07:00
|
|
|
|
2019-01-11 09:11:00 -08:00
|
|
|
#include "api/stats/rtc_stats.h"
|
2018-10-16 14:13:50 +02:00
|
|
|
#include "rtc_base/system/rtc_export.h"
|
2016-08-30 14:04:35 -07:00
|
|
|
|
|
|
|
|
namespace webrtc {
|
|
|
|
|
|
2016-10-18 12:48:31 -07:00
|
|
|
// https://w3c.github.io/webrtc-pc/#idl-def-rtcdatachannelstate
|
|
|
|
|
struct RTCDataChannelState {
|
2017-08-08 10:48:15 -07:00
|
|
|
static const char* const kConnecting;
|
|
|
|
|
static const char* const kOpen;
|
|
|
|
|
static const char* const kClosing;
|
|
|
|
|
static const char* const kClosed;
|
2016-10-18 12:48:31 -07:00
|
|
|
};
|
|
|
|
|
|
2016-10-11 14:54:49 -07:00
|
|
|
// https://w3c.github.io/webrtc-stats/#dom-rtcstatsicecandidatepairstate
|
|
|
|
|
struct RTCStatsIceCandidatePairState {
|
2017-08-08 10:48:15 -07:00
|
|
|
static const char* const kFrozen;
|
|
|
|
|
static const char* const kWaiting;
|
|
|
|
|
static const char* const kInProgress;
|
|
|
|
|
static const char* const kFailed;
|
|
|
|
|
static const char* const kSucceeded;
|
2016-10-11 14:54:49 -07:00
|
|
|
};
|
|
|
|
|
|
2016-10-18 12:48:31 -07:00
|
|
|
// https://w3c.github.io/webrtc-pc/#rtcicecandidatetype-enum
|
2016-10-07 02:18:47 -07:00
|
|
|
struct RTCIceCandidateType {
|
2017-08-08 10:48:15 -07:00
|
|
|
static const char* const kHost;
|
|
|
|
|
static const char* const kSrflx;
|
|
|
|
|
static const char* const kPrflx;
|
|
|
|
|
static const char* const kRelay;
|
2016-10-07 02:18:47 -07:00
|
|
|
};
|
|
|
|
|
|
2017-01-16 07:38:02 -08:00
|
|
|
// https://w3c.github.io/webrtc-pc/#idl-def-rtcdtlstransportstate
|
|
|
|
|
struct RTCDtlsTransportState {
|
2017-08-08 10:48:15 -07:00
|
|
|
static const char* const kNew;
|
|
|
|
|
static const char* const kConnecting;
|
|
|
|
|
static const char* const kConnected;
|
|
|
|
|
static const char* const kClosed;
|
|
|
|
|
static const char* const kFailed;
|
2017-01-16 07:38:02 -08:00
|
|
|
};
|
|
|
|
|
|
2021-08-10 01:22:31 +02:00
|
|
|
// `RTCMediaStreamTrackStats::kind` is not an enum in the spec but the only
|
2017-01-17 02:53:23 -08:00
|
|
|
// valid values are "audio" and "video".
|
|
|
|
|
// https://w3c.github.io/webrtc-stats/#dom-rtcmediastreamtrackstats-kind
|
|
|
|
|
struct RTCMediaStreamTrackKind {
|
2017-08-08 10:48:15 -07:00
|
|
|
static const char* const kAudio;
|
|
|
|
|
static const char* const kVideo;
|
2017-01-17 02:53:23 -08:00
|
|
|
};
|
|
|
|
|
|
2017-11-21 10:49:36 -08:00
|
|
|
// https://w3c.github.io/webrtc-stats/#dom-rtcnetworktype
|
|
|
|
|
struct RTCNetworkType {
|
|
|
|
|
static const char* const kBluetooth;
|
|
|
|
|
static const char* const kCellular;
|
|
|
|
|
static const char* const kEthernet;
|
|
|
|
|
static const char* const kWifi;
|
|
|
|
|
static const char* const kWimax;
|
|
|
|
|
static const char* const kVpn;
|
|
|
|
|
static const char* const kUnknown;
|
|
|
|
|
};
|
|
|
|
|
|
2019-05-28 17:42:38 +02:00
|
|
|
// https://w3c.github.io/webrtc-stats/#dom-rtcqualitylimitationreason
|
|
|
|
|
struct RTCQualityLimitationReason {
|
|
|
|
|
static const char* const kNone;
|
|
|
|
|
static const char* const kCpu;
|
|
|
|
|
static const char* const kBandwidth;
|
|
|
|
|
static const char* const kOther;
|
|
|
|
|
};
|
|
|
|
|
|
2019-04-09 13:59:31 +02:00
|
|
|
// https://webrtc.org/experiments/rtp-hdrext/video-content-type/
|
|
|
|
|
struct RTCContentType {
|
|
|
|
|
static const char* const kUnspecified;
|
|
|
|
|
static const char* const kScreenshare;
|
|
|
|
|
};
|
|
|
|
|
|
2022-04-22 15:46:24 +02:00
|
|
|
// https://w3c.github.io/webrtc-stats/#dom-rtcdtlsrole
|
|
|
|
|
struct RTCDtlsRole {
|
|
|
|
|
static const char* const kUnknown;
|
|
|
|
|
static const char* const kClient;
|
|
|
|
|
static const char* const kServer;
|
|
|
|
|
};
|
|
|
|
|
|
2022-05-04 18:58:26 +02:00
|
|
|
// https://www.w3.org/TR/webrtc/#rtcicerole
|
|
|
|
|
struct RTCIceRole {
|
|
|
|
|
static const char* const kUnknown;
|
|
|
|
|
static const char* const kControlled;
|
|
|
|
|
static const char* const kControlling;
|
|
|
|
|
};
|
|
|
|
|
|
2022-05-09 17:43:31 +02:00
|
|
|
// https://www.w3.org/TR/webrtc/#dom-rtcicetransportstate
|
|
|
|
|
struct RTCIceTransportState {
|
|
|
|
|
static const char* const kNew;
|
|
|
|
|
static const char* const kChecking;
|
|
|
|
|
static const char* const kConnected;
|
|
|
|
|
static const char* const kCompleted;
|
|
|
|
|
static const char* const kDisconnected;
|
|
|
|
|
static const char* const kFailed;
|
|
|
|
|
static const char* const kClosed;
|
|
|
|
|
};
|
|
|
|
|
|
2016-10-24 04:00:05 -07:00
|
|
|
// https://w3c.github.io/webrtc-stats/#certificatestats-dict*
|
2018-10-16 14:13:50 +02:00
|
|
|
class RTC_EXPORT RTCCertificateStats final : public RTCStats {
|
2016-10-24 04:00:05 -07:00
|
|
|
public:
|
|
|
|
|
WEBRTC_RTCSTATS_DECL();
|
|
|
|
|
|
|
|
|
|
RTCCertificateStats(const std::string& id, int64_t timestamp_us);
|
|
|
|
|
RTCCertificateStats(std::string&& id, int64_t timestamp_us);
|
|
|
|
|
RTCCertificateStats(const RTCCertificateStats& other);
|
|
|
|
|
~RTCCertificateStats() override;
|
|
|
|
|
|
|
|
|
|
RTCStatsMember<std::string> fingerprint;
|
|
|
|
|
RTCStatsMember<std::string> fingerprint_algorithm;
|
|
|
|
|
RTCStatsMember<std::string> base64_certificate;
|
|
|
|
|
RTCStatsMember<std::string> issuer_certificate_id;
|
|
|
|
|
};
|
|
|
|
|
|
2022-03-02 11:17:36 +01:00
|
|
|
// Non standard extension mapping to rtc::AdapterType
|
|
|
|
|
struct RTCNetworkAdapterType {
|
|
|
|
|
static constexpr char kUnknown[] = "unknown";
|
|
|
|
|
static constexpr char kEthernet[] = "ethernet";
|
|
|
|
|
static constexpr char kWifi[] = "wifi";
|
|
|
|
|
static constexpr char kCellular[] = "cellular";
|
|
|
|
|
static constexpr char kLoopback[] = "loopback";
|
|
|
|
|
static constexpr char kAny[] = "any";
|
|
|
|
|
static constexpr char kCellular2g[] = "cellular2g";
|
|
|
|
|
static constexpr char kCellular3g[] = "cellular3g";
|
|
|
|
|
static constexpr char kCellular4g[] = "cellular4g";
|
|
|
|
|
static constexpr char kCellular5g[] = "cellular5g";
|
|
|
|
|
};
|
|
|
|
|
|
2016-11-23 02:32:06 -08:00
|
|
|
// https://w3c.github.io/webrtc-stats/#codec-dict*
|
2018-10-16 14:13:50 +02:00
|
|
|
class RTC_EXPORT RTCCodecStats final : public RTCStats {
|
2016-11-23 02:32:06 -08:00
|
|
|
public:
|
|
|
|
|
WEBRTC_RTCSTATS_DECL();
|
|
|
|
|
|
|
|
|
|
RTCCodecStats(const std::string& id, int64_t timestamp_us);
|
|
|
|
|
RTCCodecStats(std::string&& id, int64_t timestamp_us);
|
|
|
|
|
RTCCodecStats(const RTCCodecStats& other);
|
|
|
|
|
~RTCCodecStats() override;
|
|
|
|
|
|
2020-11-16 20:08:27 +01:00
|
|
|
RTCStatsMember<std::string> transport_id;
|
2016-11-23 02:32:06 -08:00
|
|
|
RTCStatsMember<uint32_t> payload_type;
|
2017-02-28 06:56:04 -08:00
|
|
|
RTCStatsMember<std::string> mime_type;
|
2016-11-23 02:32:06 -08:00
|
|
|
RTCStatsMember<uint32_t> clock_rate;
|
|
|
|
|
RTCStatsMember<uint32_t> channels;
|
2017-02-28 06:56:04 -08:00
|
|
|
RTCStatsMember<std::string> sdp_fmtp_line;
|
2016-11-23 02:32:06 -08:00
|
|
|
};
|
|
|
|
|
|
2016-10-24 04:00:05 -07:00
|
|
|
// https://w3c.github.io/webrtc-stats/#dcstats-dict*
|
2018-10-16 14:13:50 +02:00
|
|
|
class RTC_EXPORT RTCDataChannelStats final : public RTCStats {
|
2016-10-24 04:00:05 -07:00
|
|
|
public:
|
|
|
|
|
WEBRTC_RTCSTATS_DECL();
|
|
|
|
|
|
|
|
|
|
RTCDataChannelStats(const std::string& id, int64_t timestamp_us);
|
|
|
|
|
RTCDataChannelStats(std::string&& id, int64_t timestamp_us);
|
|
|
|
|
RTCDataChannelStats(const RTCDataChannelStats& other);
|
|
|
|
|
~RTCDataChannelStats() override;
|
|
|
|
|
|
|
|
|
|
RTCStatsMember<std::string> label;
|
|
|
|
|
RTCStatsMember<std::string> protocol;
|
2020-06-05 15:38:51 +02:00
|
|
|
RTCStatsMember<int32_t> data_channel_identifier;
|
2022-06-13 10:23:28 +02:00
|
|
|
// Enum type RTCDataChannelState.
|
2016-10-24 04:00:05 -07:00
|
|
|
RTCStatsMember<std::string> state;
|
|
|
|
|
RTCStatsMember<uint32_t> messages_sent;
|
|
|
|
|
RTCStatsMember<uint64_t> bytes_sent;
|
|
|
|
|
RTCStatsMember<uint32_t> messages_received;
|
|
|
|
|
RTCStatsMember<uint64_t> bytes_received;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// https://w3c.github.io/webrtc-stats/#candidatepair-dict*
|
2018-10-16 14:13:50 +02:00
|
|
|
class RTC_EXPORT RTCIceCandidatePairStats final : public RTCStats {
|
2016-10-11 14:54:49 -07:00
|
|
|
public:
|
|
|
|
|
WEBRTC_RTCSTATS_DECL();
|
|
|
|
|
|
|
|
|
|
RTCIceCandidatePairStats(const std::string& id, int64_t timestamp_us);
|
|
|
|
|
RTCIceCandidatePairStats(std::string&& id, int64_t timestamp_us);
|
|
|
|
|
RTCIceCandidatePairStats(const RTCIceCandidatePairStats& other);
|
|
|
|
|
~RTCIceCandidatePairStats() override;
|
|
|
|
|
|
|
|
|
|
RTCStatsMember<std::string> transport_id;
|
|
|
|
|
RTCStatsMember<std::string> local_candidate_id;
|
|
|
|
|
RTCStatsMember<std::string> remote_candidate_id;
|
2022-06-13 10:23:28 +02:00
|
|
|
// Enum type RTCStatsIceCandidatePairState.
|
2016-10-11 14:54:49 -07:00
|
|
|
RTCStatsMember<std::string> state;
|
2021-03-19 08:24:41 -07:00
|
|
|
// Obsolete: priority
|
2016-10-11 14:54:49 -07:00
|
|
|
RTCStatsMember<uint64_t> priority;
|
|
|
|
|
RTCStatsMember<bool> nominated;
|
2022-06-13 10:23:28 +02:00
|
|
|
// `writable` does not exist in the spec and old comments suggest it used to
|
|
|
|
|
// exist but was incorrectly implemented.
|
|
|
|
|
// TODO(https://crbug.com/webrtc/14171): Standardize and/or modify
|
|
|
|
|
// implementation.
|
2016-10-11 14:54:49 -07:00
|
|
|
RTCStatsMember<bool> writable;
|
2021-09-28 15:09:53 -07:00
|
|
|
RTCStatsMember<uint64_t> packets_sent;
|
|
|
|
|
RTCStatsMember<uint64_t> packets_received;
|
2016-10-11 14:54:49 -07:00
|
|
|
RTCStatsMember<uint64_t> bytes_sent;
|
|
|
|
|
RTCStatsMember<uint64_t> bytes_received;
|
2016-12-15 06:17:08 -08:00
|
|
|
RTCStatsMember<double> total_round_trip_time;
|
|
|
|
|
RTCStatsMember<double> current_round_trip_time;
|
2016-10-11 14:54:49 -07:00
|
|
|
RTCStatsMember<double> available_outgoing_bitrate;
|
|
|
|
|
RTCStatsMember<double> available_incoming_bitrate;
|
|
|
|
|
RTCStatsMember<uint64_t> requests_received;
|
|
|
|
|
RTCStatsMember<uint64_t> requests_sent;
|
|
|
|
|
RTCStatsMember<uint64_t> responses_received;
|
|
|
|
|
RTCStatsMember<uint64_t> responses_sent;
|
|
|
|
|
RTCStatsMember<uint64_t> consent_requests_sent;
|
2021-09-28 15:09:53 -07:00
|
|
|
RTCStatsMember<uint64_t> packets_discarded_on_send;
|
|
|
|
|
RTCStatsMember<uint64_t> bytes_discarded_on_send;
|
2016-10-11 14:54:49 -07:00
|
|
|
};
|
|
|
|
|
|
2016-10-07 02:18:47 -07:00
|
|
|
// https://w3c.github.io/webrtc-stats/#icecandidate-dict*
|
2018-10-16 14:13:50 +02:00
|
|
|
class RTC_EXPORT RTCIceCandidateStats : public RTCStats {
|
2016-10-07 02:18:47 -07:00
|
|
|
public:
|
|
|
|
|
WEBRTC_RTCSTATS_DECL();
|
|
|
|
|
|
|
|
|
|
RTCIceCandidateStats(const RTCIceCandidateStats& other);
|
|
|
|
|
~RTCIceCandidateStats() override;
|
|
|
|
|
|
2017-01-02 09:59:31 -08:00
|
|
|
RTCStatsMember<std::string> transport_id;
|
2021-03-19 08:24:41 -07:00
|
|
|
// Obsolete: is_remote
|
2017-01-02 04:46:15 -08:00
|
|
|
RTCStatsMember<bool> is_remote;
|
2017-11-21 10:49:36 -08:00
|
|
|
RTCStatsMember<std::string> network_type;
|
2016-10-07 02:18:47 -07:00
|
|
|
RTCStatsMember<std::string> ip;
|
2021-03-22 13:22:54 +01:00
|
|
|
RTCStatsMember<std::string> address;
|
2016-10-07 02:18:47 -07:00
|
|
|
RTCStatsMember<int32_t> port;
|
|
|
|
|
RTCStatsMember<std::string> protocol;
|
2018-09-27 14:40:08 +02:00
|
|
|
RTCStatsMember<std::string> relay_protocol;
|
2022-06-13 10:23:28 +02:00
|
|
|
// Enum type RTCIceCandidateType.
|
2016-10-07 02:18:47 -07:00
|
|
|
RTCStatsMember<std::string> candidate_type;
|
|
|
|
|
RTCStatsMember<int32_t> priority;
|
|
|
|
|
RTCStatsMember<std::string> url;
|
|
|
|
|
|
2022-03-02 11:17:36 +01:00
|
|
|
RTCNonStandardStatsMember<bool> vpn;
|
|
|
|
|
RTCNonStandardStatsMember<std::string> network_adapter_type;
|
|
|
|
|
|
2016-10-07 02:18:47 -07:00
|
|
|
protected:
|
2017-01-02 04:46:15 -08:00
|
|
|
RTCIceCandidateStats(const std::string& id,
|
|
|
|
|
int64_t timestamp_us,
|
|
|
|
|
bool is_remote);
|
|
|
|
|
RTCIceCandidateStats(std::string&& id, int64_t timestamp_us, bool is_remote);
|
2016-10-07 02:18:47 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// In the spec both local and remote varieties are of type RTCIceCandidateStats.
|
2021-07-25 21:50:14 +02:00
|
|
|
// But here we define them as subclasses of `RTCIceCandidateStats` because the
|
|
|
|
|
// `kType` need to be different ("RTCStatsType type") in the local/remote case.
|
2016-10-07 02:18:47 -07:00
|
|
|
// https://w3c.github.io/webrtc-stats/#rtcstatstype-str*
|
2018-03-20 13:24:20 +01:00
|
|
|
// This forces us to have to override copy() and type().
|
2018-10-16 14:13:50 +02:00
|
|
|
class RTC_EXPORT RTCLocalIceCandidateStats final : public RTCIceCandidateStats {
|
2016-10-07 02:18:47 -07:00
|
|
|
public:
|
|
|
|
|
static const char kType[];
|
|
|
|
|
RTCLocalIceCandidateStats(const std::string& id, int64_t timestamp_us);
|
|
|
|
|
RTCLocalIceCandidateStats(std::string&& id, int64_t timestamp_us);
|
2018-03-20 13:24:20 +01:00
|
|
|
std::unique_ptr<RTCStats> copy() const override;
|
2016-10-07 02:18:47 -07:00
|
|
|
const char* type() const override;
|
|
|
|
|
};
|
|
|
|
|
|
2018-10-16 14:13:50 +02:00
|
|
|
class RTC_EXPORT RTCRemoteIceCandidateStats final
|
|
|
|
|
: public RTCIceCandidateStats {
|
2016-10-07 02:18:47 -07:00
|
|
|
public:
|
|
|
|
|
static const char kType[];
|
|
|
|
|
RTCRemoteIceCandidateStats(const std::string& id, int64_t timestamp_us);
|
|
|
|
|
RTCRemoteIceCandidateStats(std::string&& id, int64_t timestamp_us);
|
2018-03-20 13:24:20 +01:00
|
|
|
std::unique_ptr<RTCStats> copy() const override;
|
2016-10-07 02:18:47 -07:00
|
|
|
const char* type() const override;
|
|
|
|
|
};
|
|
|
|
|
|
2022-06-13 10:23:28 +02:00
|
|
|
// https://w3c.github.io/webrtc-stats/#dom-rtcmediastreamstats
|
|
|
|
|
// TODO(https://crbug.com/webrtc/14172): Deprecate and remove.
|
2018-10-16 14:13:50 +02:00
|
|
|
class RTC_EXPORT RTCMediaStreamStats final : public RTCStats {
|
2016-11-08 06:29:22 -08:00
|
|
|
public:
|
|
|
|
|
WEBRTC_RTCSTATS_DECL();
|
|
|
|
|
|
|
|
|
|
RTCMediaStreamStats(const std::string& id, int64_t timestamp_us);
|
|
|
|
|
RTCMediaStreamStats(std::string&& id, int64_t timestamp_us);
|
|
|
|
|
RTCMediaStreamStats(const RTCMediaStreamStats& other);
|
|
|
|
|
~RTCMediaStreamStats() override;
|
|
|
|
|
|
|
|
|
|
RTCStatsMember<std::string> stream_identifier;
|
|
|
|
|
RTCStatsMember<std::vector<std::string>> track_ids;
|
|
|
|
|
};
|
|
|
|
|
|
2022-06-13 10:23:28 +02:00
|
|
|
// TODO(https://crbug.com/webrtc/14175): Deprecate and remove in favor of
|
|
|
|
|
// RTCMediaSourceStats/RTCOutboundRtpStreamStats and RTCInboundRtpStreamStats.
|
2018-10-16 14:13:50 +02:00
|
|
|
class RTC_EXPORT RTCMediaStreamTrackStats final : public RTCStats {
|
2016-11-08 06:29:22 -08:00
|
|
|
public:
|
|
|
|
|
WEBRTC_RTCSTATS_DECL();
|
|
|
|
|
|
2017-01-17 02:53:23 -08:00
|
|
|
RTCMediaStreamTrackStats(const std::string& id,
|
|
|
|
|
int64_t timestamp_us,
|
|
|
|
|
const char* kind);
|
|
|
|
|
RTCMediaStreamTrackStats(std::string&& id,
|
|
|
|
|
int64_t timestamp_us,
|
|
|
|
|
const char* kind);
|
2016-11-08 06:29:22 -08:00
|
|
|
RTCMediaStreamTrackStats(const RTCMediaStreamTrackStats& other);
|
|
|
|
|
~RTCMediaStreamTrackStats() override;
|
|
|
|
|
|
|
|
|
|
RTCStatsMember<std::string> track_identifier;
|
2019-05-22 15:49:42 +02:00
|
|
|
RTCStatsMember<std::string> media_source_id;
|
2016-11-08 06:29:22 -08:00
|
|
|
RTCStatsMember<bool> remote_source;
|
|
|
|
|
RTCStatsMember<bool> ended;
|
2022-06-13 10:23:28 +02:00
|
|
|
// TODO(https://crbug.com/webrtc/14173): Remove this obsolete metric.
|
2016-11-08 06:29:22 -08:00
|
|
|
RTCStatsMember<bool> detached;
|
2022-06-13 10:23:28 +02:00
|
|
|
// Enum type RTCMediaStreamTrackKind.
|
2017-01-17 02:53:23 -08:00
|
|
|
RTCStatsMember<std::string> kind;
|
2017-10-02 12:00:34 +02:00
|
|
|
RTCStatsMember<double> jitter_buffer_delay;
|
2019-01-15 15:46:29 +01:00
|
|
|
RTCStatsMember<uint64_t> jitter_buffer_emitted_count;
|
2016-11-08 06:29:22 -08:00
|
|
|
// Video-only members
|
|
|
|
|
RTCStatsMember<uint32_t> frame_width;
|
|
|
|
|
RTCStatsMember<uint32_t> frame_height;
|
|
|
|
|
RTCStatsMember<uint32_t> frames_sent;
|
2018-02-28 16:35:03 +01:00
|
|
|
RTCStatsMember<uint32_t> huge_frames_sent;
|
2016-11-08 06:29:22 -08:00
|
|
|
RTCStatsMember<uint32_t> frames_received;
|
|
|
|
|
RTCStatsMember<uint32_t> frames_decoded;
|
|
|
|
|
RTCStatsMember<uint32_t> frames_dropped;
|
|
|
|
|
// Audio-only members
|
[getStats] Implement "media-source" audio levels, fixing Chrome bug.
Implements RTCAudioSourceStats members:
- audioLevel
- totalAudioEnergy
- totalSamplesDuration
In this CL description these are collectively referred to as the audio
levels.
The audio levels are removed from sending "track" stats (in Chrome,
these are now reported as undefined instead of 0).
Background:
For sending tracks, audio levels were always reported as 0 in Chrome
(https://crbug.com/736403), while audio levels were correctly reported
for receiving tracks. This problem affected the standard getStats() but
not the legacy getStats(), blocking some people from migrating. This
was likely not a problem in native third_party/webrtc code because the
delivery of audio frames from device to send-stream uses a different
code path outside of chromium.
A recent PR (https://github.com/w3c/webrtc-stats/pull/451) moved the
send-side audio levels to the RTCAudioSourceStats, while keeping the
receive-side audio levels on the "track" stats. This allows an
implementation to report the audio levels even if samples are not sent
onto the network (such as if an ICE connection has not been established
yet), reflecting some of the current implementation.
Changes:
1. Audio levels are added to RTCAudioSourceStats. Send-side audio
"track" stats are left undefined. Receive-side audio "track" stats
are not changed in this CL and continue to work.
2. Audio level computation is moved from the AudioState and
AudioTransportImpl to the AudioSendStream. This is because a) the
AudioTransportImpl::RecordedDataIsAvailable() code path is not
exercised in chromium, and b) audio levels should, per-spec, not be
calculated on a per-call basis, for which the AudioState is defined.
3. The audio level computation is now performed in
AudioSendStream::SendAudioData(), a code path used by both native
and chromium code.
4. Comments are added to document behavior of existing code, such as
AudioLevel and AudioSendStream::SendAudioData().
Note:
In this CL, just like before this CL, audio level is only calculated
after an AudioSendStream has been created. This means that before an
O/A negotiation, audio levels are unavailable.
According to spec, if we have an audio source, we should have audio
levels. An immediate solution to this would have been to calculate the
audio level at pc/rtp_sender.cc. The problem is that the
LocalAudioSinkAdapter::OnData() code path, while exercised in chromium,
is not exercised in native code. The issue of calculating audio levels
on a per-source bases rather than on a per-send stream basis is left to
https://crbug.com/webrtc/10771, an existing "media-source" bug.
This CL can be verified manually in Chrome at:
https://codepen.io/anon/pen/vqRGyq
Bug: chromium:736403, webrtc:10771
Change-Id: I8036cd9984f3b187c3177470a8c0d6670a201a5a
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/143789
Reviewed-by: Oskar Sundbom <ossu@webrtc.org>
Reviewed-by: Stefan Holmer <stefan@webrtc.org>
Commit-Queue: Henrik Boström <hbos@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#28480}
2019-07-03 17:11:10 +02:00
|
|
|
RTCStatsMember<double> audio_level; // Receive-only
|
|
|
|
|
RTCStatsMember<double> total_audio_energy; // Receive-only
|
2016-11-08 06:29:22 -08:00
|
|
|
RTCStatsMember<double> echo_return_loss;
|
|
|
|
|
RTCStatsMember<double> echo_return_loss_enhancement;
|
2017-08-24 17:15:13 -07:00
|
|
|
RTCStatsMember<uint64_t> total_samples_received;
|
[getStats] Implement "media-source" audio levels, fixing Chrome bug.
Implements RTCAudioSourceStats members:
- audioLevel
- totalAudioEnergy
- totalSamplesDuration
In this CL description these are collectively referred to as the audio
levels.
The audio levels are removed from sending "track" stats (in Chrome,
these are now reported as undefined instead of 0).
Background:
For sending tracks, audio levels were always reported as 0 in Chrome
(https://crbug.com/736403), while audio levels were correctly reported
for receiving tracks. This problem affected the standard getStats() but
not the legacy getStats(), blocking some people from migrating. This
was likely not a problem in native third_party/webrtc code because the
delivery of audio frames from device to send-stream uses a different
code path outside of chromium.
A recent PR (https://github.com/w3c/webrtc-stats/pull/451) moved the
send-side audio levels to the RTCAudioSourceStats, while keeping the
receive-side audio levels on the "track" stats. This allows an
implementation to report the audio levels even if samples are not sent
onto the network (such as if an ICE connection has not been established
yet), reflecting some of the current implementation.
Changes:
1. Audio levels are added to RTCAudioSourceStats. Send-side audio
"track" stats are left undefined. Receive-side audio "track" stats
are not changed in this CL and continue to work.
2. Audio level computation is moved from the AudioState and
AudioTransportImpl to the AudioSendStream. This is because a) the
AudioTransportImpl::RecordedDataIsAvailable() code path is not
exercised in chromium, and b) audio levels should, per-spec, not be
calculated on a per-call basis, for which the AudioState is defined.
3. The audio level computation is now performed in
AudioSendStream::SendAudioData(), a code path used by both native
and chromium code.
4. Comments are added to document behavior of existing code, such as
AudioLevel and AudioSendStream::SendAudioData().
Note:
In this CL, just like before this CL, audio level is only calculated
after an AudioSendStream has been created. This means that before an
O/A negotiation, audio levels are unavailable.
According to spec, if we have an audio source, we should have audio
levels. An immediate solution to this would have been to calculate the
audio level at pc/rtp_sender.cc. The problem is that the
LocalAudioSinkAdapter::OnData() code path, while exercised in chromium,
is not exercised in native code. The issue of calculating audio levels
on a per-source bases rather than on a per-send stream basis is left to
https://crbug.com/webrtc/10771, an existing "media-source" bug.
This CL can be verified manually in Chrome at:
https://codepen.io/anon/pen/vqRGyq
Bug: chromium:736403, webrtc:10771
Change-Id: I8036cd9984f3b187c3177470a8c0d6670a201a5a
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/143789
Reviewed-by: Oskar Sundbom <ossu@webrtc.org>
Reviewed-by: Stefan Holmer <stefan@webrtc.org>
Commit-Queue: Henrik Boström <hbos@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#28480}
2019-07-03 17:11:10 +02:00
|
|
|
RTCStatsMember<double> total_samples_duration; // Receive-only
|
2017-08-24 17:15:13 -07:00
|
|
|
RTCStatsMember<uint64_t> concealed_samples;
|
2019-04-30 09:45:21 +02:00
|
|
|
RTCStatsMember<uint64_t> silent_concealed_samples;
|
2017-09-18 09:28:20 +02:00
|
|
|
RTCStatsMember<uint64_t> concealment_events;
|
2019-04-30 09:45:21 +02:00
|
|
|
RTCStatsMember<uint64_t> inserted_samples_for_deceleration;
|
|
|
|
|
RTCStatsMember<uint64_t> removed_samples_for_acceleration;
|
2018-11-22 17:21:10 +01:00
|
|
|
// Non-standard audio-only member
|
2022-06-13 10:23:28 +02:00
|
|
|
// https://w3c.github.io/webrtc-provisional-stats/#dom-rtcaudioreceiverstats-jitterbufferflushes
|
2018-11-22 17:21:10 +01:00
|
|
|
RTCNonStandardStatsMember<uint64_t> jitter_buffer_flushes;
|
2018-11-27 12:52:16 +01:00
|
|
|
RTCNonStandardStatsMember<uint64_t> delayed_packet_outage_samples;
|
2019-03-06 09:18:40 +01:00
|
|
|
RTCNonStandardStatsMember<double> relative_packet_arrival_delay;
|
2019-04-29 17:00:46 +02:00
|
|
|
// TODO(henrik.lundin): Add description of the interruption metrics at
|
2022-06-13 10:23:28 +02:00
|
|
|
// https://github.com/w3c/webrtc-provisional-stats/issues/17
|
2019-04-29 17:00:46 +02:00
|
|
|
RTCNonStandardStatsMember<uint32_t> interruption_count;
|
|
|
|
|
RTCNonStandardStatsMember<double> total_interruption_duration;
|
2019-01-31 16:45:42 +01:00
|
|
|
// Non-standard video-only members.
|
2022-06-13 10:23:28 +02:00
|
|
|
// https://w3c.github.io/webrtc-provisional-stats/#dom-rtcvideoreceiverstats
|
2019-01-31 16:45:42 +01:00
|
|
|
RTCNonStandardStatsMember<uint32_t> freeze_count;
|
|
|
|
|
RTCNonStandardStatsMember<uint32_t> pause_count;
|
|
|
|
|
RTCNonStandardStatsMember<double> total_freezes_duration;
|
|
|
|
|
RTCNonStandardStatsMember<double> total_pauses_duration;
|
|
|
|
|
RTCNonStandardStatsMember<double> total_frames_duration;
|
|
|
|
|
RTCNonStandardStatsMember<double> sum_squared_frame_durations;
|
2016-11-08 06:29:22 -08:00
|
|
|
};
|
|
|
|
|
|
2016-10-03 14:16:56 -07:00
|
|
|
// https://w3c.github.io/webrtc-stats/#pcstats-dict*
|
2018-10-16 14:13:50 +02:00
|
|
|
class RTC_EXPORT RTCPeerConnectionStats final : public RTCStats {
|
2016-08-30 14:04:35 -07:00
|
|
|
public:
|
2016-10-06 02:06:10 -07:00
|
|
|
WEBRTC_RTCSTATS_DECL();
|
|
|
|
|
|
2016-08-31 07:57:36 -07:00
|
|
|
RTCPeerConnectionStats(const std::string& id, int64_t timestamp_us);
|
|
|
|
|
RTCPeerConnectionStats(std::string&& id, int64_t timestamp_us);
|
2016-10-06 02:06:10 -07:00
|
|
|
RTCPeerConnectionStats(const RTCPeerConnectionStats& other);
|
|
|
|
|
~RTCPeerConnectionStats() override;
|
2016-08-30 14:04:35 -07:00
|
|
|
|
|
|
|
|
RTCStatsMember<uint32_t> data_channels_opened;
|
|
|
|
|
RTCStatsMember<uint32_t> data_channels_closed;
|
|
|
|
|
};
|
|
|
|
|
|
2016-11-01 01:50:46 -07:00
|
|
|
// https://w3c.github.io/webrtc-stats/#streamstats-dict*
|
2018-10-16 14:13:50 +02:00
|
|
|
class RTC_EXPORT RTCRTPStreamStats : public RTCStats {
|
2016-11-01 01:50:46 -07:00
|
|
|
public:
|
|
|
|
|
WEBRTC_RTCSTATS_DECL();
|
|
|
|
|
|
|
|
|
|
RTCRTPStreamStats(const RTCRTPStreamStats& other);
|
|
|
|
|
~RTCRTPStreamStats() override;
|
|
|
|
|
|
2017-02-07 06:28:11 -08:00
|
|
|
RTCStatsMember<uint32_t> ssrc;
|
2018-08-28 14:55:03 +02:00
|
|
|
RTCStatsMember<std::string> kind;
|
2021-03-19 08:24:41 -07:00
|
|
|
// Obsolete: track_id
|
2017-01-27 06:35:16 -08:00
|
|
|
RTCStatsMember<std::string> track_id;
|
2016-11-01 01:50:46 -07:00
|
|
|
RTCStatsMember<std::string> transport_id;
|
|
|
|
|
RTCStatsMember<std::string> codec_id;
|
2021-03-09 09:25:28 -08:00
|
|
|
|
|
|
|
|
// Obsolete
|
|
|
|
|
RTCStatsMember<std::string> media_type; // renamed to kind.
|
2016-11-01 01:50:46 -07:00
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
RTCRTPStreamStats(const std::string& id, int64_t timestamp_us);
|
|
|
|
|
RTCRTPStreamStats(std::string&& id, int64_t timestamp_us);
|
|
|
|
|
};
|
|
|
|
|
|
2021-03-23 17:23:04 +01:00
|
|
|
// https://www.w3.org/TR/webrtc-stats/#receivedrtpstats-dict*
|
2021-03-09 09:25:28 -08:00
|
|
|
class RTC_EXPORT RTCReceivedRtpStreamStats : public RTCRTPStreamStats {
|
|
|
|
|
public:
|
|
|
|
|
WEBRTC_RTCSTATS_DECL();
|
|
|
|
|
|
|
|
|
|
RTCReceivedRtpStreamStats(const RTCReceivedRtpStreamStats& other);
|
|
|
|
|
~RTCReceivedRtpStreamStats() override;
|
|
|
|
|
|
|
|
|
|
RTCStatsMember<double> jitter;
|
|
|
|
|
RTCStatsMember<int32_t> packets_lost; // Signed per RFC 3550
|
2021-07-07 15:53:38 +02:00
|
|
|
RTCStatsMember<uint64_t> packets_discarded;
|
2021-03-09 09:25:28 -08:00
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
RTCReceivedRtpStreamStats(const std::string&& id, int64_t timestamp_us);
|
|
|
|
|
RTCReceivedRtpStreamStats(std::string&& id, int64_t timestamp_us);
|
|
|
|
|
};
|
|
|
|
|
|
2021-03-23 17:23:04 +01:00
|
|
|
// https://www.w3.org/TR/webrtc-stats/#sentrtpstats-dict*
|
|
|
|
|
class RTC_EXPORT RTCSentRtpStreamStats : public RTCRTPStreamStats {
|
|
|
|
|
public:
|
|
|
|
|
WEBRTC_RTCSTATS_DECL();
|
|
|
|
|
|
|
|
|
|
RTCSentRtpStreamStats(const RTCSentRtpStreamStats& other);
|
|
|
|
|
~RTCSentRtpStreamStats() override;
|
|
|
|
|
|
|
|
|
|
RTCStatsMember<uint32_t> packets_sent;
|
|
|
|
|
RTCStatsMember<uint64_t> bytes_sent;
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
RTCSentRtpStreamStats(const std::string&& id, int64_t timestamp_us);
|
|
|
|
|
RTCSentRtpStreamStats(std::string&& id, int64_t timestamp_us);
|
|
|
|
|
};
|
|
|
|
|
|
2016-11-01 03:00:17 -07:00
|
|
|
// https://w3c.github.io/webrtc-stats/#inboundrtpstats-dict*
|
2021-03-09 09:25:28 -08:00
|
|
|
class RTC_EXPORT RTCInboundRTPStreamStats final
|
|
|
|
|
: public RTCReceivedRtpStreamStats {
|
2016-11-01 03:00:17 -07:00
|
|
|
public:
|
|
|
|
|
WEBRTC_RTCSTATS_DECL();
|
|
|
|
|
|
|
|
|
|
RTCInboundRTPStreamStats(const std::string& id, int64_t timestamp_us);
|
|
|
|
|
RTCInboundRTPStreamStats(std::string&& id, int64_t timestamp_us);
|
|
|
|
|
RTCInboundRTPStreamStats(const RTCInboundRTPStreamStats& other);
|
|
|
|
|
~RTCInboundRTPStreamStats() override;
|
|
|
|
|
|
2022-06-13 10:23:28 +02:00
|
|
|
// TODO(https://crbug.com/webrtc/14174): Implement trackIdentifier and kind.
|
|
|
|
|
|
2022-06-16 16:55:31 +02:00
|
|
|
RTCStatsMember<std::string> track_identifier;
|
2022-06-16 17:07:33 +02:00
|
|
|
RTCStatsMember<std::string> mid;
|
2021-03-23 17:23:04 +01:00
|
|
|
RTCStatsMember<std::string> remote_id;
|
2016-11-01 03:00:17 -07:00
|
|
|
RTCStatsMember<uint32_t> packets_received;
|
2019-04-30 09:45:21 +02:00
|
|
|
RTCStatsMember<uint64_t> fec_packets_received;
|
|
|
|
|
RTCStatsMember<uint64_t> fec_packets_discarded;
|
2016-11-01 03:00:17 -07:00
|
|
|
RTCStatsMember<uint64_t> bytes_received;
|
2019-10-09 15:01:33 +02:00
|
|
|
RTCStatsMember<uint64_t> header_bytes_received;
|
2019-04-15 17:32:00 +02:00
|
|
|
RTCStatsMember<double> last_packet_received_timestamp;
|
2020-07-06 14:18:07 +03:00
|
|
|
RTCStatsMember<double> jitter_buffer_delay;
|
2022-07-04 14:16:39 +02:00
|
|
|
RTCStatsMember<double> jitter_buffer_target_delay;
|
2020-07-06 14:18:07 +03:00
|
|
|
RTCStatsMember<uint64_t> jitter_buffer_emitted_count;
|
|
|
|
|
RTCStatsMember<uint64_t> total_samples_received;
|
|
|
|
|
RTCStatsMember<uint64_t> concealed_samples;
|
|
|
|
|
RTCStatsMember<uint64_t> silent_concealed_samples;
|
|
|
|
|
RTCStatsMember<uint64_t> concealment_events;
|
|
|
|
|
RTCStatsMember<uint64_t> inserted_samples_for_deceleration;
|
|
|
|
|
RTCStatsMember<uint64_t> removed_samples_for_acceleration;
|
|
|
|
|
RTCStatsMember<double> audio_level;
|
|
|
|
|
RTCStatsMember<double> total_audio_energy;
|
|
|
|
|
RTCStatsMember<double> total_samples_duration;
|
2022-04-25 12:21:30 +02:00
|
|
|
// Stats below are only implemented or defined for video.
|
|
|
|
|
RTCStatsMember<int32_t> frames_received;
|
2020-07-06 14:18:07 +03:00
|
|
|
RTCStatsMember<uint32_t> frame_width;
|
|
|
|
|
RTCStatsMember<uint32_t> frame_height;
|
|
|
|
|
RTCStatsMember<double> frames_per_second;
|
2017-01-02 08:35:13 -08:00
|
|
|
RTCStatsMember<uint32_t> frames_decoded;
|
2019-06-27 14:29:34 +02:00
|
|
|
RTCStatsMember<uint32_t> key_frames_decoded;
|
2020-07-06 14:18:07 +03:00
|
|
|
RTCStatsMember<uint32_t> frames_dropped;
|
2019-07-01 10:07:50 +02:00
|
|
|
RTCStatsMember<double> total_decode_time;
|
2022-04-25 12:21:30 +02:00
|
|
|
RTCStatsMember<double> total_processing_delay;
|
2022-06-13 10:23:28 +02:00
|
|
|
// TODO(https://crbug.com/webrtc/13986): standardize
|
2022-05-05 15:55:36 +02:00
|
|
|
RTCNonStandardStatsMember<double> total_assembly_time;
|
|
|
|
|
RTCNonStandardStatsMember<uint32_t> frames_assembled_from_multiple_packets;
|
2019-11-25 10:25:42 +01:00
|
|
|
RTCStatsMember<double> total_inter_frame_delay;
|
|
|
|
|
RTCStatsMember<double> total_squared_inter_frame_delay;
|
2022-06-13 10:23:28 +02:00
|
|
|
// https://w3c.github.io/webrtc-provisional-stats/#dom-rtcinboundrtpstreamstats-contenttype
|
2019-04-09 13:59:31 +02:00
|
|
|
RTCStatsMember<std::string> content_type;
|
2022-06-13 10:23:28 +02:00
|
|
|
// Only populated if audio/video sync is enabled.
|
|
|
|
|
// TODO(https://crbug.com/webrtc/14177): Expose even if A/V sync is off?
|
2019-10-22 15:23:44 +02:00
|
|
|
RTCStatsMember<double> estimated_playout_timestamp;
|
2022-06-13 10:23:28 +02:00
|
|
|
// Only implemented for video.
|
|
|
|
|
// TODO(https://crbug.com/webrtc/14178): Also implement for audio.
|
2019-08-16 13:09:51 +02:00
|
|
|
RTCStatsMember<std::string> decoder_implementation;
|
2022-04-22 15:09:54 +02:00
|
|
|
// FIR and PLI counts are only defined for |kind == "video"|.
|
2021-03-09 09:25:28 -08:00
|
|
|
RTCStatsMember<uint32_t> fir_count;
|
|
|
|
|
RTCStatsMember<uint32_t> pli_count;
|
|
|
|
|
RTCStatsMember<uint32_t> nack_count;
|
|
|
|
|
RTCStatsMember<uint64_t> qp_sum;
|
2022-05-30 12:37:04 +02:00
|
|
|
|
|
|
|
|
// The former googMinPlayoutDelayMs (in seconds).
|
|
|
|
|
RTCNonStandardStatsMember<double> min_playout_delay;
|
2016-11-01 03:00:17 -07:00
|
|
|
};
|
|
|
|
|
|
2016-11-01 01:50:46 -07:00
|
|
|
// https://w3c.github.io/webrtc-stats/#outboundrtpstats-dict*
|
2018-10-16 14:13:50 +02:00
|
|
|
class RTC_EXPORT RTCOutboundRTPStreamStats final : public RTCRTPStreamStats {
|
2016-11-01 01:50:46 -07:00
|
|
|
public:
|
|
|
|
|
WEBRTC_RTCSTATS_DECL();
|
|
|
|
|
|
|
|
|
|
RTCOutboundRTPStreamStats(const std::string& id, int64_t timestamp_us);
|
|
|
|
|
RTCOutboundRTPStreamStats(std::string&& id, int64_t timestamp_us);
|
|
|
|
|
RTCOutboundRTPStreamStats(const RTCOutboundRTPStreamStats& other);
|
|
|
|
|
~RTCOutboundRTPStreamStats() override;
|
|
|
|
|
|
2019-05-22 15:49:42 +02:00
|
|
|
RTCStatsMember<std::string> media_source_id;
|
2019-12-19 13:27:27 +01:00
|
|
|
RTCStatsMember<std::string> remote_id;
|
2022-06-16 17:07:33 +02:00
|
|
|
RTCStatsMember<std::string> mid;
|
Reland "Improve outbound-rtp statistics for simulcast"
This reverts commit 9a925c9ce33a6ccdd11b545b11ba68e985c2a65d.
Reason for revert: The original CL is updated in PS #2 to
fix the googRtt issue which was that when the legacy sender
stats were put in "aggregated_senders" we forgot to update
rtt_ms the same way that we do it for "senders".
Original change's description:
> Revert "Improve outbound-rtp statistics for simulcast"
>
> This reverts commit da6cda839dac7d9d18eba8d365188fa94831e0b1.
>
> Reason for revert: Breaks googRtt in legacy getStats API
>
> Original change's description:
> > Improve outbound-rtp statistics for simulcast
> >
> > Bug: webrtc:9547
> > Change-Id: Iec4eb976aa11ee743805425bedb77dcea7c2c9be
> > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/168120
> > Reviewed-by: Sebastian Jansson <srte@webrtc.org>
> > Reviewed-by: Erik Språng <sprang@webrtc.org>
> > Reviewed-by: Henrik Boström <hbos@webrtc.org>
> > Reviewed-by: Harald Alvestrand <hta@webrtc.org>
> > Commit-Queue: Eldar Rello <elrello@microsoft.com>
> > Cr-Commit-Position: refs/heads/master@{#31097}
>
> TBR=hbos@webrtc.org,sprang@webrtc.org,stefan@webrtc.org,srte@webrtc.org,hta@webrtc.org,elrello@microsoft.com
>
> # Not skipping CQ checks because original CL landed > 1 day ago.
>
> Bug: webrtc:9547
> Change-Id: I06673328c2a5293a7eef03b3aaf2ded9d13df1b3
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/174443
> Reviewed-by: Henrik Boström <hbos@webrtc.org>
> Commit-Queue: Henrik Boström <hbos@webrtc.org>
> Cr-Commit-Position: refs/heads/master@{#31165}
TBR=hbos@webrtc.org,sprang@webrtc.org,stefan@webrtc.org,srte@webrtc.org,hta@webrtc.org,elrello@microsoft.com
# Not skipping CQ checks because this is a reland.
Bug: webrtc:9547
Change-Id: I723744c496c3c65f95ab6a8940862c8b9f544338
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/174480
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Reviewed-by: Henrik Boström <hbos@webrtc.org>
Commit-Queue: Henrik Boström <hbos@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#31169}
2020-05-05 15:54:46 +02:00
|
|
|
RTCStatsMember<std::string> rid;
|
2016-11-01 01:50:46 -07:00
|
|
|
RTCStatsMember<uint32_t> packets_sent;
|
2019-04-17 13:51:53 +02:00
|
|
|
RTCStatsMember<uint64_t> retransmitted_packets_sent;
|
2016-11-01 01:50:46 -07:00
|
|
|
RTCStatsMember<uint64_t> bytes_sent;
|
2019-10-09 15:01:33 +02:00
|
|
|
RTCStatsMember<uint64_t> header_bytes_sent;
|
2019-04-17 13:51:53 +02:00
|
|
|
RTCStatsMember<uint64_t> retransmitted_bytes_sent;
|
2021-11-11 13:43:49 +01:00
|
|
|
// TODO(https://crbug.com/webrtc/13394): Also collect this metric for video.
|
2016-11-01 01:50:46 -07:00
|
|
|
RTCStatsMember<double> target_bitrate;
|
2017-01-02 08:35:13 -08:00
|
|
|
RTCStatsMember<uint32_t> frames_encoded;
|
2019-06-27 14:29:34 +02:00
|
|
|
RTCStatsMember<uint32_t> key_frames_encoded;
|
2019-04-08 16:14:23 +02:00
|
|
|
RTCStatsMember<double> total_encode_time;
|
2019-05-20 15:15:38 +02:00
|
|
|
RTCStatsMember<uint64_t> total_encoded_bytes_target;
|
Reland "Improve outbound-rtp statistics for simulcast"
This reverts commit 9a925c9ce33a6ccdd11b545b11ba68e985c2a65d.
Reason for revert: The original CL is updated in PS #2 to
fix the googRtt issue which was that when the legacy sender
stats were put in "aggregated_senders" we forgot to update
rtt_ms the same way that we do it for "senders".
Original change's description:
> Revert "Improve outbound-rtp statistics for simulcast"
>
> This reverts commit da6cda839dac7d9d18eba8d365188fa94831e0b1.
>
> Reason for revert: Breaks googRtt in legacy getStats API
>
> Original change's description:
> > Improve outbound-rtp statistics for simulcast
> >
> > Bug: webrtc:9547
> > Change-Id: Iec4eb976aa11ee743805425bedb77dcea7c2c9be
> > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/168120
> > Reviewed-by: Sebastian Jansson <srte@webrtc.org>
> > Reviewed-by: Erik Språng <sprang@webrtc.org>
> > Reviewed-by: Henrik Boström <hbos@webrtc.org>
> > Reviewed-by: Harald Alvestrand <hta@webrtc.org>
> > Commit-Queue: Eldar Rello <elrello@microsoft.com>
> > Cr-Commit-Position: refs/heads/master@{#31097}
>
> TBR=hbos@webrtc.org,sprang@webrtc.org,stefan@webrtc.org,srte@webrtc.org,hta@webrtc.org,elrello@microsoft.com
>
> # Not skipping CQ checks because original CL landed > 1 day ago.
>
> Bug: webrtc:9547
> Change-Id: I06673328c2a5293a7eef03b3aaf2ded9d13df1b3
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/174443
> Reviewed-by: Henrik Boström <hbos@webrtc.org>
> Commit-Queue: Henrik Boström <hbos@webrtc.org>
> Cr-Commit-Position: refs/heads/master@{#31165}
TBR=hbos@webrtc.org,sprang@webrtc.org,stefan@webrtc.org,srte@webrtc.org,hta@webrtc.org,elrello@microsoft.com
# Not skipping CQ checks because this is a reland.
Bug: webrtc:9547
Change-Id: I723744c496c3c65f95ab6a8940862c8b9f544338
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/174480
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Reviewed-by: Henrik Boström <hbos@webrtc.org>
Commit-Queue: Henrik Boström <hbos@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#31169}
2020-05-05 15:54:46 +02:00
|
|
|
RTCStatsMember<uint32_t> frame_width;
|
|
|
|
|
RTCStatsMember<uint32_t> frame_height;
|
|
|
|
|
RTCStatsMember<double> frames_per_second;
|
|
|
|
|
RTCStatsMember<uint32_t> frames_sent;
|
|
|
|
|
RTCStatsMember<uint32_t> huge_frames_sent;
|
2019-05-16 18:38:20 +02:00
|
|
|
// TODO(https://crbug.com/webrtc/10635): This is only implemented for video;
|
|
|
|
|
// implement it for audio as well.
|
|
|
|
|
RTCStatsMember<double> total_packet_send_delay;
|
2019-05-28 17:42:38 +02:00
|
|
|
// Enum type RTCQualityLimitationReason
|
|
|
|
|
RTCStatsMember<std::string> quality_limitation_reason;
|
2021-05-28 21:32:04 +09:00
|
|
|
RTCStatsMember<std::map<std::string, double>> quality_limitation_durations;
|
2019-09-09 11:26:45 +02:00
|
|
|
// https://w3c.github.io/webrtc-stats/#dom-rtcoutboundrtpstreamstats-qualitylimitationresolutionchanges
|
|
|
|
|
RTCStatsMember<uint32_t> quality_limitation_resolution_changes;
|
2022-06-13 10:23:28 +02:00
|
|
|
// https://w3c.github.io/webrtc-provisional-stats/#dom-rtcoutboundrtpstreamstats-contenttype
|
2019-04-09 13:59:31 +02:00
|
|
|
RTCStatsMember<std::string> content_type;
|
2022-06-13 10:23:28 +02:00
|
|
|
// Only implemented for video.
|
|
|
|
|
// TODO(https://crbug.com/webrtc/14178): Implement for audio as well.
|
2019-08-16 13:09:51 +02:00
|
|
|
RTCStatsMember<std::string> encoder_implementation;
|
2022-04-22 15:09:54 +02:00
|
|
|
// FIR and PLI counts are only defined for |kind == "video"|.
|
2021-03-09 09:25:28 -08:00
|
|
|
RTCStatsMember<uint32_t> fir_count;
|
|
|
|
|
RTCStatsMember<uint32_t> pli_count;
|
|
|
|
|
RTCStatsMember<uint32_t> nack_count;
|
|
|
|
|
RTCStatsMember<uint64_t> qp_sum;
|
2016-11-01 01:50:46 -07:00
|
|
|
};
|
|
|
|
|
|
Implement RTCRemoteInboundRtpStreamStats for both audio and video.
This implements the essentials of RTCRemoteInboundRtpStreamStats. This
includes:
- ssrc
- transportId
- codecId
- packetsLost
- jitter
- localId
- roundTripTime
https://w3c.github.io/webrtc-stats/#remoteinboundrtpstats-dict*
The following members are not implemented because they require more
work...
- From RTCReceivedRtpStreamStats: packetsReceived, packetsDiscarded,
packetsRepaired, burstPacketsLost, burstPacketsDiscarded,
burstLossCount, burstDiscardCount, burstLossRate, burstDiscardRate,
gapLossRate and gapDiscardRate.
- From RTCRemoteInboundRtpStreamStats: fractionLost.
Bug: webrtc:10455, webrtc:10456
Change-Id: If2ab0da7105d8c93bba58e14aa93bd22ffe57f1d
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/138067
Commit-Queue: Henrik Boström <hbos@webrtc.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#28073}
2019-05-27 13:40:25 +02:00
|
|
|
// https://w3c.github.io/webrtc-stats/#remoteinboundrtpstats-dict*
|
2021-03-09 09:25:28 -08:00
|
|
|
class RTC_EXPORT RTCRemoteInboundRtpStreamStats final
|
|
|
|
|
: public RTCReceivedRtpStreamStats {
|
Implement RTCRemoteInboundRtpStreamStats for both audio and video.
This implements the essentials of RTCRemoteInboundRtpStreamStats. This
includes:
- ssrc
- transportId
- codecId
- packetsLost
- jitter
- localId
- roundTripTime
https://w3c.github.io/webrtc-stats/#remoteinboundrtpstats-dict*
The following members are not implemented because they require more
work...
- From RTCReceivedRtpStreamStats: packetsReceived, packetsDiscarded,
packetsRepaired, burstPacketsLost, burstPacketsDiscarded,
burstLossCount, burstDiscardCount, burstLossRate, burstDiscardRate,
gapLossRate and gapDiscardRate.
- From RTCRemoteInboundRtpStreamStats: fractionLost.
Bug: webrtc:10455, webrtc:10456
Change-Id: If2ab0da7105d8c93bba58e14aa93bd22ffe57f1d
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/138067
Commit-Queue: Henrik Boström <hbos@webrtc.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#28073}
2019-05-27 13:40:25 +02:00
|
|
|
public:
|
|
|
|
|
WEBRTC_RTCSTATS_DECL();
|
|
|
|
|
|
|
|
|
|
RTCRemoteInboundRtpStreamStats(const std::string& id, int64_t timestamp_us);
|
|
|
|
|
RTCRemoteInboundRtpStreamStats(std::string&& id, int64_t timestamp_us);
|
|
|
|
|
RTCRemoteInboundRtpStreamStats(const RTCRemoteInboundRtpStreamStats& other);
|
|
|
|
|
~RTCRemoteInboundRtpStreamStats() override;
|
|
|
|
|
|
|
|
|
|
RTCStatsMember<std::string> local_id;
|
|
|
|
|
RTCStatsMember<double> round_trip_time;
|
2021-02-28 23:36:03 -08:00
|
|
|
RTCStatsMember<double> fraction_lost;
|
2021-03-01 11:22:06 -08:00
|
|
|
RTCStatsMember<double> total_round_trip_time;
|
|
|
|
|
RTCStatsMember<int32_t> round_trip_time_measurements;
|
Implement RTCRemoteInboundRtpStreamStats for both audio and video.
This implements the essentials of RTCRemoteInboundRtpStreamStats. This
includes:
- ssrc
- transportId
- codecId
- packetsLost
- jitter
- localId
- roundTripTime
https://w3c.github.io/webrtc-stats/#remoteinboundrtpstats-dict*
The following members are not implemented because they require more
work...
- From RTCReceivedRtpStreamStats: packetsReceived, packetsDiscarded,
packetsRepaired, burstPacketsLost, burstPacketsDiscarded,
burstLossCount, burstDiscardCount, burstLossRate, burstDiscardRate,
gapLossRate and gapDiscardRate.
- From RTCRemoteInboundRtpStreamStats: fractionLost.
Bug: webrtc:10455, webrtc:10456
Change-Id: If2ab0da7105d8c93bba58e14aa93bd22ffe57f1d
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/138067
Commit-Queue: Henrik Boström <hbos@webrtc.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#28073}
2019-05-27 13:40:25 +02:00
|
|
|
};
|
|
|
|
|
|
2021-03-23 17:23:04 +01:00
|
|
|
// https://w3c.github.io/webrtc-stats/#remoteoutboundrtpstats-dict*
|
|
|
|
|
class RTC_EXPORT RTCRemoteOutboundRtpStreamStats final
|
|
|
|
|
: public RTCSentRtpStreamStats {
|
|
|
|
|
public:
|
|
|
|
|
WEBRTC_RTCSTATS_DECL();
|
|
|
|
|
|
|
|
|
|
RTCRemoteOutboundRtpStreamStats(const std::string& id, int64_t timestamp_us);
|
|
|
|
|
RTCRemoteOutboundRtpStreamStats(std::string&& id, int64_t timestamp_us);
|
|
|
|
|
RTCRemoteOutboundRtpStreamStats(const RTCRemoteOutboundRtpStreamStats& other);
|
|
|
|
|
~RTCRemoteOutboundRtpStreamStats() override;
|
|
|
|
|
|
|
|
|
|
RTCStatsMember<std::string> local_id;
|
|
|
|
|
RTCStatsMember<double> remote_timestamp;
|
|
|
|
|
RTCStatsMember<uint64_t> reports_sent;
|
2021-09-03 14:51:22 +00:00
|
|
|
RTCStatsMember<double> round_trip_time;
|
|
|
|
|
RTCStatsMember<uint64_t> round_trip_time_measurements;
|
|
|
|
|
RTCStatsMember<double> total_round_trip_time;
|
2021-03-23 17:23:04 +01:00
|
|
|
};
|
|
|
|
|
|
2019-05-22 15:49:42 +02:00
|
|
|
// https://w3c.github.io/webrtc-stats/#dom-rtcmediasourcestats
|
|
|
|
|
class RTC_EXPORT RTCMediaSourceStats : public RTCStats {
|
|
|
|
|
public:
|
|
|
|
|
WEBRTC_RTCSTATS_DECL();
|
|
|
|
|
|
|
|
|
|
RTCMediaSourceStats(const RTCMediaSourceStats& other);
|
|
|
|
|
~RTCMediaSourceStats() override;
|
|
|
|
|
|
|
|
|
|
RTCStatsMember<std::string> track_identifier;
|
|
|
|
|
RTCStatsMember<std::string> kind;
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
RTCMediaSourceStats(const std::string& id, int64_t timestamp_us);
|
|
|
|
|
RTCMediaSourceStats(std::string&& id, int64_t timestamp_us);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// https://w3c.github.io/webrtc-stats/#dom-rtcaudiosourcestats
|
|
|
|
|
class RTC_EXPORT RTCAudioSourceStats final : public RTCMediaSourceStats {
|
|
|
|
|
public:
|
|
|
|
|
WEBRTC_RTCSTATS_DECL();
|
|
|
|
|
|
|
|
|
|
RTCAudioSourceStats(const std::string& id, int64_t timestamp_us);
|
|
|
|
|
RTCAudioSourceStats(std::string&& id, int64_t timestamp_us);
|
|
|
|
|
RTCAudioSourceStats(const RTCAudioSourceStats& other);
|
|
|
|
|
~RTCAudioSourceStats() override;
|
[getStats] Implement "media-source" audio levels, fixing Chrome bug.
Implements RTCAudioSourceStats members:
- audioLevel
- totalAudioEnergy
- totalSamplesDuration
In this CL description these are collectively referred to as the audio
levels.
The audio levels are removed from sending "track" stats (in Chrome,
these are now reported as undefined instead of 0).
Background:
For sending tracks, audio levels were always reported as 0 in Chrome
(https://crbug.com/736403), while audio levels were correctly reported
for receiving tracks. This problem affected the standard getStats() but
not the legacy getStats(), blocking some people from migrating. This
was likely not a problem in native third_party/webrtc code because the
delivery of audio frames from device to send-stream uses a different
code path outside of chromium.
A recent PR (https://github.com/w3c/webrtc-stats/pull/451) moved the
send-side audio levels to the RTCAudioSourceStats, while keeping the
receive-side audio levels on the "track" stats. This allows an
implementation to report the audio levels even if samples are not sent
onto the network (such as if an ICE connection has not been established
yet), reflecting some of the current implementation.
Changes:
1. Audio levels are added to RTCAudioSourceStats. Send-side audio
"track" stats are left undefined. Receive-side audio "track" stats
are not changed in this CL and continue to work.
2. Audio level computation is moved from the AudioState and
AudioTransportImpl to the AudioSendStream. This is because a) the
AudioTransportImpl::RecordedDataIsAvailable() code path is not
exercised in chromium, and b) audio levels should, per-spec, not be
calculated on a per-call basis, for which the AudioState is defined.
3. The audio level computation is now performed in
AudioSendStream::SendAudioData(), a code path used by both native
and chromium code.
4. Comments are added to document behavior of existing code, such as
AudioLevel and AudioSendStream::SendAudioData().
Note:
In this CL, just like before this CL, audio level is only calculated
after an AudioSendStream has been created. This means that before an
O/A negotiation, audio levels are unavailable.
According to spec, if we have an audio source, we should have audio
levels. An immediate solution to this would have been to calculate the
audio level at pc/rtp_sender.cc. The problem is that the
LocalAudioSinkAdapter::OnData() code path, while exercised in chromium,
is not exercised in native code. The issue of calculating audio levels
on a per-source bases rather than on a per-send stream basis is left to
https://crbug.com/webrtc/10771, an existing "media-source" bug.
This CL can be verified manually in Chrome at:
https://codepen.io/anon/pen/vqRGyq
Bug: chromium:736403, webrtc:10771
Change-Id: I8036cd9984f3b187c3177470a8c0d6670a201a5a
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/143789
Reviewed-by: Oskar Sundbom <ossu@webrtc.org>
Reviewed-by: Stefan Holmer <stefan@webrtc.org>
Commit-Queue: Henrik Boström <hbos@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#28480}
2019-07-03 17:11:10 +02:00
|
|
|
|
|
|
|
|
RTCStatsMember<double> audio_level;
|
|
|
|
|
RTCStatsMember<double> total_audio_energy;
|
|
|
|
|
RTCStatsMember<double> total_samples_duration;
|
2021-06-24 13:32:50 -07:00
|
|
|
RTCStatsMember<double> echo_return_loss;
|
|
|
|
|
RTCStatsMember<double> echo_return_loss_enhancement;
|
2019-05-22 15:49:42 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// https://w3c.github.io/webrtc-stats/#dom-rtcvideosourcestats
|
|
|
|
|
class RTC_EXPORT RTCVideoSourceStats final : public RTCMediaSourceStats {
|
|
|
|
|
public:
|
|
|
|
|
WEBRTC_RTCSTATS_DECL();
|
|
|
|
|
|
|
|
|
|
RTCVideoSourceStats(const std::string& id, int64_t timestamp_us);
|
|
|
|
|
RTCVideoSourceStats(std::string&& id, int64_t timestamp_us);
|
|
|
|
|
RTCVideoSourceStats(const RTCVideoSourceStats& other);
|
|
|
|
|
~RTCVideoSourceStats() override;
|
|
|
|
|
|
|
|
|
|
RTCStatsMember<uint32_t> width;
|
|
|
|
|
RTCStatsMember<uint32_t> height;
|
|
|
|
|
RTCStatsMember<uint32_t> frames;
|
2021-11-10 11:23:56 +09:00
|
|
|
RTCStatsMember<double> frames_per_second;
|
2019-05-22 15:49:42 +02:00
|
|
|
};
|
|
|
|
|
|
2016-10-24 04:00:05 -07:00
|
|
|
// https://w3c.github.io/webrtc-stats/#transportstats-dict*
|
2018-10-16 14:13:50 +02:00
|
|
|
class RTC_EXPORT RTCTransportStats final : public RTCStats {
|
2016-10-24 04:00:05 -07:00
|
|
|
public:
|
|
|
|
|
WEBRTC_RTCSTATS_DECL();
|
|
|
|
|
|
|
|
|
|
RTCTransportStats(const std::string& id, int64_t timestamp_us);
|
|
|
|
|
RTCTransportStats(std::string&& id, int64_t timestamp_us);
|
|
|
|
|
RTCTransportStats(const RTCTransportStats& other);
|
|
|
|
|
~RTCTransportStats() override;
|
|
|
|
|
|
|
|
|
|
RTCStatsMember<uint64_t> bytes_sent;
|
2020-07-06 16:06:37 +02:00
|
|
|
RTCStatsMember<uint64_t> packets_sent;
|
2016-10-24 04:00:05 -07:00
|
|
|
RTCStatsMember<uint64_t> bytes_received;
|
2020-07-06 16:06:37 +02:00
|
|
|
RTCStatsMember<uint64_t> packets_received;
|
2016-10-24 04:00:05 -07:00
|
|
|
RTCStatsMember<std::string> rtcp_transport_stats_id;
|
2022-06-13 10:23:28 +02:00
|
|
|
// Enum type RTCDtlsTransportState.
|
2017-01-16 07:38:02 -08:00
|
|
|
RTCStatsMember<std::string> dtls_state;
|
2016-10-24 04:00:05 -07:00
|
|
|
RTCStatsMember<std::string> selected_candidate_pair_id;
|
|
|
|
|
RTCStatsMember<std::string> local_certificate_id;
|
|
|
|
|
RTCStatsMember<std::string> remote_certificate_id;
|
2019-10-28 09:51:17 +01:00
|
|
|
RTCStatsMember<std::string> tls_version;
|
|
|
|
|
RTCStatsMember<std::string> dtls_cipher;
|
2022-04-22 15:46:24 +02:00
|
|
|
RTCStatsMember<std::string> dtls_role;
|
2019-10-28 09:51:17 +01:00
|
|
|
RTCStatsMember<std::string> srtp_cipher;
|
2019-08-28 08:10:27 +02:00
|
|
|
RTCStatsMember<uint32_t> selected_candidate_pair_changes;
|
2022-05-04 18:58:26 +02:00
|
|
|
RTCStatsMember<std::string> ice_role;
|
2022-05-05 07:53:54 +02:00
|
|
|
RTCStatsMember<std::string> ice_local_username_fragment;
|
2022-05-09 17:43:31 +02:00
|
|
|
RTCStatsMember<std::string> ice_state;
|
2016-10-24 04:00:05 -07:00
|
|
|
};
|
|
|
|
|
|
2016-08-30 14:04:35 -07:00
|
|
|
} // namespace webrtc
|
|
|
|
|
|
2017-09-15 06:47:31 +02:00
|
|
|
#endif // API_STATS_RTCSTATS_OBJECTS_H_
|