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 --- third_party/libwebrtc/test/pc/e2e/BUILD.gn | 3 +-- .../audio/default_audio_quality_analyzer.cc | 24 ++++++++++------------ .../video/video_quality_metrics_reporter.cc | 16 ++++++++------- .../test/pc/e2e/cross_media_metrics_reporter.cc | 12 +++++------ .../pc/e2e/network_quality_metrics_reporter.cc | 9 ++++---- .../test/pc/e2e/peer_connection_quality_test.cc | 2 +- ...stats_based_network_quality_metrics_reporter.cc | 18 ++++++++-------- .../libwebrtc/test/pc/e2e/test_peer_factory.cc | 9 ++++---- .../libwebrtc/test/pc/e2e/test_peer_factory.h | 6 +++--- 9 files changed, 47 insertions(+), 52 deletions(-) (limited to 'third_party/libwebrtc/test/pc/e2e') diff --git a/third_party/libwebrtc/test/pc/e2e/BUILD.gn b/third_party/libwebrtc/test/pc/e2e/BUILD.gn index 9d1c1d437f..0eb7aa2c68 100644 --- a/third_party/libwebrtc/test/pc/e2e/BUILD.gn +++ b/third_party/libwebrtc/test/pc/e2e/BUILD.gn @@ -99,6 +99,7 @@ if (!build_with_chromium) { "../../../api:enable_media_with_defaults", "../../../api:time_controller", "../../../api/rtc_event_log:rtc_event_log_factory", + "../../../api/task_queue", "../../../api/task_queue:default_task_queue_factory", "../../../api/test/pclf:media_configuration", "../../../api/test/pclf:media_quality_test_params", @@ -109,7 +110,6 @@ if (!build_with_chromium) { "../../../modules/audio_device:test_audio_device_module", "../../../modules/audio_processing/aec_dump", "../../../p2p:rtc_p2p", - "../../../rtc_base:rtc_task_queue", "../../../rtc_base:threading", "analyzer/video:quality_analyzing_video_encoder", "analyzer/video:video_quality_analyzer_injection_helper", @@ -286,7 +286,6 @@ if (!build_with_chromium) { ":default_audio_quality_analyzer", ":network_quality_metrics_reporter", ":stats_based_network_quality_metrics_reporter", - "../../../api:callfactory_api", "../../../api:create_network_emulation_manager", "../../../api:create_peer_connection_quality_test_frame_generator", "../../../api:create_peerconnection_quality_test_fixture", diff --git a/third_party/libwebrtc/test/pc/e2e/analyzer/audio/default_audio_quality_analyzer.cc b/third_party/libwebrtc/test/pc/e2e/analyzer/audio/default_audio_quality_analyzer.cc index bca52d9bfc..93d8906d6a 100644 --- a/third_party/libwebrtc/test/pc/e2e/analyzer/audio/default_audio_quality_analyzer.cc +++ b/third_party/libwebrtc/test/pc/e2e/analyzer/audio/default_audio_quality_analyzer.cc @@ -42,29 +42,27 @@ void DefaultAudioQualityAnalyzer::OnStatsReports( auto stats = report->GetStatsOfType(); for (auto& stat : stats) { - if (!stat->kind.is_defined() || !(*stat->kind == "audio")) { + if (!stat->kind.has_value() || !(*stat->kind == "audio")) { continue; } StatsSample sample; - sample.total_samples_received = - stat->total_samples_received.ValueOrDefault(0ul); - sample.concealed_samples = stat->concealed_samples.ValueOrDefault(0ul); + sample.total_samples_received = stat->total_samples_received.value_or(0ul); + sample.concealed_samples = stat->concealed_samples.value_or(0ul); sample.removed_samples_for_acceleration = - stat->removed_samples_for_acceleration.ValueOrDefault(0ul); + stat->removed_samples_for_acceleration.value_or(0ul); sample.inserted_samples_for_deceleration = - stat->inserted_samples_for_deceleration.ValueOrDefault(0ul); + stat->inserted_samples_for_deceleration.value_or(0ul); sample.silent_concealed_samples = - stat->silent_concealed_samples.ValueOrDefault(0ul); + stat->silent_concealed_samples.value_or(0ul); sample.jitter_buffer_delay = - TimeDelta::Seconds(stat->jitter_buffer_delay.ValueOrDefault(0.)); + TimeDelta::Seconds(stat->jitter_buffer_delay.value_or(0.)); sample.jitter_buffer_target_delay = - TimeDelta::Seconds(stat->jitter_buffer_target_delay.ValueOrDefault(0.)); + TimeDelta::Seconds(stat->jitter_buffer_target_delay.value_or(0.)); sample.jitter_buffer_emitted_count = - stat->jitter_buffer_emitted_count.ValueOrDefault(0ul); - sample.total_samples_duration = - stat->total_samples_duration.ValueOrDefault(0.); - sample.total_audio_energy = stat->total_audio_energy.ValueOrDefault(0.); + stat->jitter_buffer_emitted_count.value_or(0ul); + sample.total_samples_duration = stat->total_samples_duration.value_or(0.); + sample.total_audio_energy = stat->total_audio_energy.value_or(0.); TrackIdStreamInfoMap::StreamInfo stream_info = analyzer_helper_->GetStreamInfoFromTrackId(*stat->track_identifier); diff --git a/third_party/libwebrtc/test/pc/e2e/analyzer/video/video_quality_metrics_reporter.cc b/third_party/libwebrtc/test/pc/e2e/analyzer/video/video_quality_metrics_reporter.cc index 817b3caad0..87f1590cb0 100644 --- a/third_party/libwebrtc/test/pc/e2e/analyzer/video/video_quality_metrics_reporter.cc +++ b/third_party/libwebrtc/test/pc/e2e/analyzer/video/video_quality_metrics_reporter.cc @@ -58,12 +58,14 @@ void VideoQualityMetricsReporter::OnStatsReports( auto transport_stats = report->GetStatsOfType(); if (transport_stats.size() == 0u || - !transport_stats[0]->selected_candidate_pair_id.is_defined()) { + !transport_stats[0]->selected_candidate_pair_id.has_value()) { return; } RTC_DCHECK_EQ(transport_stats.size(), 1); std::string selected_ice_id = - transport_stats[0]->selected_candidate_pair_id.ValueToString(); + transport_stats[0] + ->GetAttribute(transport_stats[0]->selected_candidate_pair_id) + .ToString(); // Use the selected ICE candidate pair ID to get the appropriate ICE stats. const RTCIceCandidatePairStats ice_candidate_pair_stats = report->Get(selected_ice_id)->cast_to(); @@ -71,7 +73,7 @@ void VideoQualityMetricsReporter::OnStatsReports( auto outbound_rtp_stats = report->GetStatsOfType(); StatsSample sample; for (auto& s : outbound_rtp_stats) { - if (!s->kind.is_defined()) { + if (!s->kind.has_value()) { continue; } if (!(*s->kind == "video")) { @@ -81,15 +83,15 @@ void VideoQualityMetricsReporter::OnStatsReports( sample.sample_time = s->timestamp(); } sample.retransmitted_bytes_sent += - DataSize::Bytes(s->retransmitted_bytes_sent.ValueOrDefault(0ul)); - sample.bytes_sent += DataSize::Bytes(s->bytes_sent.ValueOrDefault(0ul)); + DataSize::Bytes(s->retransmitted_bytes_sent.value_or(0ul)); + sample.bytes_sent += DataSize::Bytes(s->bytes_sent.value_or(0ul)); sample.header_bytes_sent += - DataSize::Bytes(s->header_bytes_sent.ValueOrDefault(0ul)); + DataSize::Bytes(s->header_bytes_sent.value_or(0ul)); } MutexLock lock(&video_bwe_stats_lock_); VideoBweStats& video_bwe_stats = video_bwe_stats_[std::string(pc_label)]; - if (ice_candidate_pair_stats.available_outgoing_bitrate.is_defined()) { + if (ice_candidate_pair_stats.available_outgoing_bitrate.has_value()) { video_bwe_stats.available_send_bandwidth.AddSample( DataRate::BitsPerSec( *ice_candidate_pair_stats.available_outgoing_bitrate) diff --git a/third_party/libwebrtc/test/pc/e2e/cross_media_metrics_reporter.cc b/third_party/libwebrtc/test/pc/e2e/cross_media_metrics_reporter.cc index aad5946c9f..c1536018d2 100644 --- a/third_party/libwebrtc/test/pc/e2e/cross_media_metrics_reporter.cc +++ b/third_party/libwebrtc/test/pc/e2e/cross_media_metrics_reporter.cc @@ -47,8 +47,8 @@ void CrossMediaMetricsReporter::OnStatsReports( std::map> sync_group_stats; for (const auto& stat : inbound_stats) { - if (stat->estimated_playout_timestamp.ValueOrDefault(0.) > 0 && - stat->track_identifier.is_defined()) { + if (stat->estimated_playout_timestamp.value_or(0.) > 0 && + stat->track_identifier.has_value()) { sync_group_stats[reporter_helper_ ->GetStreamInfoFromTrackId(*stat->track_identifier) .sync_group] @@ -66,8 +66,8 @@ void CrossMediaMetricsReporter::OnStatsReports( const RTCInboundRtpStreamStats* audio_stat = pair.second[0]; const RTCInboundRtpStreamStats* video_stat = pair.second[1]; - RTC_CHECK(pair.second.size() == 2 && audio_stat->kind.is_defined() && - video_stat->kind.is_defined() && + RTC_CHECK(pair.second.size() == 2 && audio_stat->kind.has_value() && + video_stat->kind.has_value() && *audio_stat->kind != *video_stat->kind) << "Sync group should consist of one audio and one video stream."; @@ -77,8 +77,8 @@ void CrossMediaMetricsReporter::OnStatsReports( // Stream labels of a sync group are same for all polls, so we need it add // it only once. if (stats_info_.find(sync_group) == stats_info_.end()) { - RTC_CHECK(audio_stat->track_identifier.is_defined()); - RTC_CHECK(video_stat->track_identifier.is_defined()); + RTC_CHECK(audio_stat->track_identifier.has_value()); + RTC_CHECK(video_stat->track_identifier.has_value()); stats_info_[sync_group].audio_stream_info = reporter_helper_->GetStreamInfoFromTrackId( *audio_stat->track_identifier); diff --git a/third_party/libwebrtc/test/pc/e2e/network_quality_metrics_reporter.cc b/third_party/libwebrtc/test/pc/e2e/network_quality_metrics_reporter.cc index 2d6aa597ce..257fecf309 100644 --- a/third_party/libwebrtc/test/pc/e2e/network_quality_metrics_reporter.cc +++ b/third_party/libwebrtc/test/pc/e2e/network_quality_metrics_reporter.cc @@ -79,15 +79,14 @@ void NetworkQualityMetricsReporter::OnStatsReports( auto inbound_stats = report->GetStatsOfType(); for (const auto& stat : inbound_stats) { payload_received += - DataSize::Bytes(stat->bytes_received.ValueOrDefault(0ul) + - stat->header_bytes_received.ValueOrDefault(0ul)); + DataSize::Bytes(stat->bytes_received.value_or(0ul) + + stat->header_bytes_received.value_or(0ul)); } auto outbound_stats = report->GetStatsOfType(); for (const auto& stat : outbound_stats) { - payload_sent += - DataSize::Bytes(stat->bytes_sent.ValueOrDefault(0ul) + - stat->header_bytes_sent.ValueOrDefault(0ul)); + payload_sent += DataSize::Bytes(stat->bytes_sent.value_or(0ul) + + stat->header_bytes_sent.value_or(0ul)); } MutexLock lock(&lock_); diff --git a/third_party/libwebrtc/test/pc/e2e/peer_connection_quality_test.cc b/third_party/libwebrtc/test/pc/e2e/peer_connection_quality_test.cc index 5eb47b4682..90f201facd 100644 --- a/third_party/libwebrtc/test/pc/e2e/peer_connection_quality_test.cc +++ b/third_party/libwebrtc/test/pc/e2e/peer_connection_quality_test.cc @@ -277,7 +277,7 @@ void PeerConnectionE2EQualityTest::Run(RunParams run_params) { TestPeerFactory test_peer_factory( signaling_thread.get(), time_controller_, - video_quality_analyzer_injection_helper_.get(), task_queue_.get()); + video_quality_analyzer_injection_helper_.get(), task_queue_->Get()); alice_ = test_peer_factory.CreateTestPeer( std::move(alice_configurer), std::make_unique( diff --git a/third_party/libwebrtc/test/pc/e2e/stats_based_network_quality_metrics_reporter.cc b/third_party/libwebrtc/test/pc/e2e/stats_based_network_quality_metrics_reporter.cc index eb5f29287e..b965a7acd8 100644 --- a/third_party/libwebrtc/test/pc/e2e/stats_based_network_quality_metrics_reporter.cc +++ b/third_party/libwebrtc/test/pc/e2e/stats_based_network_quality_metrics_reporter.cc @@ -299,25 +299,23 @@ void StatsBasedNetworkQualityMetricsReporter::OnStatsReports( auto inbound_stats = report->GetStatsOfType(); for (const auto& stat : inbound_stats) { cur_stats.payload_received += - DataSize::Bytes(stat->bytes_received.ValueOrDefault(0ul) + - stat->header_bytes_received.ValueOrDefault(0ul)); + DataSize::Bytes(stat->bytes_received.value_or(0ul) + + stat->header_bytes_received.value_or(0ul)); } auto outbound_stats = report->GetStatsOfType(); for (const auto& stat : outbound_stats) { - cur_stats.payload_sent += - DataSize::Bytes(stat->bytes_sent.ValueOrDefault(0ul) + - stat->header_bytes_sent.ValueOrDefault(0ul)); + cur_stats.payload_sent += DataSize::Bytes( + stat->bytes_sent.value_or(0ul) + stat->header_bytes_sent.value_or(0ul)); } auto candidate_pairs_stats = report->GetStatsOfType(); for (const auto& stat : candidate_pairs_stats) { cur_stats.total_received += - DataSize::Bytes(stat->bytes_received.ValueOrDefault(0ul)); - cur_stats.total_sent += - DataSize::Bytes(stat->bytes_sent.ValueOrDefault(0ul)); - cur_stats.packets_received += stat->packets_received.ValueOrDefault(0ul); - cur_stats.packets_sent += stat->packets_sent.ValueOrDefault(0ul); + DataSize::Bytes(stat->bytes_received.value_or(0ul)); + cur_stats.total_sent += DataSize::Bytes(stat->bytes_sent.value_or(0ul)); + cur_stats.packets_received += stat->packets_received.value_or(0ul); + cur_stats.packets_sent += stat->packets_sent.value_or(0ul); } MutexLock lock(&mutex_); diff --git a/third_party/libwebrtc/test/pc/e2e/test_peer_factory.cc b/third_party/libwebrtc/test/pc/e2e/test_peer_factory.cc index dd900027ee..a184c5db3c 100644 --- a/third_party/libwebrtc/test/pc/e2e/test_peer_factory.cc +++ b/third_party/libwebrtc/test/pc/e2e/test_peer_factory.cc @@ -43,16 +43,14 @@ constexpr int kDefaultSamplingFrequencyInHz = 48000; // and `pc_dependencies` if they are omitted. Also setup required // dependencies, that won't be specially provided by factory and will be just // transferred to peer connection creation code. -void SetMandatoryEntities(InjectableComponents* components, - TimeController& time_controller) { +void SetMandatoryEntities(InjectableComponents* components) { RTC_DCHECK(components->pcf_dependencies); RTC_DCHECK(components->pc_dependencies); // Setup required peer connection factory dependencies. if (components->pcf_dependencies->event_log_factory == nullptr) { components->pcf_dependencies->event_log_factory = - std::make_unique( - time_controller.GetTaskQueueFactory()); + std::make_unique(); } if (!components->pcf_dependencies->trials) { components->pcf_dependencies->trials = @@ -286,7 +284,7 @@ std::unique_ptr TestPeerFactory::CreateTestPeer( RTC_DCHECK(configurable_params); RTC_DCHECK_EQ(configurable_params->video_configs.size(), video_sources.size()); - SetMandatoryEntities(components.get(), time_controller_); + SetMandatoryEntities(components.get()); params->rtc_configuration.sdp_semantics = SdpSemantics::kUnifiedPlan; // Create peer connection factory. @@ -329,6 +327,7 @@ std::unique_ptr TestPeerFactory::CreateTestPeer( components->worker_thread, components->network_thread); rtc::scoped_refptr peer_connection_factory = CreateModularPeerConnectionFactory(std::move(pcf_deps)); + peer_connection_factory->SetOptions(params->peer_connection_factory_options); // Create peer connection. PeerConnectionDependencies pc_deps = diff --git a/third_party/libwebrtc/test/pc/e2e/test_peer_factory.h b/third_party/libwebrtc/test/pc/e2e/test_peer_factory.h index f2698e2a15..cc61b04ae1 100644 --- a/third_party/libwebrtc/test/pc/e2e/test_peer_factory.h +++ b/third_party/libwebrtc/test/pc/e2e/test_peer_factory.h @@ -18,12 +18,12 @@ #include "absl/strings/string_view.h" #include "api/rtc_event_log/rtc_event_log_factory.h" +#include "api/task_queue/task_queue_base.h" #include "api/test/pclf/media_configuration.h" #include "api/test/pclf/media_quality_test_params.h" #include "api/test/pclf/peer_configurer.h" #include "api/test/time_controller.h" #include "modules/audio_device/include/test_audio_device.h" -#include "rtc_base/task_queue.h" #include "test/pc/e2e/analyzer/video/video_quality_analyzer_injection_helper.h" #include "test/pc/e2e/test_peer.h" @@ -55,7 +55,7 @@ class TestPeerFactory { TestPeerFactory(rtc::Thread* signaling_thread, TimeController& time_controller, VideoQualityAnalyzerInjectionHelper* video_analyzer_helper, - rtc::TaskQueue* task_queue) + TaskQueueBase* task_queue) : signaling_thread_(signaling_thread), time_controller_(time_controller), video_analyzer_helper_(video_analyzer_helper), @@ -75,7 +75,7 @@ class TestPeerFactory { rtc::Thread* signaling_thread_; TimeController& time_controller_; VideoQualityAnalyzerInjectionHelper* video_analyzer_helper_; - rtc::TaskQueue* task_queue_; + TaskQueueBase* const task_queue_; }; } // namespace webrtc_pc_e2e -- cgit v1.2.3