From d8bbc7858622b6d9c278469aab701ca0b609cddf Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 15 May 2024 05:35:49 +0200 Subject: Merging upstream version 126.0. Signed-off-by: Daniel Baumann --- .../libwebrtc/pc/rtc_stats_collector_unittest.cc | 36 +++++++++++++--------- 1 file changed, 22 insertions(+), 14 deletions(-) (limited to 'third_party/libwebrtc/pc/rtc_stats_collector_unittest.cc') diff --git a/third_party/libwebrtc/pc/rtc_stats_collector_unittest.cc b/third_party/libwebrtc/pc/rtc_stats_collector_unittest.cc index 055be6fe99..61b3bca1db 100644 --- a/third_party/libwebrtc/pc/rtc_stats_collector_unittest.cc +++ b/third_party/libwebrtc/pc/rtc_stats_collector_unittest.cc @@ -29,6 +29,7 @@ #include "api/media_stream_track.h" #include "api/rtp_parameters.h" #include "api/rtp_transceiver_direction.h" +#include "api/stats/attribute.h" #include "api/stats/rtc_stats.h" #include "api/stats/rtc_stats_report.h" #include "api/stats/rtcstats_objects.h" @@ -2303,7 +2304,7 @@ TEST_F(RTCStatsCollectorTest, CollectRTCInboundRtpStreamStats_Audio_PlayoutId) { ASSERT_TRUE(report->Get("ITTransportName1A1")); auto stats = report->Get("ITTransportName1A1")->cast_to(); - ASSERT_FALSE(stats.playout_id.is_defined()); + ASSERT_FALSE(stats.playout_id.has_value()); } { // We do expect a playout id when receiving. @@ -2314,7 +2315,7 @@ TEST_F(RTCStatsCollectorTest, CollectRTCInboundRtpStreamStats_Audio_PlayoutId) { ASSERT_TRUE(report->Get("ITTransportName1A1")); auto stats = report->Get("ITTransportName1A1")->cast_to(); - ASSERT_TRUE(stats.playout_id.is_defined()); + ASSERT_TRUE(stats.playout_id.has_value()); EXPECT_EQ(*stats.playout_id, "AP"); } } @@ -2478,6 +2479,10 @@ TEST_F(RTCStatsCollectorTest, CollectRTCAudioPlayoutStats) { audio_device_stats.total_playout_delay_s = 5; pc_->SetAudioDeviceStats(audio_device_stats); + pc_->AddVoiceChannel("AudioMid", "TransportName", {}); + stats_->SetupRemoteTrackAndReceiver( + cricket::MEDIA_TYPE_AUDIO, "RemoteAudioTrackID", "RemoteStreamId", 1); + rtc::scoped_refptr report = stats_->GetStatsReport(); auto stats_of_track_type = report->GetStatsOfType(); ASSERT_EQ(1U, stats_of_track_type.size()); @@ -2526,7 +2531,7 @@ TEST_F(RTCStatsCollectorTest, CollectGoogTimingFrameInfo) { rtc::scoped_refptr report = stats_->GetStatsReport(); auto inbound_rtps = report->GetStatsOfType(); ASSERT_EQ(inbound_rtps.size(), 1u); - ASSERT_TRUE(inbound_rtps[0]->goog_timing_frame_info.is_defined()); + ASSERT_TRUE(inbound_rtps[0]->goog_timing_frame_info.has_value()); EXPECT_EQ(*inbound_rtps[0]->goog_timing_frame_info, "1,2,3,4,5,6,7,8,9,10,11,12,13,1,0"); } @@ -3135,8 +3140,8 @@ TEST_F(RTCStatsCollectorTest, rtc::scoped_refptr report = stats_->GetStatsReport(); ASSERT_TRUE(report->Get("SV42")); auto video_stats = report->Get("SV42")->cast_to(); - EXPECT_FALSE(video_stats.frames_per_second.is_defined()); - EXPECT_FALSE(video_stats.frames.is_defined()); + EXPECT_FALSE(video_stats.frames_per_second.has_value()); + EXPECT_FALSE(video_stats.frames.has_value()); } // The track not having a source is not expected to be true in practise, but @@ -3165,8 +3170,8 @@ TEST_F(RTCStatsCollectorTest, rtc::scoped_refptr report = stats_->GetStatsReport(); ASSERT_TRUE(report->Get("SV42")); auto video_stats = report->Get("SV42")->cast_to(); - EXPECT_FALSE(video_stats.width.is_defined()); - EXPECT_FALSE(video_stats.height.is_defined()); + EXPECT_FALSE(video_stats.width.has_value()); + EXPECT_FALSE(video_stats.height.has_value()); } TEST_F(RTCStatsCollectorTest, @@ -3367,9 +3372,9 @@ TEST_P(RTCStatsCollectorTestWithParamKind, auto& remote_inbound_rtp = report->Get(remote_inbound_rtp_id) ->cast_to(); - EXPECT_TRUE(remote_inbound_rtp.round_trip_time_measurements.is_defined()); + EXPECT_TRUE(remote_inbound_rtp.round_trip_time_measurements.has_value()); EXPECT_EQ(0, *remote_inbound_rtp.round_trip_time_measurements); - EXPECT_FALSE(remote_inbound_rtp.round_trip_time.is_defined()); + EXPECT_FALSE(remote_inbound_rtp.round_trip_time.has_value()); } TEST_P(RTCStatsCollectorTestWithParamKind, @@ -3431,10 +3436,10 @@ TEST_P(RTCStatsCollectorTestWithParamKind, auto& remote_inbound_rtp = report->Get(remote_inbound_rtp_id) ->cast_to(); - EXPECT_TRUE(remote_inbound_rtp.codec_id.is_defined()); + EXPECT_TRUE(remote_inbound_rtp.codec_id.has_value()); EXPECT_TRUE(report->Get(*remote_inbound_rtp.codec_id)); - EXPECT_TRUE(remote_inbound_rtp.jitter.is_defined()); + EXPECT_TRUE(remote_inbound_rtp.jitter.has_value()); // The jitter (in seconds) is the report block's jitter divided by the codec's // clock rate. EXPECT_EQ(5.0, *remote_inbound_rtp.jitter); @@ -3471,7 +3476,7 @@ TEST_P(RTCStatsCollectorTestWithParamKind, auto& remote_inbound_rtp = report->Get(remote_inbound_rtp_id) ->cast_to(); - EXPECT_TRUE(remote_inbound_rtp.transport_id.is_defined()); + EXPECT_TRUE(remote_inbound_rtp.transport_id.has_value()); EXPECT_EQ("TTransportName2", // 2 for RTCP *remote_inbound_rtp.transport_id); EXPECT_TRUE(report->Get(*remote_inbound_rtp.transport_id)); @@ -3716,12 +3721,15 @@ class RTCTestStats : public RTCStats { WEBRTC_RTCSTATS_DECL(); RTCTestStats(const std::string& id, Timestamp timestamp) - : RTCStats(id, timestamp), dummy_stat("dummyStat") {} + : RTCStats(id, timestamp) {} RTCStatsMember dummy_stat; }; -WEBRTC_RTCSTATS_IMPL(RTCTestStats, RTCStats, "test-stats", &dummy_stat) +WEBRTC_RTCSTATS_IMPL(RTCTestStats, + RTCStats, + "test-stats", + AttributeInit("dummyStat", &dummy_stat)) // Overrides the stats collection to verify thread usage and that the resulting // partial reports are merged. -- cgit v1.2.3