mirror of
https://github.com/mollyim/webrtc.git
synced 2025-05-13 13:50:40 +01:00
Reland "[Stats] Remove enum-like structs in favor of strings."
This is a reland of commit ccc87ea3c6
Downstream project has been updated.
Original change's description:
> [Stats] Remove enum-like structs in favor of strings.
>
> Due to a limitation of RTCStatsMember<T> not supporting enums, as well
> as the fact that in JavaScript enums are represented as basic strings,
> the stats enums have always been represented by T=std::string.
>
> Now that we have WebIDL-ified[1] all RTCStats dictionaries and enum
> values are simply string-copied (example: [2]) it seems safe to assume
> that "stats enums are just strings" is here to stay.
>
> Therefore there is little value in having C++ structs that look like
> enums so I'm deleting those in favor of std::string operator==()
> comparisons, e.g. `if (rtp_stream.kind == "audio")`. This removes some
> lines of code from our code base.
>
> I mostly want to get rid of these because they were taking up about 20%
> of the rtcstats_objects.h real estate...
>
> [1] https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/modules/peerconnection/rtc_stats_report.idl
> [2] https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/modules/peerconnection/rtc_stats_report.cc;l=667;drc=cf34e84c9df94256abfb1716ba075ed203975755
>
> Bug: webrtc:15245
> Change-Id: Iaf0827d7aecebc1cc02976a61663d5298d684f07
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/308680
> Commit-Queue: Henrik Boström <hbos@webrtc.org>
> Reviewed-by: Harald Alvestrand <hta@webrtc.org>
> Cr-Commit-Position: refs/heads/main@{#40295}
Bug: webrtc:15245
Change-Id: Ibc7aeb518ed0bd7f1d725f140132c99e5a89bcf3
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/308880
Auto-Submit: Henrik Boström <hbos@webrtc.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#40305}
This commit is contained in:
parent
d05967cf4a
commit
c929ab49b9
8 changed files with 76 additions and 258 deletions
|
@ -23,99 +23,6 @@
|
||||||
|
|
||||||
namespace webrtc {
|
namespace webrtc {
|
||||||
|
|
||||||
// https://w3c.github.io/webrtc-pc/#idl-def-rtcdatachannelstate
|
|
||||||
struct RTCDataChannelState {
|
|
||||||
static const char* const kConnecting;
|
|
||||||
static const char* const kOpen;
|
|
||||||
static const char* const kClosing;
|
|
||||||
static const char* const kClosed;
|
|
||||||
};
|
|
||||||
|
|
||||||
// https://w3c.github.io/webrtc-stats/#dom-rtcstatsicecandidatepairstate
|
|
||||||
struct RTCStatsIceCandidatePairState {
|
|
||||||
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;
|
|
||||||
};
|
|
||||||
|
|
||||||
// https://w3c.github.io/webrtc-pc/#rtcicecandidatetype-enum
|
|
||||||
struct RTCIceCandidateType {
|
|
||||||
static const char* const kHost;
|
|
||||||
static const char* const kSrflx;
|
|
||||||
static const char* const kPrflx;
|
|
||||||
static const char* const kRelay;
|
|
||||||
};
|
|
||||||
|
|
||||||
// https://w3c.github.io/webrtc-pc/#idl-def-rtcdtlstransportstate
|
|
||||||
struct RTCDtlsTransportState {
|
|
||||||
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;
|
|
||||||
};
|
|
||||||
|
|
||||||
// `RTCRtpStreamStats::kind` is not an enum in the spec but the only valid
|
|
||||||
// values are "audio" and "video" as it comes from `MediaStreamTrack::kind`.
|
|
||||||
// https://w3c.github.io/webrtc-stats/#dom-rtcrtpstreamstats-kind
|
|
||||||
// https://w3c.github.io/mediacapture-main/#dom-mediadeviceinfo-kind
|
|
||||||
struct RTCMediaStreamTrackKind {
|
|
||||||
static const char* const kAudio;
|
|
||||||
static const char* const kVideo;
|
|
||||||
};
|
|
||||||
|
|
||||||
// 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;
|
|
||||||
};
|
|
||||||
|
|
||||||
// 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;
|
|
||||||
};
|
|
||||||
|
|
||||||
// https://webrtc.org/experiments/rtp-hdrext/video-content-type/
|
|
||||||
struct RTCContentType {
|
|
||||||
static const char* const kUnspecified;
|
|
||||||
static const char* const kScreenshare;
|
|
||||||
};
|
|
||||||
|
|
||||||
// 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;
|
|
||||||
};
|
|
||||||
|
|
||||||
// https://www.w3.org/TR/webrtc/#rtcicerole
|
|
||||||
struct RTCIceRole {
|
|
||||||
static const char* const kUnknown;
|
|
||||||
static const char* const kControlled;
|
|
||||||
static const char* const kControlling;
|
|
||||||
};
|
|
||||||
|
|
||||||
// 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;
|
|
||||||
};
|
|
||||||
|
|
||||||
// https://w3c.github.io/webrtc-stats/#certificatestats-dict*
|
// https://w3c.github.io/webrtc-stats/#certificatestats-dict*
|
||||||
class RTC_EXPORT RTCCertificateStats final : public RTCStats {
|
class RTC_EXPORT RTCCertificateStats final : public RTCStats {
|
||||||
public:
|
public:
|
||||||
|
@ -131,20 +38,6 @@ class RTC_EXPORT RTCCertificateStats final : public RTCStats {
|
||||||
RTCStatsMember<std::string> issuer_certificate_id;
|
RTCStatsMember<std::string> issuer_certificate_id;
|
||||||
};
|
};
|
||||||
|
|
||||||
// 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";
|
|
||||||
};
|
|
||||||
|
|
||||||
// https://w3c.github.io/webrtc-stats/#codec-dict*
|
// https://w3c.github.io/webrtc-stats/#codec-dict*
|
||||||
class RTC_EXPORT RTCCodecStats final : public RTCStats {
|
class RTC_EXPORT RTCCodecStats final : public RTCStats {
|
||||||
public:
|
public:
|
||||||
|
@ -174,7 +67,6 @@ class RTC_EXPORT RTCDataChannelStats final : public RTCStats {
|
||||||
RTCStatsMember<std::string> label;
|
RTCStatsMember<std::string> label;
|
||||||
RTCStatsMember<std::string> protocol;
|
RTCStatsMember<std::string> protocol;
|
||||||
RTCStatsMember<int32_t> data_channel_identifier;
|
RTCStatsMember<int32_t> data_channel_identifier;
|
||||||
// Enum type RTCDataChannelState.
|
|
||||||
RTCStatsMember<std::string> state;
|
RTCStatsMember<std::string> state;
|
||||||
RTCStatsMember<uint32_t> messages_sent;
|
RTCStatsMember<uint32_t> messages_sent;
|
||||||
RTCStatsMember<uint64_t> bytes_sent;
|
RTCStatsMember<uint64_t> bytes_sent;
|
||||||
|
@ -194,7 +86,6 @@ class RTC_EXPORT RTCIceCandidatePairStats final : public RTCStats {
|
||||||
RTCStatsMember<std::string> transport_id;
|
RTCStatsMember<std::string> transport_id;
|
||||||
RTCStatsMember<std::string> local_candidate_id;
|
RTCStatsMember<std::string> local_candidate_id;
|
||||||
RTCStatsMember<std::string> remote_candidate_id;
|
RTCStatsMember<std::string> remote_candidate_id;
|
||||||
// Enum type RTCStatsIceCandidatePairState.
|
|
||||||
RTCStatsMember<std::string> state;
|
RTCStatsMember<std::string> state;
|
||||||
// Obsolete: priority
|
// Obsolete: priority
|
||||||
RTCStatsMember<uint64_t> priority;
|
RTCStatsMember<uint64_t> priority;
|
||||||
|
@ -240,7 +131,6 @@ class RTC_EXPORT RTCIceCandidateStats : public RTCStats {
|
||||||
RTCStatsMember<int32_t> port;
|
RTCStatsMember<int32_t> port;
|
||||||
RTCStatsMember<std::string> protocol;
|
RTCStatsMember<std::string> protocol;
|
||||||
RTCStatsMember<std::string> relay_protocol;
|
RTCStatsMember<std::string> relay_protocol;
|
||||||
// Enum type RTCIceCandidateType.
|
|
||||||
RTCStatsMember<std::string> candidate_type;
|
RTCStatsMember<std::string> candidate_type;
|
||||||
RTCStatsMember<int32_t> priority;
|
RTCStatsMember<int32_t> priority;
|
||||||
RTCStatsMember<std::string> url;
|
RTCStatsMember<std::string> url;
|
||||||
|
@ -248,7 +138,6 @@ class RTC_EXPORT RTCIceCandidateStats : public RTCStats {
|
||||||
RTCStatsMember<std::string> related_address;
|
RTCStatsMember<std::string> related_address;
|
||||||
RTCStatsMember<int32_t> related_port;
|
RTCStatsMember<int32_t> related_port;
|
||||||
RTCStatsMember<std::string> username_fragment;
|
RTCStatsMember<std::string> username_fragment;
|
||||||
// Enum type RTCIceTcpCandidateType.
|
|
||||||
RTCStatsMember<std::string> tcp_type;
|
RTCStatsMember<std::string> tcp_type;
|
||||||
|
|
||||||
// The following metrics are NOT exposed to JavaScript. We should consider
|
// The following metrics are NOT exposed to JavaScript. We should consider
|
||||||
|
@ -459,7 +348,6 @@ class RTC_EXPORT RTCOutboundRtpStreamStats final
|
||||||
RTCStatsMember<uint32_t> frames_sent;
|
RTCStatsMember<uint32_t> frames_sent;
|
||||||
RTCStatsMember<uint32_t> huge_frames_sent;
|
RTCStatsMember<uint32_t> huge_frames_sent;
|
||||||
RTCStatsMember<double> total_packet_send_delay;
|
RTCStatsMember<double> total_packet_send_delay;
|
||||||
// Enum type RTCQualityLimitationReason
|
|
||||||
RTCStatsMember<std::string> quality_limitation_reason;
|
RTCStatsMember<std::string> quality_limitation_reason;
|
||||||
RTCStatsMember<std::map<std::string, double>> quality_limitation_durations;
|
RTCStatsMember<std::map<std::string, double>> quality_limitation_durations;
|
||||||
// https://w3c.github.io/webrtc-stats/#dom-rtcoutboundrtpstreamstats-qualitylimitationresolutionchanges
|
// https://w3c.github.io/webrtc-stats/#dom-rtcoutboundrtpstreamstats-qualitylimitationresolutionchanges
|
||||||
|
@ -576,7 +464,6 @@ class RTC_EXPORT RTCTransportStats final : public RTCStats {
|
||||||
RTCStatsMember<uint64_t> bytes_received;
|
RTCStatsMember<uint64_t> bytes_received;
|
||||||
RTCStatsMember<uint64_t> packets_received;
|
RTCStatsMember<uint64_t> packets_received;
|
||||||
RTCStatsMember<std::string> rtcp_transport_stats_id;
|
RTCStatsMember<std::string> rtcp_transport_stats_id;
|
||||||
// Enum type RTCDtlsTransportState.
|
|
||||||
RTCStatsMember<std::string> dtls_state;
|
RTCStatsMember<std::string> dtls_state;
|
||||||
RTCStatsMember<std::string> selected_candidate_pair_id;
|
RTCStatsMember<std::string> selected_candidate_pair_id;
|
||||||
RTCStatsMember<std::string> local_certificate_id;
|
RTCStatsMember<std::string> local_certificate_id;
|
||||||
|
|
|
@ -190,8 +190,8 @@ class PeerConnectionWrapperForBundleTest : public PeerConnectionWrapper {
|
||||||
for (auto* pair_stats :
|
for (auto* pair_stats :
|
||||||
report->GetStatsOfType<RTCIceCandidatePairStats>()) {
|
report->GetStatsOfType<RTCIceCandidatePairStats>()) {
|
||||||
if (*pair_stats->remote_candidate_id == matching_candidate_id) {
|
if (*pair_stats->remote_candidate_id == matching_candidate_id) {
|
||||||
if (*pair_stats->state == RTCStatsIceCandidatePairState::kInProgress ||
|
if (*pair_stats->state == "in-progress" ||
|
||||||
*pair_stats->state == RTCStatsIceCandidatePairState::kSucceeded) {
|
*pair_stats->state == "succeeded") {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -166,13 +166,13 @@ std::string RTCMediaSourceStatsIDFromKindAndAttachment(
|
||||||
|
|
||||||
const char* CandidateTypeToRTCIceCandidateType(const std::string& type) {
|
const char* CandidateTypeToRTCIceCandidateType(const std::string& type) {
|
||||||
if (type == cricket::LOCAL_PORT_TYPE)
|
if (type == cricket::LOCAL_PORT_TYPE)
|
||||||
return RTCIceCandidateType::kHost;
|
return "host";
|
||||||
if (type == cricket::STUN_PORT_TYPE)
|
if (type == cricket::STUN_PORT_TYPE)
|
||||||
return RTCIceCandidateType::kSrflx;
|
return "srflx";
|
||||||
if (type == cricket::PRFLX_PORT_TYPE)
|
if (type == cricket::PRFLX_PORT_TYPE)
|
||||||
return RTCIceCandidateType::kPrflx;
|
return "prflx";
|
||||||
if (type == cricket::RELAY_PORT_TYPE)
|
if (type == cricket::RELAY_PORT_TYPE)
|
||||||
return RTCIceCandidateType::kRelay;
|
return "relay";
|
||||||
RTC_DCHECK_NOTREACHED();
|
RTC_DCHECK_NOTREACHED();
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
@ -181,13 +181,13 @@ const char* DataStateToRTCDataChannelState(
|
||||||
DataChannelInterface::DataState state) {
|
DataChannelInterface::DataState state) {
|
||||||
switch (state) {
|
switch (state) {
|
||||||
case DataChannelInterface::kConnecting:
|
case DataChannelInterface::kConnecting:
|
||||||
return RTCDataChannelState::kConnecting;
|
return "connecting";
|
||||||
case DataChannelInterface::kOpen:
|
case DataChannelInterface::kOpen:
|
||||||
return RTCDataChannelState::kOpen;
|
return "open";
|
||||||
case DataChannelInterface::kClosing:
|
case DataChannelInterface::kClosing:
|
||||||
return RTCDataChannelState::kClosing;
|
return "closing";
|
||||||
case DataChannelInterface::kClosed:
|
case DataChannelInterface::kClosed:
|
||||||
return RTCDataChannelState::kClosed;
|
return "closed";
|
||||||
default:
|
default:
|
||||||
RTC_DCHECK_NOTREACHED();
|
RTC_DCHECK_NOTREACHED();
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
@ -198,13 +198,13 @@ const char* IceCandidatePairStateToRTCStatsIceCandidatePairState(
|
||||||
cricket::IceCandidatePairState state) {
|
cricket::IceCandidatePairState state) {
|
||||||
switch (state) {
|
switch (state) {
|
||||||
case cricket::IceCandidatePairState::WAITING:
|
case cricket::IceCandidatePairState::WAITING:
|
||||||
return RTCStatsIceCandidatePairState::kWaiting;
|
return "waiting";
|
||||||
case cricket::IceCandidatePairState::IN_PROGRESS:
|
case cricket::IceCandidatePairState::IN_PROGRESS:
|
||||||
return RTCStatsIceCandidatePairState::kInProgress;
|
return "in-progress";
|
||||||
case cricket::IceCandidatePairState::SUCCEEDED:
|
case cricket::IceCandidatePairState::SUCCEEDED:
|
||||||
return RTCStatsIceCandidatePairState::kSucceeded;
|
return "succeeded";
|
||||||
case cricket::IceCandidatePairState::FAILED:
|
case cricket::IceCandidatePairState::FAILED:
|
||||||
return RTCStatsIceCandidatePairState::kFailed;
|
return "failed";
|
||||||
default:
|
default:
|
||||||
RTC_DCHECK_NOTREACHED();
|
RTC_DCHECK_NOTREACHED();
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
@ -214,11 +214,11 @@ const char* IceCandidatePairStateToRTCStatsIceCandidatePairState(
|
||||||
const char* IceRoleToRTCIceRole(cricket::IceRole role) {
|
const char* IceRoleToRTCIceRole(cricket::IceRole role) {
|
||||||
switch (role) {
|
switch (role) {
|
||||||
case cricket::IceRole::ICEROLE_UNKNOWN:
|
case cricket::IceRole::ICEROLE_UNKNOWN:
|
||||||
return RTCIceRole::kUnknown;
|
return "unknown";
|
||||||
case cricket::IceRole::ICEROLE_CONTROLLED:
|
case cricket::IceRole::ICEROLE_CONTROLLED:
|
||||||
return RTCIceRole::kControlled;
|
return "controlled";
|
||||||
case cricket::IceRole::ICEROLE_CONTROLLING:
|
case cricket::IceRole::ICEROLE_CONTROLLING:
|
||||||
return RTCIceRole::kControlling;
|
return "controlling";
|
||||||
default:
|
default:
|
||||||
RTC_DCHECK_NOTREACHED();
|
RTC_DCHECK_NOTREACHED();
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
@ -229,15 +229,15 @@ const char* DtlsTransportStateToRTCDtlsTransportState(
|
||||||
DtlsTransportState state) {
|
DtlsTransportState state) {
|
||||||
switch (state) {
|
switch (state) {
|
||||||
case DtlsTransportState::kNew:
|
case DtlsTransportState::kNew:
|
||||||
return RTCDtlsTransportState::kNew;
|
return "new";
|
||||||
case DtlsTransportState::kConnecting:
|
case DtlsTransportState::kConnecting:
|
||||||
return RTCDtlsTransportState::kConnecting;
|
return "connecting";
|
||||||
case DtlsTransportState::kConnected:
|
case DtlsTransportState::kConnected:
|
||||||
return RTCDtlsTransportState::kConnected;
|
return "connected";
|
||||||
case DtlsTransportState::kClosed:
|
case DtlsTransportState::kClosed:
|
||||||
return RTCDtlsTransportState::kClosed;
|
return "closed";
|
||||||
case DtlsTransportState::kFailed:
|
case DtlsTransportState::kFailed:
|
||||||
return RTCDtlsTransportState::kFailed;
|
return "failed";
|
||||||
default:
|
default:
|
||||||
RTC_CHECK_NOTREACHED();
|
RTC_CHECK_NOTREACHED();
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
@ -247,19 +247,19 @@ const char* DtlsTransportStateToRTCDtlsTransportState(
|
||||||
const char* IceTransportStateToRTCIceTransportState(IceTransportState state) {
|
const char* IceTransportStateToRTCIceTransportState(IceTransportState state) {
|
||||||
switch (state) {
|
switch (state) {
|
||||||
case IceTransportState::kNew:
|
case IceTransportState::kNew:
|
||||||
return RTCIceTransportState::kNew;
|
return "new";
|
||||||
case IceTransportState::kChecking:
|
case IceTransportState::kChecking:
|
||||||
return RTCIceTransportState::kChecking;
|
return "checking";
|
||||||
case IceTransportState::kConnected:
|
case IceTransportState::kConnected:
|
||||||
return RTCIceTransportState::kConnected;
|
return "connected";
|
||||||
case IceTransportState::kCompleted:
|
case IceTransportState::kCompleted:
|
||||||
return RTCIceTransportState::kCompleted;
|
return "completed";
|
||||||
case IceTransportState::kFailed:
|
case IceTransportState::kFailed:
|
||||||
return RTCIceTransportState::kFailed;
|
return "failed";
|
||||||
case IceTransportState::kDisconnected:
|
case IceTransportState::kDisconnected:
|
||||||
return RTCIceTransportState::kDisconnected;
|
return "disconnected";
|
||||||
case IceTransportState::kClosed:
|
case IceTransportState::kClosed:
|
||||||
return RTCIceTransportState::kClosed;
|
return "closed";
|
||||||
default:
|
default:
|
||||||
RTC_CHECK_NOTREACHED();
|
RTC_CHECK_NOTREACHED();
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
@ -273,17 +273,17 @@ const char* NetworkTypeToStatsType(rtc::AdapterType type) {
|
||||||
case rtc::ADAPTER_TYPE_CELLULAR_3G:
|
case rtc::ADAPTER_TYPE_CELLULAR_3G:
|
||||||
case rtc::ADAPTER_TYPE_CELLULAR_4G:
|
case rtc::ADAPTER_TYPE_CELLULAR_4G:
|
||||||
case rtc::ADAPTER_TYPE_CELLULAR_5G:
|
case rtc::ADAPTER_TYPE_CELLULAR_5G:
|
||||||
return RTCNetworkType::kCellular;
|
return "cellular";
|
||||||
case rtc::ADAPTER_TYPE_ETHERNET:
|
case rtc::ADAPTER_TYPE_ETHERNET:
|
||||||
return RTCNetworkType::kEthernet;
|
return "ethernet";
|
||||||
case rtc::ADAPTER_TYPE_WIFI:
|
case rtc::ADAPTER_TYPE_WIFI:
|
||||||
return RTCNetworkType::kWifi;
|
return "wifi";
|
||||||
case rtc::ADAPTER_TYPE_VPN:
|
case rtc::ADAPTER_TYPE_VPN:
|
||||||
return RTCNetworkType::kVpn;
|
return "vpn";
|
||||||
case rtc::ADAPTER_TYPE_UNKNOWN:
|
case rtc::ADAPTER_TYPE_UNKNOWN:
|
||||||
case rtc::ADAPTER_TYPE_LOOPBACK:
|
case rtc::ADAPTER_TYPE_LOOPBACK:
|
||||||
case rtc::ADAPTER_TYPE_ANY:
|
case rtc::ADAPTER_TYPE_ANY:
|
||||||
return RTCNetworkType::kUnknown;
|
return "unknown";
|
||||||
}
|
}
|
||||||
RTC_DCHECK_NOTREACHED();
|
RTC_DCHECK_NOTREACHED();
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
@ -292,25 +292,25 @@ const char* NetworkTypeToStatsType(rtc::AdapterType type) {
|
||||||
absl::string_view NetworkTypeToStatsNetworkAdapterType(rtc::AdapterType type) {
|
absl::string_view NetworkTypeToStatsNetworkAdapterType(rtc::AdapterType type) {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case rtc::ADAPTER_TYPE_CELLULAR:
|
case rtc::ADAPTER_TYPE_CELLULAR:
|
||||||
return RTCNetworkAdapterType::kCellular;
|
return "cellular";
|
||||||
case rtc::ADAPTER_TYPE_CELLULAR_2G:
|
case rtc::ADAPTER_TYPE_CELLULAR_2G:
|
||||||
return RTCNetworkAdapterType::kCellular2g;
|
return "cellular2g";
|
||||||
case rtc::ADAPTER_TYPE_CELLULAR_3G:
|
case rtc::ADAPTER_TYPE_CELLULAR_3G:
|
||||||
return RTCNetworkAdapterType::kCellular3g;
|
return "cellular3g";
|
||||||
case rtc::ADAPTER_TYPE_CELLULAR_4G:
|
case rtc::ADAPTER_TYPE_CELLULAR_4G:
|
||||||
return RTCNetworkAdapterType::kCellular4g;
|
return "cellular4g";
|
||||||
case rtc::ADAPTER_TYPE_CELLULAR_5G:
|
case rtc::ADAPTER_TYPE_CELLULAR_5G:
|
||||||
return RTCNetworkAdapterType::kCellular5g;
|
return "cellular5g";
|
||||||
case rtc::ADAPTER_TYPE_ETHERNET:
|
case rtc::ADAPTER_TYPE_ETHERNET:
|
||||||
return RTCNetworkAdapterType::kEthernet;
|
return "ethernet";
|
||||||
case rtc::ADAPTER_TYPE_WIFI:
|
case rtc::ADAPTER_TYPE_WIFI:
|
||||||
return RTCNetworkAdapterType::kWifi;
|
return "wifi";
|
||||||
case rtc::ADAPTER_TYPE_UNKNOWN:
|
case rtc::ADAPTER_TYPE_UNKNOWN:
|
||||||
return RTCNetworkAdapterType::kUnknown;
|
return "unknown";
|
||||||
case rtc::ADAPTER_TYPE_LOOPBACK:
|
case rtc::ADAPTER_TYPE_LOOPBACK:
|
||||||
return RTCNetworkAdapterType::kLoopback;
|
return "loopback";
|
||||||
case rtc::ADAPTER_TYPE_ANY:
|
case rtc::ADAPTER_TYPE_ANY:
|
||||||
return RTCNetworkAdapterType::kAny;
|
return "any";
|
||||||
case rtc::ADAPTER_TYPE_VPN:
|
case rtc::ADAPTER_TYPE_VPN:
|
||||||
/* should not be handled here. Vpn is modelled as a bool */
|
/* should not be handled here. Vpn is modelled as a bool */
|
||||||
break;
|
break;
|
||||||
|
@ -323,13 +323,13 @@ const char* QualityLimitationReasonToRTCQualityLimitationReason(
|
||||||
QualityLimitationReason reason) {
|
QualityLimitationReason reason) {
|
||||||
switch (reason) {
|
switch (reason) {
|
||||||
case QualityLimitationReason::kNone:
|
case QualityLimitationReason::kNone:
|
||||||
return RTCQualityLimitationReason::kNone;
|
return "none";
|
||||||
case QualityLimitationReason::kCpu:
|
case QualityLimitationReason::kCpu:
|
||||||
return RTCQualityLimitationReason::kCpu;
|
return "cpu";
|
||||||
case QualityLimitationReason::kBandwidth:
|
case QualityLimitationReason::kBandwidth:
|
||||||
return RTCQualityLimitationReason::kBandwidth;
|
return "bandwidth";
|
||||||
case QualityLimitationReason::kOther:
|
case QualityLimitationReason::kOther:
|
||||||
return RTCQualityLimitationReason::kOther;
|
return "other";
|
||||||
}
|
}
|
||||||
RTC_CHECK_NOTREACHED();
|
RTC_CHECK_NOTREACHED();
|
||||||
}
|
}
|
||||||
|
@ -661,7 +661,7 @@ CreateInboundRTPStreamStatsFromVideoReceiverInfo(
|
||||||
// TODO(bugs.webrtc.org/10529): When info's `content_info` is optional
|
// TODO(bugs.webrtc.org/10529): When info's `content_info` is optional
|
||||||
// support the "unspecified" value.
|
// support the "unspecified" value.
|
||||||
if (video_receiver_info.content_type == VideoContentType::SCREENSHARE)
|
if (video_receiver_info.content_type == VideoContentType::SCREENSHARE)
|
||||||
inbound_video->content_type = RTCContentType::kScreenshare;
|
inbound_video->content_type = "screenshare";
|
||||||
if (!video_receiver_info.decoder_implementation_name.empty()) {
|
if (!video_receiver_info.decoder_implementation_name.empty()) {
|
||||||
inbound_video->decoder_implementation =
|
inbound_video->decoder_implementation =
|
||||||
video_receiver_info.decoder_implementation_name;
|
video_receiver_info.decoder_implementation_name;
|
||||||
|
@ -802,7 +802,7 @@ CreateOutboundRTPStreamStatsFromVideoSenderInfo(
|
||||||
// TODO(https://crbug.com/webrtc/10529): When info's `content_info` is
|
// TODO(https://crbug.com/webrtc/10529): When info's `content_info` is
|
||||||
// optional, support the "unspecified" value.
|
// optional, support the "unspecified" value.
|
||||||
if (video_sender_info.content_type == VideoContentType::SCREENSHARE)
|
if (video_sender_info.content_type == VideoContentType::SCREENSHARE)
|
||||||
outbound_video->content_type = RTCContentType::kScreenshare;
|
outbound_video->content_type = "screenshare";
|
||||||
if (!video_sender_info.encoder_implementation_name.empty()) {
|
if (!video_sender_info.encoder_implementation_name.empty()) {
|
||||||
outbound_video->encoder_implementation =
|
outbound_video->encoder_implementation =
|
||||||
video_sender_info.encoder_implementation_name;
|
video_sender_info.encoder_implementation_name;
|
||||||
|
@ -1918,11 +1918,10 @@ void RTCStatsCollector::ProduceTransportStats_n(
|
||||||
}
|
}
|
||||||
|
|
||||||
if (channel_stats.dtls_role) {
|
if (channel_stats.dtls_role) {
|
||||||
transport_stats->dtls_role = *channel_stats.dtls_role == rtc::SSL_CLIENT
|
transport_stats->dtls_role =
|
||||||
? webrtc::RTCDtlsRole::kClient
|
*channel_stats.dtls_role == rtc::SSL_CLIENT ? "client" : "server";
|
||||||
: webrtc::RTCDtlsRole::kServer;
|
|
||||||
} else {
|
} else {
|
||||||
transport_stats->dtls_role = webrtc::RTCDtlsRole::kUnknown;
|
transport_stats->dtls_role = "unknown";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (channel_stats.ssl_cipher_suite != rtc::kTlsNullWithNullNull &&
|
if (channel_stats.ssl_cipher_suite != rtc::kTlsNullWithNullNull &&
|
||||||
|
|
|
@ -1652,7 +1652,7 @@ TEST_F(RTCStatsCollectorTest, CollectRTCIceCandidateStats) {
|
||||||
expected_a_local_host.candidate_type = "host";
|
expected_a_local_host.candidate_type = "host";
|
||||||
expected_a_local_host.priority = 0;
|
expected_a_local_host.priority = 0;
|
||||||
expected_a_local_host.vpn = true;
|
expected_a_local_host.vpn = true;
|
||||||
expected_a_local_host.network_adapter_type = RTCNetworkAdapterType::kEthernet;
|
expected_a_local_host.network_adapter_type = "ethernet";
|
||||||
expected_a_local_host.foundation = "foundationIsAString";
|
expected_a_local_host.foundation = "foundationIsAString";
|
||||||
expected_a_local_host.username_fragment = "iceusernamefragment";
|
expected_a_local_host.username_fragment = "iceusernamefragment";
|
||||||
|
|
||||||
|
@ -1685,8 +1685,7 @@ TEST_F(RTCStatsCollectorTest, CollectRTCIceCandidateStats) {
|
||||||
expected_a_local_prflx.candidate_type = "prflx";
|
expected_a_local_prflx.candidate_type = "prflx";
|
||||||
expected_a_local_prflx.priority = 2;
|
expected_a_local_prflx.priority = 2;
|
||||||
expected_a_local_prflx.vpn = false;
|
expected_a_local_prflx.vpn = false;
|
||||||
expected_a_local_prflx.network_adapter_type =
|
expected_a_local_prflx.network_adapter_type = "cellular2g";
|
||||||
RTCNetworkAdapterType::kCellular2g;
|
|
||||||
expected_a_local_prflx.foundation = "foundationIsAString";
|
expected_a_local_prflx.foundation = "foundationIsAString";
|
||||||
expected_a_local_prflx.username_fragment = "iceusernamefragment";
|
expected_a_local_prflx.username_fragment = "iceusernamefragment";
|
||||||
|
|
||||||
|
@ -1724,7 +1723,7 @@ TEST_F(RTCStatsCollectorTest, CollectRTCIceCandidateStats) {
|
||||||
expected_a_local_relay.priority = 1;
|
expected_a_local_relay.priority = 1;
|
||||||
expected_a_local_relay.url = "turn:url1";
|
expected_a_local_relay.url = "turn:url1";
|
||||||
expected_a_local_relay.vpn = false;
|
expected_a_local_relay.vpn = false;
|
||||||
expected_a_local_relay.network_adapter_type = RTCNetworkAdapterType::kUnknown;
|
expected_a_local_relay.network_adapter_type = "unknown";
|
||||||
expected_a_local_relay.foundation = "foundationIsAString";
|
expected_a_local_relay.foundation = "foundationIsAString";
|
||||||
expected_a_local_relay.username_fragment = "iceusernamefragment";
|
expected_a_local_relay.username_fragment = "iceusernamefragment";
|
||||||
|
|
||||||
|
@ -1745,8 +1744,7 @@ TEST_F(RTCStatsCollectorTest, CollectRTCIceCandidateStats) {
|
||||||
expected_a_local_relay_prflx.candidate_type = "prflx";
|
expected_a_local_relay_prflx.candidate_type = "prflx";
|
||||||
expected_a_local_relay_prflx.priority = 1;
|
expected_a_local_relay_prflx.priority = 1;
|
||||||
expected_a_local_relay_prflx.vpn = false;
|
expected_a_local_relay_prflx.vpn = false;
|
||||||
expected_a_local_relay_prflx.network_adapter_type =
|
expected_a_local_relay_prflx.network_adapter_type = "unknown";
|
||||||
RTCNetworkAdapterType::kUnknown;
|
|
||||||
expected_a_local_relay_prflx.foundation = "foundationIsAString";
|
expected_a_local_relay_prflx.foundation = "foundationIsAString";
|
||||||
expected_a_local_relay_prflx.username_fragment = "iceusernamefragment";
|
expected_a_local_relay_prflx.username_fragment = "iceusernamefragment";
|
||||||
|
|
||||||
|
@ -1767,8 +1765,7 @@ TEST_F(RTCStatsCollectorTest, CollectRTCIceCandidateStats) {
|
||||||
expected_a_local_host_not_paired.candidate_type = "host";
|
expected_a_local_host_not_paired.candidate_type = "host";
|
||||||
expected_a_local_host_not_paired.priority = 0;
|
expected_a_local_host_not_paired.priority = 0;
|
||||||
expected_a_local_host_not_paired.vpn = true;
|
expected_a_local_host_not_paired.vpn = true;
|
||||||
expected_a_local_host_not_paired.network_adapter_type =
|
expected_a_local_host_not_paired.network_adapter_type = "ethernet";
|
||||||
RTCNetworkAdapterType::kEthernet;
|
|
||||||
expected_a_local_host_not_paired.foundation = "foundationIsAString";
|
expected_a_local_host_not_paired.foundation = "foundationIsAString";
|
||||||
expected_a_local_host_not_paired.username_fragment = "iceusernamefragment";
|
expected_a_local_host_not_paired.username_fragment = "iceusernamefragment";
|
||||||
|
|
||||||
|
@ -1787,7 +1784,7 @@ TEST_F(RTCStatsCollectorTest, CollectRTCIceCandidateStats) {
|
||||||
expected_b_local.candidate_type = "host";
|
expected_b_local.candidate_type = "host";
|
||||||
expected_b_local.priority = 42;
|
expected_b_local.priority = 42;
|
||||||
expected_b_local.vpn = false;
|
expected_b_local.vpn = false;
|
||||||
expected_b_local.network_adapter_type = RTCNetworkAdapterType::kWifi;
|
expected_b_local.network_adapter_type = "wifi";
|
||||||
expected_b_local.foundation = "foundationIsAString";
|
expected_b_local.foundation = "foundationIsAString";
|
||||||
expected_b_local.username_fragment = "iceusernamefragment";
|
expected_b_local.username_fragment = "iceusernamefragment";
|
||||||
|
|
||||||
|
@ -1944,7 +1941,7 @@ TEST_F(RTCStatsCollectorTest, CollectRTCIceCandidatePairStats) {
|
||||||
"Ttransport" + rtc::ToString(cricket::ICE_CANDIDATE_COMPONENT_RTP);
|
"Ttransport" + rtc::ToString(cricket::ICE_CANDIDATE_COMPONENT_RTP);
|
||||||
expected_pair.local_candidate_id = "I" + local_candidate->id();
|
expected_pair.local_candidate_id = "I" + local_candidate->id();
|
||||||
expected_pair.remote_candidate_id = "I" + remote_candidate->id();
|
expected_pair.remote_candidate_id = "I" + remote_candidate->id();
|
||||||
expected_pair.state = RTCStatsIceCandidatePairState::kInProgress;
|
expected_pair.state = "in-progress";
|
||||||
expected_pair.priority = 5555;
|
expected_pair.priority = 5555;
|
||||||
expected_pair.nominated = false;
|
expected_pair.nominated = false;
|
||||||
expected_pair.writable = true;
|
expected_pair.writable = true;
|
||||||
|
@ -2043,7 +2040,7 @@ TEST_F(RTCStatsCollectorTest, CollectRTCIceCandidatePairStats) {
|
||||||
expected_local_candidate.foundation = "foundationIsAString";
|
expected_local_candidate.foundation = "foundationIsAString";
|
||||||
expected_local_candidate.username_fragment = "local_iceusernamefragment";
|
expected_local_candidate.username_fragment = "local_iceusernamefragment";
|
||||||
expected_local_candidate.vpn = false;
|
expected_local_candidate.vpn = false;
|
||||||
expected_local_candidate.network_adapter_type = RTCNetworkAdapterType::kWifi;
|
expected_local_candidate.network_adapter_type = "wifi";
|
||||||
ASSERT_TRUE(report->Get(expected_local_candidate.id()));
|
ASSERT_TRUE(report->Get(expected_local_candidate.id()));
|
||||||
EXPECT_EQ(expected_local_candidate,
|
EXPECT_EQ(expected_local_candidate,
|
||||||
report->Get(expected_local_candidate.id())
|
report->Get(expected_local_candidate.id())
|
||||||
|
@ -2751,12 +2748,12 @@ TEST_F(RTCStatsCollectorTest, CollectRTCTransportStats) {
|
||||||
expected_rtp_transport.packets_sent = 1;
|
expected_rtp_transport.packets_sent = 1;
|
||||||
expected_rtp_transport.bytes_received = 1337;
|
expected_rtp_transport.bytes_received = 1337;
|
||||||
expected_rtp_transport.packets_received = 4;
|
expected_rtp_transport.packets_received = 4;
|
||||||
expected_rtp_transport.dtls_state = RTCDtlsTransportState::kNew;
|
expected_rtp_transport.dtls_state = "new";
|
||||||
expected_rtp_transport.dtls_role = RTCDtlsRole::kUnknown;
|
expected_rtp_transport.dtls_role = "unknown";
|
||||||
expected_rtp_transport.selected_candidate_pair_changes = 1;
|
expected_rtp_transport.selected_candidate_pair_changes = 1;
|
||||||
expected_rtp_transport.ice_role = RTCIceRole::kUnknown;
|
expected_rtp_transport.ice_role = "unknown";
|
||||||
expected_rtp_transport.ice_local_username_fragment = "thelocalufrag";
|
expected_rtp_transport.ice_local_username_fragment = "thelocalufrag";
|
||||||
expected_rtp_transport.ice_state = RTCIceTransportState::kNew;
|
expected_rtp_transport.ice_state = "new";
|
||||||
|
|
||||||
ASSERT_TRUE(report->Get(expected_rtp_transport.id()));
|
ASSERT_TRUE(report->Get(expected_rtp_transport.id()));
|
||||||
EXPECT_EQ(
|
EXPECT_EQ(
|
||||||
|
@ -2799,12 +2796,12 @@ TEST_F(RTCStatsCollectorTest, CollectRTCTransportStats) {
|
||||||
expected_rtcp_transport.packets_sent = 1;
|
expected_rtcp_transport.packets_sent = 1;
|
||||||
expected_rtcp_transport.bytes_received = 42;
|
expected_rtcp_transport.bytes_received = 42;
|
||||||
expected_rtcp_transport.packets_received = 4;
|
expected_rtcp_transport.packets_received = 4;
|
||||||
expected_rtcp_transport.dtls_state = RTCDtlsTransportState::kConnecting;
|
expected_rtcp_transport.dtls_state = "connecting";
|
||||||
expected_rtcp_transport.dtls_role = RTCDtlsRole::kUnknown;
|
expected_rtcp_transport.dtls_role = "unknown";
|
||||||
expected_rtcp_transport.selected_candidate_pair_changes = 0;
|
expected_rtcp_transport.selected_candidate_pair_changes = 0;
|
||||||
expected_rtcp_transport.ice_role = RTCIceRole::kUnknown;
|
expected_rtcp_transport.ice_role = "unknown";
|
||||||
expected_rtcp_transport.ice_local_username_fragment = "thelocalufrag";
|
expected_rtcp_transport.ice_local_username_fragment = "thelocalufrag";
|
||||||
expected_rtcp_transport.ice_state = RTCIceTransportState::kChecking;
|
expected_rtcp_transport.ice_state = "checking";
|
||||||
|
|
||||||
expected_rtp_transport.rtcp_transport_stats_id = expected_rtcp_transport.id();
|
expected_rtp_transport.rtcp_transport_stats_id = expected_rtcp_transport.id();
|
||||||
ASSERT_TRUE(report->Get(expected_rtp_transport.id()));
|
ASSERT_TRUE(report->Get(expected_rtp_transport.id()));
|
||||||
|
@ -2920,19 +2917,19 @@ TEST_F(RTCStatsCollectorTest, CollectRTCTransportStatsWithCrypto) {
|
||||||
RTCTransportStats expected_rtp_transport(
|
RTCTransportStats expected_rtp_transport(
|
||||||
"Ttransport" + rtc::ToString(cricket::ICE_CANDIDATE_COMPONENT_RTP),
|
"Ttransport" + rtc::ToString(cricket::ICE_CANDIDATE_COMPONENT_RTP),
|
||||||
report->timestamp());
|
report->timestamp());
|
||||||
expected_rtp_transport.dtls_state = RTCDtlsTransportState::kConnected;
|
expected_rtp_transport.dtls_state = "connected";
|
||||||
expected_rtp_transport.selected_candidate_pair_changes = 1;
|
expected_rtp_transport.selected_candidate_pair_changes = 1;
|
||||||
expected_rtp_transport.ice_role = RTCIceRole::kUnknown;
|
expected_rtp_transport.ice_role = "unknown";
|
||||||
expected_rtp_transport.bytes_sent = 0;
|
expected_rtp_transport.bytes_sent = 0;
|
||||||
expected_rtp_transport.bytes_received = 0;
|
expected_rtp_transport.bytes_received = 0;
|
||||||
expected_rtp_transport.packets_sent = 0;
|
expected_rtp_transport.packets_sent = 0;
|
||||||
expected_rtp_transport.packets_received = 0;
|
expected_rtp_transport.packets_received = 0;
|
||||||
expected_rtp_transport.ice_role = RTCIceRole::kControlling;
|
expected_rtp_transport.ice_role = "controlling";
|
||||||
expected_rtp_transport.ice_local_username_fragment = "thelocalufrag";
|
expected_rtp_transport.ice_local_username_fragment = "thelocalufrag";
|
||||||
expected_rtp_transport.ice_state = "connected";
|
expected_rtp_transport.ice_state = "connected";
|
||||||
// Crypto parameters
|
// Crypto parameters
|
||||||
expected_rtp_transport.tls_version = "0203";
|
expected_rtp_transport.tls_version = "0203";
|
||||||
expected_rtp_transport.dtls_role = RTCDtlsRole::kClient;
|
expected_rtp_transport.dtls_role = "client";
|
||||||
expected_rtp_transport.dtls_cipher = "TLS_RSA_WITH_AES_128_CBC_SHA";
|
expected_rtp_transport.dtls_cipher = "TLS_RSA_WITH_AES_128_CBC_SHA";
|
||||||
expected_rtp_transport.srtp_cipher = "AES_CM_128_HMAC_SHA1_80";
|
expected_rtp_transport.srtp_cipher = "AES_CM_128_HMAC_SHA1_80";
|
||||||
|
|
||||||
|
|
|
@ -17,70 +17,6 @@
|
||||||
|
|
||||||
namespace webrtc {
|
namespace webrtc {
|
||||||
|
|
||||||
const char* const RTCDataChannelState::kConnecting = "connecting";
|
|
||||||
const char* const RTCDataChannelState::kOpen = "open";
|
|
||||||
const char* const RTCDataChannelState::kClosing = "closing";
|
|
||||||
const char* const RTCDataChannelState::kClosed = "closed";
|
|
||||||
|
|
||||||
const char* const RTCStatsIceCandidatePairState::kFrozen = "frozen";
|
|
||||||
const char* const RTCStatsIceCandidatePairState::kWaiting = "waiting";
|
|
||||||
const char* const RTCStatsIceCandidatePairState::kInProgress = "in-progress";
|
|
||||||
const char* const RTCStatsIceCandidatePairState::kFailed = "failed";
|
|
||||||
const char* const RTCStatsIceCandidatePairState::kSucceeded = "succeeded";
|
|
||||||
|
|
||||||
// Strings defined in https://tools.ietf.org/html/rfc5245.
|
|
||||||
const char* const RTCIceCandidateType::kHost = "host";
|
|
||||||
const char* const RTCIceCandidateType::kSrflx = "srflx";
|
|
||||||
const char* const RTCIceCandidateType::kPrflx = "prflx";
|
|
||||||
const char* const RTCIceCandidateType::kRelay = "relay";
|
|
||||||
|
|
||||||
const char* const RTCDtlsTransportState::kNew = "new";
|
|
||||||
const char* const RTCDtlsTransportState::kConnecting = "connecting";
|
|
||||||
const char* const RTCDtlsTransportState::kConnected = "connected";
|
|
||||||
const char* const RTCDtlsTransportState::kClosed = "closed";
|
|
||||||
const char* const RTCDtlsTransportState::kFailed = "failed";
|
|
||||||
|
|
||||||
const char* const RTCMediaStreamTrackKind::kAudio = "audio";
|
|
||||||
const char* const RTCMediaStreamTrackKind::kVideo = "video";
|
|
||||||
|
|
||||||
// https://w3c.github.io/webrtc-stats/#dom-rtcnetworktype
|
|
||||||
const char* const RTCNetworkType::kBluetooth = "bluetooth";
|
|
||||||
const char* const RTCNetworkType::kCellular = "cellular";
|
|
||||||
const char* const RTCNetworkType::kEthernet = "ethernet";
|
|
||||||
const char* const RTCNetworkType::kWifi = "wifi";
|
|
||||||
const char* const RTCNetworkType::kWimax = "wimax";
|
|
||||||
const char* const RTCNetworkType::kVpn = "vpn";
|
|
||||||
const char* const RTCNetworkType::kUnknown = "unknown";
|
|
||||||
|
|
||||||
// https://w3c.github.io/webrtc-stats/#dom-rtcqualitylimitationreason
|
|
||||||
const char* const RTCQualityLimitationReason::kNone = "none";
|
|
||||||
const char* const RTCQualityLimitationReason::kCpu = "cpu";
|
|
||||||
const char* const RTCQualityLimitationReason::kBandwidth = "bandwidth";
|
|
||||||
const char* const RTCQualityLimitationReason::kOther = "other";
|
|
||||||
|
|
||||||
// https://webrtc.org/experiments/rtp-hdrext/video-content-type/
|
|
||||||
const char* const RTCContentType::kUnspecified = "unspecified";
|
|
||||||
const char* const RTCContentType::kScreenshare = "screenshare";
|
|
||||||
|
|
||||||
// https://w3c.github.io/webrtc-stats/#dom-rtcdtlsrole
|
|
||||||
const char* const RTCDtlsRole::kUnknown = "unknown";
|
|
||||||
const char* const RTCDtlsRole::kClient = "client";
|
|
||||||
const char* const RTCDtlsRole::kServer = "server";
|
|
||||||
|
|
||||||
// https://www.w3.org/TR/webrtc/#rtcicerole
|
|
||||||
const char* const RTCIceRole::kUnknown = "unknown";
|
|
||||||
const char* const RTCIceRole::kControlled = "controlled";
|
|
||||||
const char* const RTCIceRole::kControlling = "controlling";
|
|
||||||
|
|
||||||
// https://www.w3.org/TR/webrtc/#dom-rtcicetransportstate
|
|
||||||
const char* const RTCIceTransportState::kNew = "new";
|
|
||||||
const char* const RTCIceTransportState::kChecking = "checking";
|
|
||||||
const char* const RTCIceTransportState::kConnected = "connected";
|
|
||||||
const char* const RTCIceTransportState::kCompleted = "completed";
|
|
||||||
const char* const RTCIceTransportState::kDisconnected = "disconnected";
|
|
||||||
const char* const RTCIceTransportState::kFailed = "failed";
|
|
||||||
const char* const RTCIceTransportState::kClosed = "closed";
|
|
||||||
|
|
||||||
// clang-format off
|
// clang-format off
|
||||||
WEBRTC_RTCSTATS_IMPL(RTCCertificateStats, RTCStats, "certificate",
|
WEBRTC_RTCSTATS_IMPL(RTCCertificateStats, RTCStats, "certificate",
|
||||||
&fingerprint,
|
&fingerprint,
|
||||||
|
|
|
@ -42,8 +42,7 @@ void DefaultAudioQualityAnalyzer::OnStatsReports(
|
||||||
auto stats = report->GetStatsOfType<RTCInboundRtpStreamStats>();
|
auto stats = report->GetStatsOfType<RTCInboundRtpStreamStats>();
|
||||||
|
|
||||||
for (auto& stat : stats) {
|
for (auto& stat : stats) {
|
||||||
if (!stat->kind.is_defined() ||
|
if (!stat->kind.is_defined() || !(*stat->kind == "audio")) {
|
||||||
!(*stat->kind == RTCMediaStreamTrackKind::kAudio)) {
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -74,7 +74,7 @@ void VideoQualityMetricsReporter::OnStatsReports(
|
||||||
if (!s->kind.is_defined()) {
|
if (!s->kind.is_defined()) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (!(*s->kind == RTCMediaStreamTrackKind::kVideo)) {
|
if (!(*s->kind == "video")) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (s->timestamp() > sample.sample_time) {
|
if (s->timestamp() > sample.sample_time) {
|
||||||
|
|
|
@ -71,7 +71,7 @@ void CrossMediaMetricsReporter::OnStatsReports(
|
||||||
*audio_stat->kind != *video_stat->kind)
|
*audio_stat->kind != *video_stat->kind)
|
||||||
<< "Sync group should consist of one audio and one video stream.";
|
<< "Sync group should consist of one audio and one video stream.";
|
||||||
|
|
||||||
if (*audio_stat->kind == RTCMediaStreamTrackKind::kVideo) {
|
if (*audio_stat->kind == "video") {
|
||||||
std::swap(audio_stat, video_stat);
|
std::swap(audio_stat, video_stat);
|
||||||
}
|
}
|
||||||
// Stream labels of a sync group are same for all polls, so we need it add
|
// Stream labels of a sync group are same for all polls, so we need it add
|
||||||
|
|
Loading…
Reference in a new issue