Replace use of PrintTo with AbslStringify for RTC stat types
This allows other tests using RTC stats to get pretty printing as well. Bug: webrtc:381524905 Change-Id: Ib1eb9e1dad36b89e5b1c2ec687fcfeb308f82939 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/370761 Reviewed-by: Evan Shrubsole <eshr@webrtc.org> Reviewed-by: Henrik Boström <hbos@webrtc.org> Reviewed-by: Harald Alvestrand <hta@webrtc.org> Commit-Queue: Evan Shrubsole <eshr@webrtc.org> Cr-Commit-Position: refs/heads/main@{#43575}
This commit is contained in:
parent
5c5bb5b099
commit
108cde271b
@ -14,18 +14,15 @@
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <optional>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#include "api/stats/attribute.h"
|
||||
#include "api/units/timestamp.h"
|
||||
#include "rtc_base/checks.h"
|
||||
#include "rtc_base/system/rtc_export.h"
|
||||
#include "rtc_base/system/rtc_export_template.h"
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
@ -150,7 +147,7 @@ class RTC_EXPORT RTCStats {
|
||||
// bar("bar") {
|
||||
// }
|
||||
//
|
||||
#define WEBRTC_RTCSTATS_DECL() \
|
||||
#define WEBRTC_RTCSTATS_DECL(SelfT) \
|
||||
protected: \
|
||||
std::vector<webrtc::Attribute> AttributesImpl(size_t additional_capacity) \
|
||||
const override; \
|
||||
@ -158,6 +155,11 @@ class RTC_EXPORT RTCStats {
|
||||
public: \
|
||||
static const char kType[]; \
|
||||
\
|
||||
template <typename Sink> \
|
||||
friend void AbslStringify(Sink& sink, const SelfT& stats) { \
|
||||
sink.Append(stats.ToJson()); \
|
||||
} \
|
||||
\
|
||||
std::unique_ptr<webrtc::RTCStats> copy() const override; \
|
||||
const char* type() const override
|
||||
|
||||
|
||||
@ -17,9 +17,9 @@
|
||||
#include <memory>
|
||||
#include <optional>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "api/stats/rtc_stats.h"
|
||||
#include "api/units/timestamp.h"
|
||||
#include "rtc_base/system/rtc_export.h"
|
||||
|
||||
namespace webrtc {
|
||||
@ -27,7 +27,7 @@ namespace webrtc {
|
||||
// https://w3c.github.io/webrtc-stats/#certificatestats-dict*
|
||||
class RTC_EXPORT RTCCertificateStats final : public RTCStats {
|
||||
public:
|
||||
WEBRTC_RTCSTATS_DECL();
|
||||
WEBRTC_RTCSTATS_DECL(RTCCertificateStats);
|
||||
RTCCertificateStats(std::string id, Timestamp timestamp);
|
||||
~RTCCertificateStats() override;
|
||||
|
||||
@ -40,7 +40,7 @@ class RTC_EXPORT RTCCertificateStats final : public RTCStats {
|
||||
// https://w3c.github.io/webrtc-stats/#codec-dict*
|
||||
class RTC_EXPORT RTCCodecStats final : public RTCStats {
|
||||
public:
|
||||
WEBRTC_RTCSTATS_DECL();
|
||||
WEBRTC_RTCSTATS_DECL(RTCCodecStats);
|
||||
RTCCodecStats(std::string id, Timestamp timestamp);
|
||||
~RTCCodecStats() override;
|
||||
|
||||
@ -55,7 +55,7 @@ class RTC_EXPORT RTCCodecStats final : public RTCStats {
|
||||
// https://w3c.github.io/webrtc-stats/#dcstats-dict*
|
||||
class RTC_EXPORT RTCDataChannelStats final : public RTCStats {
|
||||
public:
|
||||
WEBRTC_RTCSTATS_DECL();
|
||||
WEBRTC_RTCSTATS_DECL(RTCDataChannelStats);
|
||||
RTCDataChannelStats(std::string id, Timestamp timestamp);
|
||||
~RTCDataChannelStats() override;
|
||||
|
||||
@ -72,7 +72,7 @@ class RTC_EXPORT RTCDataChannelStats final : public RTCStats {
|
||||
// https://w3c.github.io/webrtc-stats/#candidatepair-dict*
|
||||
class RTC_EXPORT RTCIceCandidatePairStats final : public RTCStats {
|
||||
public:
|
||||
WEBRTC_RTCSTATS_DECL();
|
||||
WEBRTC_RTCSTATS_DECL(RTCIceCandidatePairStats);
|
||||
RTCIceCandidatePairStats(std::string id, Timestamp timestamp);
|
||||
~RTCIceCandidatePairStats() override;
|
||||
|
||||
@ -110,7 +110,7 @@ class RTC_EXPORT RTCIceCandidatePairStats final : public RTCStats {
|
||||
// https://w3c.github.io/webrtc-stats/#icecandidate-dict*
|
||||
class RTC_EXPORT RTCIceCandidateStats : public RTCStats {
|
||||
public:
|
||||
WEBRTC_RTCSTATS_DECL();
|
||||
WEBRTC_RTCSTATS_DECL(RTCIceCandidateStats);
|
||||
~RTCIceCandidateStats() override;
|
||||
|
||||
std::optional<std::string> transport_id;
|
||||
@ -165,7 +165,7 @@ class RTC_EXPORT RTCRemoteIceCandidateStats final
|
||||
// https://w3c.github.io/webrtc-stats/#pcstats-dict*
|
||||
class RTC_EXPORT RTCPeerConnectionStats final : public RTCStats {
|
||||
public:
|
||||
WEBRTC_RTCSTATS_DECL();
|
||||
WEBRTC_RTCSTATS_DECL(RTCPeerConnectionStats);
|
||||
RTCPeerConnectionStats(std::string id, Timestamp timestamp);
|
||||
~RTCPeerConnectionStats() override;
|
||||
|
||||
@ -176,7 +176,7 @@ class RTC_EXPORT RTCPeerConnectionStats final : public RTCStats {
|
||||
// https://w3c.github.io/webrtc-stats/#streamstats-dict*
|
||||
class RTC_EXPORT RTCRtpStreamStats : public RTCStats {
|
||||
public:
|
||||
WEBRTC_RTCSTATS_DECL();
|
||||
WEBRTC_RTCSTATS_DECL(RTCRtpStreamStats);
|
||||
~RTCRtpStreamStats() override;
|
||||
|
||||
std::optional<uint32_t> ssrc;
|
||||
@ -191,7 +191,7 @@ class RTC_EXPORT RTCRtpStreamStats : public RTCStats {
|
||||
// https://www.w3.org/TR/webrtc-stats/#receivedrtpstats-dict*
|
||||
class RTC_EXPORT RTCReceivedRtpStreamStats : public RTCRtpStreamStats {
|
||||
public:
|
||||
WEBRTC_RTCSTATS_DECL();
|
||||
WEBRTC_RTCSTATS_DECL(RTCReceivedRtpStreamStats);
|
||||
~RTCReceivedRtpStreamStats() override;
|
||||
|
||||
std::optional<double> jitter;
|
||||
@ -204,7 +204,7 @@ class RTC_EXPORT RTCReceivedRtpStreamStats : public RTCRtpStreamStats {
|
||||
// https://www.w3.org/TR/webrtc-stats/#sentrtpstats-dict*
|
||||
class RTC_EXPORT RTCSentRtpStreamStats : public RTCRtpStreamStats {
|
||||
public:
|
||||
WEBRTC_RTCSTATS_DECL();
|
||||
WEBRTC_RTCSTATS_DECL(RTCSentRtpStreamStats);
|
||||
~RTCSentRtpStreamStats() override;
|
||||
|
||||
std::optional<uint64_t> packets_sent;
|
||||
@ -218,7 +218,7 @@ class RTC_EXPORT RTCSentRtpStreamStats : public RTCRtpStreamStats {
|
||||
class RTC_EXPORT RTCInboundRtpStreamStats final
|
||||
: public RTCReceivedRtpStreamStats {
|
||||
public:
|
||||
WEBRTC_RTCSTATS_DECL();
|
||||
WEBRTC_RTCSTATS_DECL(RTCInboundRtpStreamStats);
|
||||
RTCInboundRtpStreamStats(std::string id, Timestamp timestamp);
|
||||
~RTCInboundRtpStreamStats() override;
|
||||
|
||||
@ -324,7 +324,7 @@ class RTC_EXPORT RTCInboundRtpStreamStats final
|
||||
class RTC_EXPORT RTCOutboundRtpStreamStats final
|
||||
: public RTCSentRtpStreamStats {
|
||||
public:
|
||||
WEBRTC_RTCSTATS_DECL();
|
||||
WEBRTC_RTCSTATS_DECL(RTCOutboundRtpStreamStats);
|
||||
RTCOutboundRtpStreamStats(std::string id, Timestamp timestamp);
|
||||
~RTCOutboundRtpStreamStats() override;
|
||||
|
||||
@ -374,7 +374,7 @@ class RTC_EXPORT RTCOutboundRtpStreamStats final
|
||||
class RTC_EXPORT RTCRemoteInboundRtpStreamStats final
|
||||
: public RTCReceivedRtpStreamStats {
|
||||
public:
|
||||
WEBRTC_RTCSTATS_DECL();
|
||||
WEBRTC_RTCSTATS_DECL(RTCRemoteInboundRtpStreamStats);
|
||||
RTCRemoteInboundRtpStreamStats(std::string id, Timestamp timestamp);
|
||||
~RTCRemoteInboundRtpStreamStats() override;
|
||||
|
||||
@ -389,7 +389,7 @@ class RTC_EXPORT RTCRemoteInboundRtpStreamStats final
|
||||
class RTC_EXPORT RTCRemoteOutboundRtpStreamStats final
|
||||
: public RTCSentRtpStreamStats {
|
||||
public:
|
||||
WEBRTC_RTCSTATS_DECL();
|
||||
WEBRTC_RTCSTATS_DECL(RTCRemoteOutboundRtpStreamStats);
|
||||
RTCRemoteOutboundRtpStreamStats(std::string id, Timestamp timestamp);
|
||||
~RTCRemoteOutboundRtpStreamStats() override;
|
||||
|
||||
@ -404,7 +404,7 @@ class RTC_EXPORT RTCRemoteOutboundRtpStreamStats final
|
||||
// https://w3c.github.io/webrtc-stats/#dom-rtcmediasourcestats
|
||||
class RTC_EXPORT RTCMediaSourceStats : public RTCStats {
|
||||
public:
|
||||
WEBRTC_RTCSTATS_DECL();
|
||||
WEBRTC_RTCSTATS_DECL(RTCMediaSourceStats);
|
||||
~RTCMediaSourceStats() override;
|
||||
|
||||
std::optional<std::string> track_identifier;
|
||||
@ -417,7 +417,7 @@ class RTC_EXPORT RTCMediaSourceStats : public RTCStats {
|
||||
// https://w3c.github.io/webrtc-stats/#dom-rtcaudiosourcestats
|
||||
class RTC_EXPORT RTCAudioSourceStats final : public RTCMediaSourceStats {
|
||||
public:
|
||||
WEBRTC_RTCSTATS_DECL();
|
||||
WEBRTC_RTCSTATS_DECL(RTCAudioSourceStats);
|
||||
RTCAudioSourceStats(std::string id, Timestamp timestamp);
|
||||
~RTCAudioSourceStats() override;
|
||||
|
||||
@ -431,7 +431,7 @@ class RTC_EXPORT RTCAudioSourceStats final : public RTCMediaSourceStats {
|
||||
// https://w3c.github.io/webrtc-stats/#dom-rtcvideosourcestats
|
||||
class RTC_EXPORT RTCVideoSourceStats final : public RTCMediaSourceStats {
|
||||
public:
|
||||
WEBRTC_RTCSTATS_DECL();
|
||||
WEBRTC_RTCSTATS_DECL(RTCVideoSourceStats);
|
||||
RTCVideoSourceStats(std::string id, Timestamp timestamp);
|
||||
~RTCVideoSourceStats() override;
|
||||
|
||||
@ -444,7 +444,7 @@ class RTC_EXPORT RTCVideoSourceStats final : public RTCMediaSourceStats {
|
||||
// https://w3c.github.io/webrtc-stats/#transportstats-dict*
|
||||
class RTC_EXPORT RTCTransportStats final : public RTCStats {
|
||||
public:
|
||||
WEBRTC_RTCSTATS_DECL();
|
||||
WEBRTC_RTCSTATS_DECL(RTCTransportStats);
|
||||
RTCTransportStats(std::string id, Timestamp timestamp);
|
||||
~RTCTransportStats() override;
|
||||
|
||||
@ -470,7 +470,7 @@ class RTC_EXPORT RTCTransportStats final : public RTCStats {
|
||||
// https://w3c.github.io/webrtc-stats/#playoutstats-dict*
|
||||
class RTC_EXPORT RTCAudioPlayoutStats final : public RTCStats {
|
||||
public:
|
||||
WEBRTC_RTCSTATS_DECL();
|
||||
WEBRTC_RTCSTATS_DECL(RTCAudioPlayoutStats);
|
||||
RTCAudioPlayoutStats(const std::string& id, Timestamp timestamp);
|
||||
~RTCAudioPlayoutStats() override;
|
||||
|
||||
|
||||
@ -2270,6 +2270,7 @@ if (rtc_include_tests && !build_with_chromium) {
|
||||
":media_stream",
|
||||
":peer_connection",
|
||||
":peer_connection_factory",
|
||||
":peer_connection_internal",
|
||||
":peer_connection_proxy",
|
||||
":proxy",
|
||||
":rtc_stats_collector",
|
||||
@ -2320,6 +2321,7 @@ if (rtc_include_tests && !build_with_chromium) {
|
||||
"../api:mock_video_track",
|
||||
"../api:packet_socket_factory",
|
||||
"../api:priority",
|
||||
"../api:ref_count",
|
||||
"../api:rtc_error",
|
||||
"../api:rtc_error_matchers",
|
||||
"../api:rtp_sender_interface",
|
||||
@ -2340,6 +2342,7 @@ if (rtc_include_tests && !build_with_chromium) {
|
||||
"../api/task_queue",
|
||||
"../api/task_queue:default_task_queue_factory",
|
||||
"../api/transport:datagram_transport_interface",
|
||||
"../api/transport:enums",
|
||||
"../api/transport:field_trial_based_config",
|
||||
"../api/transport:sctp_transport_factory_interface",
|
||||
"../api/transport/rtp:rtp_source",
|
||||
|
||||
@ -13,13 +13,11 @@
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include <algorithm>
|
||||
#include <initializer_list>
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <optional>
|
||||
#include <ostream>
|
||||
#include <string>
|
||||
#include <type_traits>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
@ -27,15 +25,24 @@
|
||||
#include "api/audio/audio_device.h"
|
||||
#include "api/audio/audio_processing_statistics.h"
|
||||
#include "api/candidate.h"
|
||||
#include "api/data_channel_interface.h"
|
||||
#include "api/dtls_transport_interface.h"
|
||||
#include "api/environment/environment.h"
|
||||
#include "api/environment/environment_factory.h"
|
||||
#include "api/make_ref_counted.h"
|
||||
#include "api/media_stream_interface.h"
|
||||
#include "api/media_stream_track.h"
|
||||
#include "api/media_types.h"
|
||||
#include "api/ref_count.h"
|
||||
#include "api/rtp_parameters.h"
|
||||
#include "api/rtp_transceiver_direction.h"
|
||||
#include "api/scoped_refptr.h"
|
||||
#include "api/stats/attribute.h"
|
||||
#include "api/stats/rtc_stats.h"
|
||||
#include "api/stats/rtc_stats_collector_callback.h"
|
||||
#include "api/stats/rtc_stats_report.h"
|
||||
#include "api/stats/rtcstats_objects.h"
|
||||
#include "api/transport/enums.h"
|
||||
#include "api/units/time_delta.h"
|
||||
#include "api/units/timestamp.h"
|
||||
#include "api/video/recordable_encoded_frame.h"
|
||||
@ -45,15 +52,20 @@
|
||||
#include "api/video/video_source_interface.h"
|
||||
#include "api/video/video_timing.h"
|
||||
#include "api/video_codecs/scalability_mode.h"
|
||||
#include "call/call.h"
|
||||
#include "common_video/include/quality_limitation_reason.h"
|
||||
#include "media/base/media_channel.h"
|
||||
#include "media/base/stream_params.h"
|
||||
#include "modules/rtp_rtcp/include/report_block_data.h"
|
||||
#include "modules/rtp_rtcp/include/rtp_rtcp_defines.h"
|
||||
#include "modules/rtp_rtcp/source/rtcp_packet/report_block.h"
|
||||
#include "p2p/base/connection_info.h"
|
||||
#include "p2p/base/ice_transport_internal.h"
|
||||
#include "p2p/base/p2p_constants.h"
|
||||
#include "p2p/base/port.h"
|
||||
#include "p2p/base/transport_description.h"
|
||||
#include "pc/media_stream.h"
|
||||
#include "pc/peer_connection_internal.h"
|
||||
#include "pc/sctp_data_channel.h"
|
||||
#include "pc/stream_collection.h"
|
||||
#include "pc/test/fake_data_channel_controller.h"
|
||||
#include "pc/test/fake_peer_connection_for_stats.h"
|
||||
@ -61,6 +73,7 @@
|
||||
#include "pc/test/mock_rtp_receiver_internal.h"
|
||||
#include "pc/test/mock_rtp_sender_internal.h"
|
||||
#include "pc/test/rtc_stats_obtainer.h"
|
||||
#include "pc/transport_stats.h"
|
||||
#include "rtc_base/checks.h"
|
||||
#include "rtc_base/fake_clock.h"
|
||||
#include "rtc_base/fake_ssl_identity.h"
|
||||
@ -75,70 +88,17 @@
|
||||
#include "rtc_base/string_encode.h"
|
||||
#include "rtc_base/strings/json.h"
|
||||
#include "rtc_base/synchronization/mutex.h"
|
||||
#include "rtc_base/thread.h"
|
||||
#include "rtc_base/time_utils.h"
|
||||
#include "test/gmock.h"
|
||||
#include "test/gtest.h"
|
||||
|
||||
using ::testing::_;
|
||||
using ::testing::AtLeast;
|
||||
using ::testing::Invoke;
|
||||
using ::testing::Return;
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
// These are used by gtest code, such as if `EXPECT_EQ` fails.
|
||||
void PrintTo(const RTCCertificateStats& stats, ::std::ostream* os) {
|
||||
*os << stats.ToJson();
|
||||
}
|
||||
|
||||
void PrintTo(const RTCCodecStats& stats, ::std::ostream* os) {
|
||||
*os << stats.ToJson();
|
||||
}
|
||||
|
||||
void PrintTo(const RTCDataChannelStats& stats, ::std::ostream* os) {
|
||||
*os << stats.ToJson();
|
||||
}
|
||||
|
||||
void PrintTo(const RTCIceCandidatePairStats& stats, ::std::ostream* os) {
|
||||
*os << stats.ToJson();
|
||||
}
|
||||
|
||||
void PrintTo(const RTCLocalIceCandidateStats& stats, ::std::ostream* os) {
|
||||
*os << stats.ToJson();
|
||||
}
|
||||
|
||||
void PrintTo(const RTCRemoteIceCandidateStats& stats, ::std::ostream* os) {
|
||||
*os << stats.ToJson();
|
||||
}
|
||||
|
||||
void PrintTo(const RTCPeerConnectionStats& stats, ::std::ostream* os) {
|
||||
*os << stats.ToJson();
|
||||
}
|
||||
|
||||
void PrintTo(const RTCInboundRtpStreamStats& stats, ::std::ostream* os) {
|
||||
*os << stats.ToJson();
|
||||
}
|
||||
|
||||
void PrintTo(const RTCOutboundRtpStreamStats& stats, ::std::ostream* os) {
|
||||
*os << stats.ToJson();
|
||||
}
|
||||
|
||||
void PrintTo(const RTCRemoteInboundRtpStreamStats& stats, ::std::ostream* os) {
|
||||
*os << stats.ToJson();
|
||||
}
|
||||
|
||||
void PrintTo(const RTCAudioSourceStats& stats, ::std::ostream* os) {
|
||||
*os << stats.ToJson();
|
||||
}
|
||||
|
||||
void PrintTo(const RTCVideoSourceStats& stats, ::std::ostream* os) {
|
||||
*os << stats.ToJson();
|
||||
}
|
||||
|
||||
void PrintTo(const RTCTransportStats& stats, ::std::ostream* os) {
|
||||
*os << stats.ToJson();
|
||||
}
|
||||
|
||||
namespace {
|
||||
|
||||
const int64_t kGetStatsReportTimeoutMs = 1000;
|
||||
@ -1831,29 +1791,29 @@ TEST_F(RTCStatsCollectorTest, CollectRTCIceCandidateStats) {
|
||||
a_transport_channel_stats.ice_transport_stats.connection_infos.push_back(
|
||||
cricket::ConnectionInfo());
|
||||
a_transport_channel_stats.ice_transport_stats.connection_infos[0]
|
||||
.local_candidate = *a_local_host.get();
|
||||
.local_candidate = *a_local_host;
|
||||
a_transport_channel_stats.ice_transport_stats.connection_infos[0]
|
||||
.remote_candidate = *a_remote_srflx.get();
|
||||
.remote_candidate = *a_remote_srflx;
|
||||
a_transport_channel_stats.ice_transport_stats.connection_infos.push_back(
|
||||
cricket::ConnectionInfo());
|
||||
a_transport_channel_stats.ice_transport_stats.connection_infos[1]
|
||||
.local_candidate = *a_local_prflx.get();
|
||||
.local_candidate = *a_local_prflx;
|
||||
a_transport_channel_stats.ice_transport_stats.connection_infos[1]
|
||||
.remote_candidate = *a_remote_relay.get();
|
||||
.remote_candidate = *a_remote_relay;
|
||||
a_transport_channel_stats.ice_transport_stats.connection_infos.push_back(
|
||||
cricket::ConnectionInfo());
|
||||
a_transport_channel_stats.ice_transport_stats.connection_infos[2]
|
||||
.local_candidate = *a_local_relay.get();
|
||||
.local_candidate = *a_local_relay;
|
||||
a_transport_channel_stats.ice_transport_stats.connection_infos[2]
|
||||
.remote_candidate = *a_remote_relay.get();
|
||||
.remote_candidate = *a_remote_relay;
|
||||
a_transport_channel_stats.ice_transport_stats.connection_infos.push_back(
|
||||
cricket::ConnectionInfo());
|
||||
a_transport_channel_stats.ice_transport_stats.connection_infos[3]
|
||||
.local_candidate = *a_local_relay_prflx.get();
|
||||
.local_candidate = *a_local_relay_prflx;
|
||||
a_transport_channel_stats.ice_transport_stats.connection_infos[3]
|
||||
.remote_candidate = *a_remote_relay.get();
|
||||
.remote_candidate = *a_remote_relay;
|
||||
a_transport_channel_stats.ice_transport_stats.candidate_stats_list.push_back(
|
||||
cricket::CandidateStats(*a_local_host_not_paired.get()));
|
||||
cricket::CandidateStats(*a_local_host_not_paired));
|
||||
|
||||
pc_->AddVoiceChannel("audio", "a");
|
||||
pc_->SetTransportStats("a", a_transport_channel_stats);
|
||||
@ -1862,9 +1822,9 @@ TEST_F(RTCStatsCollectorTest, CollectRTCIceCandidateStats) {
|
||||
b_transport_channel_stats.ice_transport_stats.connection_infos.push_back(
|
||||
cricket::ConnectionInfo());
|
||||
b_transport_channel_stats.ice_transport_stats.connection_infos[0]
|
||||
.local_candidate = *b_local.get();
|
||||
.local_candidate = *b_local;
|
||||
b_transport_channel_stats.ice_transport_stats.connection_infos[0]
|
||||
.remote_candidate = *b_remote.get();
|
||||
.remote_candidate = *b_remote;
|
||||
|
||||
pc_->AddVideoChannel("video", "b");
|
||||
pc_->SetTransportStats("b", b_transport_channel_stats);
|
||||
@ -1925,8 +1885,8 @@ TEST_F(RTCStatsCollectorTest, CollectRTCIceCandidatePairStats) {
|
||||
|
||||
cricket::ConnectionInfo connection_info;
|
||||
connection_info.best_connection = false;
|
||||
connection_info.local_candidate = *local_candidate.get();
|
||||
connection_info.remote_candidate = *remote_candidate.get();
|
||||
connection_info.local_candidate = *local_candidate;
|
||||
connection_info.remote_candidate = *remote_candidate;
|
||||
connection_info.writable = true;
|
||||
connection_info.sent_discarded_packets = 3;
|
||||
connection_info.sent_total_packets = 10;
|
||||
@ -2764,8 +2724,8 @@ TEST_F(RTCStatsCollectorTest, CollectRTCTransportStats) {
|
||||
|
||||
cricket::ConnectionInfo rtp_connection_info;
|
||||
rtp_connection_info.best_connection = false;
|
||||
rtp_connection_info.local_candidate = *rtp_local_candidate.get();
|
||||
rtp_connection_info.remote_candidate = *rtp_remote_candidate.get();
|
||||
rtp_connection_info.local_candidate = *rtp_local_candidate;
|
||||
rtp_connection_info.remote_candidate = *rtp_remote_candidate;
|
||||
rtp_connection_info.sent_total_bytes = 42;
|
||||
rtp_connection_info.recv_total_bytes = 1337;
|
||||
rtp_connection_info.sent_total_packets = 3;
|
||||
@ -2810,8 +2770,8 @@ TEST_F(RTCStatsCollectorTest, CollectRTCTransportStats) {
|
||||
|
||||
cricket::ConnectionInfo rtcp_connection_info;
|
||||
rtcp_connection_info.best_connection = false;
|
||||
rtcp_connection_info.local_candidate = *rtcp_local_candidate.get();
|
||||
rtcp_connection_info.remote_candidate = *rtcp_remote_candidate.get();
|
||||
rtcp_connection_info.local_candidate = *rtcp_local_candidate;
|
||||
rtcp_connection_info.remote_candidate = *rtcp_remote_candidate;
|
||||
rtcp_connection_info.sent_total_bytes = 1337;
|
||||
rtcp_connection_info.recv_total_bytes = 42;
|
||||
rtcp_connection_info.sent_total_packets = 3;
|
||||
@ -2936,8 +2896,8 @@ TEST_F(RTCStatsCollectorTest, CollectRTCTransportStatsWithCrypto) {
|
||||
|
||||
cricket::ConnectionInfo rtp_connection_info;
|
||||
rtp_connection_info.best_connection = false;
|
||||
rtp_connection_info.local_candidate = *rtp_local_candidate.get();
|
||||
rtp_connection_info.remote_candidate = *rtp_remote_candidate.get();
|
||||
rtp_connection_info.local_candidate = *rtp_local_candidate;
|
||||
rtp_connection_info.remote_candidate = *rtp_remote_candidate;
|
||||
cricket::TransportChannelStats rtp_transport_channel_stats;
|
||||
rtp_transport_channel_stats.component = cricket::ICE_CANDIDATE_COMPONENT_RTP;
|
||||
rtp_transport_channel_stats.ice_transport_stats.connection_infos.push_back(
|
||||
@ -3748,7 +3708,7 @@ TEST_F(RTCStatsCollectorTest, DoNotCrashWhenGetStatsCalledDuringCallback) {
|
||||
|
||||
class RTCTestStats : public RTCStats {
|
||||
public:
|
||||
WEBRTC_RTCSTATS_DECL();
|
||||
WEBRTC_RTCSTATS_DECL(RTCTestStats);
|
||||
|
||||
RTCTestStats(const std::string& id, Timestamp timestamp)
|
||||
: RTCStats(id, timestamp) {}
|
||||
|
||||
@ -15,7 +15,7 @@
|
||||
#include <vector>
|
||||
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "json/json.h"
|
||||
#include "json/json.h" // IWYU pragma: export
|
||||
|
||||
namespace rtc {
|
||||
|
||||
|
||||
@ -42,6 +42,7 @@ rtc_library("rtc_stats_test_utils") {
|
||||
deps = [
|
||||
":rtc_stats",
|
||||
"../api:rtc_stats_api",
|
||||
"../api/units:timestamp",
|
||||
"../rtc_base:checks",
|
||||
"../rtc_base/system:rtc_export",
|
||||
]
|
||||
@ -59,6 +60,8 @@ if (rtc_include_tests && !build_with_chromium) {
|
||||
":rtc_stats",
|
||||
":rtc_stats_test_utils",
|
||||
"../api:rtc_stats_api",
|
||||
"../api:scoped_refptr",
|
||||
"../api/units:timestamp",
|
||||
"../rtc_base:checks",
|
||||
"../rtc_base:gunit_helpers",
|
||||
"../rtc_base:rtc_json",
|
||||
|
||||
@ -10,18 +10,24 @@
|
||||
|
||||
#include "api/stats/rtc_stats_report.h"
|
||||
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
#include <memory>
|
||||
#include <optional>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "api/scoped_refptr.h"
|
||||
#include "api/stats/attribute.h"
|
||||
#include "api/stats/rtc_stats.h"
|
||||
#include "rtc_base/checks.h"
|
||||
#include "api/units/timestamp.h"
|
||||
#include "test/gtest.h"
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
class RTCTestStats1 : public RTCStats {
|
||||
public:
|
||||
WEBRTC_RTCSTATS_DECL();
|
||||
WEBRTC_RTCSTATS_DECL(RTCTestStats1);
|
||||
|
||||
RTCTestStats1(const std::string& id, Timestamp timestamp)
|
||||
: RTCStats(id, timestamp) {}
|
||||
@ -36,7 +42,7 @@ WEBRTC_RTCSTATS_IMPL(RTCTestStats1,
|
||||
|
||||
class RTCTestStats2 : public RTCStats {
|
||||
public:
|
||||
WEBRTC_RTCSTATS_DECL();
|
||||
WEBRTC_RTCSTATS_DECL(RTCTestStats2);
|
||||
|
||||
RTCTestStats2(const std::string& id, Timestamp timestamp)
|
||||
: RTCStats(id, timestamp) {}
|
||||
@ -51,7 +57,7 @@ WEBRTC_RTCSTATS_IMPL(RTCTestStats2,
|
||||
|
||||
class RTCTestStats3 : public RTCStats {
|
||||
public:
|
||||
WEBRTC_RTCSTATS_DECL();
|
||||
WEBRTC_RTCSTATS_DECL(RTCTestStats3);
|
||||
|
||||
RTCTestStats3(const std::string& id, Timestamp timestamp)
|
||||
: RTCStats(id, timestamp) {}
|
||||
|
||||
@ -14,8 +14,14 @@
|
||||
#include <cstdint>
|
||||
#include <cstring>
|
||||
#include <iostream>
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <optional>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "api/stats/attribute.h"
|
||||
#include "api/units/timestamp.h"
|
||||
#include "rtc_base/checks.h"
|
||||
#include "rtc_base/strings/json.h"
|
||||
#include "stats/test/rtc_test_stats.h"
|
||||
@ -42,7 +48,7 @@ double GetExpectedError(const double expected_value) {
|
||||
|
||||
class RTCChildStats : public RTCStats {
|
||||
public:
|
||||
WEBRTC_RTCSTATS_DECL();
|
||||
WEBRTC_RTCSTATS_DECL(RTCChildStats);
|
||||
|
||||
RTCChildStats(const std::string& id, Timestamp timestamp)
|
||||
: RTCStats(id, timestamp) {}
|
||||
@ -57,7 +63,7 @@ WEBRTC_RTCSTATS_IMPL(RTCChildStats,
|
||||
|
||||
class RTCGrandChildStats : public RTCChildStats {
|
||||
public:
|
||||
WEBRTC_RTCSTATS_DECL();
|
||||
WEBRTC_RTCSTATS_DECL(RTCGrandChildStats);
|
||||
|
||||
RTCGrandChildStats(const std::string& id, Timestamp timestamp)
|
||||
: RTCChildStats(id, timestamp) {}
|
||||
|
||||
@ -18,13 +18,14 @@
|
||||
#include <vector>
|
||||
|
||||
#include "api/stats/rtc_stats.h"
|
||||
#include "api/units/timestamp.h"
|
||||
#include "rtc_base/system/rtc_export.h"
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
class RTC_EXPORT RTCTestStats : public RTCStats {
|
||||
public:
|
||||
WEBRTC_RTCSTATS_DECL();
|
||||
WEBRTC_RTCSTATS_DECL(RTCTestStats);
|
||||
RTCTestStats(const std::string& id, Timestamp timestamp);
|
||||
~RTCTestStats() override;
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user