tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

commit 4b0b86530942be9f142fdcb3d47c55e5ebaeb30e
parent c0c5383d802035b924c9365f934b2f5a46bae15a
Author: Dan Baker <dbaker@mozilla.com>
Date:   Fri, 24 Oct 2025 13:50:57 -0600

Bug 1995393 - Vendor libwebrtc from 9bc8059df5

Upstream commit: https://webrtc.googlesource.com/src/+/9bc8059df5b09b67c3264b2ee011af180fa5ebba
    clang-tidy: apply modernize-use-designated-initializer call/ p2p/ rtc_base/

    split from
      https://webrtc-review.googlesource.com/c/src/+/404061
    see there for full history and manual changes

    Bug: webrtc:424706384
    Change-Id: Ic0af7ad0ca739c1ea1e869bc0aa696cc1eea7086
    Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/405041
    Reviewed-by: Harald Alvestrand <hta@webrtc.org>
    Commit-Queue: Philipp Hancke <phancke@meta.com>
    Reviewed-by: Danil Chapovalov <danilchap@webrtc.org>
    Cr-Commit-Position: refs/heads/main@{#45397}

Diffstat:
Mthird_party/libwebrtc/README.mozilla.last-vendor | 4++--
Mthird_party/libwebrtc/call/adaptation/resource_adaptation_processor.cc | 5+++--
Mthird_party/libwebrtc/call/adaptation/video_stream_adapter.cc | 14++++++++------
Mthird_party/libwebrtc/call/bitrate_allocator.cc | 6+++---
Mthird_party/libwebrtc/call/bitrate_allocator_unittest.cc | 22+++++++++++++++-------
Mthird_party/libwebrtc/call/payload_type_picker.cc | 72++++++++++++++++++++++++++++++++++++------------------------------------
Mthird_party/libwebrtc/moz-patch-stack/p0001.patch | 2+-
Mthird_party/libwebrtc/moz-patch-stack/s0001.patch | 2+-
Mthird_party/libwebrtc/moz-patch-stack/s0009.patch | 2+-
Mthird_party/libwebrtc/moz-patch-stack/s0010.patch | 2+-
Mthird_party/libwebrtc/p2p/base/basic_ice_controller.cc | 19+++++++++----------
Mthird_party/libwebrtc/p2p/base/p2p_transport_channel.cc | 23+++++++++++++----------
Mthird_party/libwebrtc/p2p/base/stun_port_unittest.cc | 16+++++++++-------
Mthird_party/libwebrtc/p2p/base/turn_port_unittest.cc | 15++++++++-------
Mthird_party/libwebrtc/p2p/base/wrapping_active_ice_controller_unittest.cc | 24++++++++++++------------
Mthird_party/libwebrtc/p2p/dtls/dtls_transport_unittest.cc | 4++--
Mthird_party/libwebrtc/p2p/test/turn_server.cc | 3++-
Mthird_party/libwebrtc/rtc_base/async_dns_resolver.cc | 4+---
Mthird_party/libwebrtc/rtc_base/base64_unittest.cc | 46+++++++++++++++++++++++++---------------------
Mthird_party/libwebrtc/rtc_base/experiments/field_trial_units.cc | 8+++++---
Mthird_party/libwebrtc/rtc_base/experiments/quality_scaling_experiment_unittest.cc | 13+++++++++++--
Mthird_party/libwebrtc/rtc_base/logging.cc | 3++-
Mthird_party/libwebrtc/rtc_base/openssl_stream_adapter.cc | 17+++++++++--------
Mthird_party/libwebrtc/rtc_base/physical_socket_server.cc | 6+++---
Mthird_party/libwebrtc/rtc_base/ssl_identity_unittest.cc | 101+++++++++++++++++++++++++++++++++++++++++--------------------------------------
Mthird_party/libwebrtc/rtc_base/synchronization/yield.cc | 2+-
26 files changed, 236 insertions(+), 199 deletions(-)

diff --git a/third_party/libwebrtc/README.mozilla.last-vendor b/third_party/libwebrtc/README.mozilla.last-vendor @@ -1,4 +1,4 @@ # ./mach python dom/media/webrtc/third_party_build/vendor-libwebrtc.py --from-local /Users/danielbaker/elm/.moz-fast-forward/moz-libwebrtc --commit mozpatches libwebrtc -libwebrtc updated from /Users/danielbaker/elm/.moz-fast-forward/moz-libwebrtc commit mozpatches on 2025-10-24T19:41:28.769192+00:00. +libwebrtc updated from /Users/danielbaker/elm/.moz-fast-forward/moz-libwebrtc commit mozpatches on 2025-10-24T19:50:43.782094+00:00. # base of lastest vendoring -af0c2ac84b +9bc8059df5 diff --git a/third_party/libwebrtc/call/adaptation/resource_adaptation_processor.cc b/third_party/libwebrtc/call/adaptation/resource_adaptation_processor.cc @@ -326,7 +326,8 @@ std::pair<std::vector<scoped_refptr<Resource>>, ResourceAdaptationProcessor::FindMostLimitedResources() const { std::vector<scoped_refptr<Resource>> most_limited_resources; VideoStreamAdapter::RestrictionsWithCounters most_limited_restrictions{ - VideoSourceRestrictions(), VideoAdaptationCounters()}; + .restrictions = VideoSourceRestrictions(), + .counters = VideoAdaptationCounters()}; for (const auto& resource_and_adaptation_limit_ : adaptation_limits_by_resources_) { @@ -355,7 +356,7 @@ void ResourceAdaptationProcessor::UpdateResourceLimitations( adaptation_limits.counters == counters) { return; } - adaptation_limits = {restrictions, counters}; + adaptation_limits = {.restrictions = restrictions, .counters = counters}; std::map<scoped_refptr<Resource>, VideoAdaptationCounters> limitations; for (const auto& p : adaptation_limits_by_resources_) { diff --git a/third_party/libwebrtc/call/adaptation/video_stream_adapter.cc b/third_party/libwebrtc/call/adaptation/video_stream_adapter.cc @@ -246,8 +246,8 @@ void VideoStreamAdapter::ClearRestrictions() { // Invalidate any previously returned Adaptation. RTC_LOG(LS_INFO) << "Resetting restrictions"; ++adaptation_validation_id_; - current_restrictions_ = {VideoSourceRestrictions(), - VideoAdaptationCounters()}; + current_restrictions_ = {.restrictions = VideoSourceRestrictions(), + .counters = VideoAdaptationCounters()}; awaiting_frame_size_change_ = std::nullopt; BroadcastVideoRestrictionsUpdate(input_state_provider_->InputState(), nullptr); @@ -327,9 +327,10 @@ Adaptation VideoStreamAdapter::RestrictionsOrStateToAdaptation( VideoStreamAdapter::RestrictionsOrState step_or_state, const VideoStreamInputState& input_state) const { RTC_DCHECK(!step_or_state.valueless_by_exception()); - return std::visit( - RestrictionsOrStateVisitor{adaptation_validation_id_, input_state}, - step_or_state); + return std::visit(RestrictionsOrStateVisitor{.adaptation_validation_id = + adaptation_validation_id_, + .input_state = input_state}, + step_or_state); } Adaptation VideoStreamAdapter::GetAdaptationUp( @@ -676,7 +677,8 @@ void VideoStreamAdapter::ApplyAdaptation(const Adaptation& adaptation, } else { awaiting_frame_size_change_ = std::nullopt; } - current_restrictions_ = {adaptation.restrictions(), adaptation.counters()}; + current_restrictions_ = {.restrictions = adaptation.restrictions(), + .counters = adaptation.counters()}; BroadcastVideoRestrictionsUpdate(adaptation.input_state(), resource); } diff --git a/third_party/libwebrtc/call/bitrate_allocator.cc b/third_party/libwebrtc/call/bitrate_allocator.cc @@ -143,9 +143,9 @@ void DistributeBitrateRelatively( std::vector<PriorityRateObserverConfig> priority_rate_observers; for (const auto& observer_config : allocatable_tracks) { priority_rate_observers.push_back(PriorityRateObserverConfig{ - observer_config.observer, - observers_capacities.at(observer_config.observer), - observer_config.config.bitrate_priority}); + .allocation_key = observer_config.observer, + .capacity_bps = observers_capacities.at(observer_config.observer), + .bitrate_priority = observer_config.config.bitrate_priority}); bitrate_priority_sum += observer_config.config.bitrate_priority; } diff --git a/third_party/libwebrtc/call/bitrate_allocator_unittest.cc b/third_party/libwebrtc/call/bitrate_allocator_unittest.cc @@ -135,10 +135,14 @@ class BitrateAllocatorTest : public ::testing::Test { bool enforce_min_bitrate, double bitrate_priority, std::optional<TrackRateElasticity> rate_elasticity = std::nullopt) { - allocator_->AddObserver( - observer, {min_bitrate_bps, max_bitrate_bps, pad_up_bitrate_bps, - /* priority_bitrate */ 0, enforce_min_bitrate, - bitrate_priority, rate_elasticity}); + allocator_->AddObserver(observer, + {.min_bitrate_bps = min_bitrate_bps, + .max_bitrate_bps = max_bitrate_bps, + .pad_up_bitrate_bps = pad_up_bitrate_bps, + .priority_bitrate_bps = 0, + .enforce_min_bitrate = enforce_min_bitrate, + .bitrate_priority = bitrate_priority, + .rate_elasticity = rate_elasticity}); } MediaStreamAllocationConfig DefaultConfig() const { MediaStreamAllocationConfig default_config; @@ -334,9 +338,13 @@ class BitrateAllocatorTestNoEnforceMin : public ::testing::Test { bool enforce_min_bitrate, absl::string_view /* track_id */, double bitrate_priority) { - allocator_->AddObserver( - observer, {min_bitrate_bps, max_bitrate_bps, pad_up_bitrate_bps, 0, - enforce_min_bitrate, bitrate_priority}); + allocator_->AddObserver(observer, + {.min_bitrate_bps = min_bitrate_bps, + .max_bitrate_bps = max_bitrate_bps, + .pad_up_bitrate_bps = pad_up_bitrate_bps, + .priority_bitrate_bps = 0, + .enforce_min_bitrate = enforce_min_bitrate, + .bitrate_priority = bitrate_priority}); } NiceMock<MockLimitObserver> limit_observer_; std::unique_ptr<BitrateAllocator> allocator_; diff --git a/third_party/libwebrtc/call/payload_type_picker.cc b/third_party/libwebrtc/call/payload_type_picker.cc @@ -138,18 +138,18 @@ PayloadTypePicker::PayloadTypePicker() { // Default audio codecs. Duplicates media/engine/payload_type_mapper.cc const MapTableEntry default_audio_mappings[] = { // Static payload type assignments according to RFC 3551. - {{kPcmuCodecName, 8000, 1}, 0}, - {{"GSM", 8000, 1}, 3}, - {{"G723", 8000, 1}, 4}, - {{"DVI4", 8000, 1}, 5}, - {{"DVI4", 16000, 1}, 6}, - {{"LPC", 8000, 1}, 7}, - {{kPcmaCodecName, 8000, 1}, 8}, - {{kG722CodecName, 8000, 1}, 9}, - {{kL16CodecName, 44100, 2}, 10}, - {{kL16CodecName, 44100, 1}, 11}, - {{"QCELP", 8000, 1}, 12}, - {{kCnCodecName, 8000, 1}, 13}, + {.format = {kPcmuCodecName, 8000, 1}, .payload_type = 0}, + {.format = {"GSM", 8000, 1}, .payload_type = 3}, + {.format = {"G723", 8000, 1}, .payload_type = 4}, + {.format = {"DVI4", 8000, 1}, .payload_type = 5}, + {.format = {"DVI4", 16000, 1}, .payload_type = 6}, + {.format = {"LPC", 8000, 1}, .payload_type = 7}, + {.format = {kPcmaCodecName, 8000, 1}, .payload_type = 8}, + {.format = {kG722CodecName, 8000, 1}, .payload_type = 9}, + {.format = {kL16CodecName, 44100, 2}, .payload_type = 10}, + {.format = {kL16CodecName, 44100, 1}, .payload_type = 11}, + {.format = {"QCELP", 8000, 1}, .payload_type = 12}, + {.format = {kCnCodecName, 8000, 1}, .payload_type = 13}, // RFC 4566 is a bit ambiguous on the contents of the "encoding // parameters" field, which, for audio, encodes the number of // channels. It is "optional and may be omitted if the number of @@ -158,39 +158,39 @@ PayloadTypePicker::PayloadTypePicker() { // specify a value for this parameter for MPA, I've included both 0 // and 1 here, to increase the chances it will be correctly used if // someone implements an MPEG audio encoder/decoder. - {{"MPA", 90000, 0}, 14}, - {{"MPA", 90000, 1}, 14}, - {{"G728", 8000, 1}, 15}, - {{"DVI4", 11025, 1}, 16}, - {{"DVI4", 22050, 1}, 17}, - {{"G729", 8000, 1}, 18}, + {.format = {"MPA", 90000, 0}, .payload_type = 14}, + {.format = {"MPA", 90000, 1}, .payload_type = 14}, + {.format = {"G728", 8000, 1}, .payload_type = 15}, + {.format = {"DVI4", 11025, 1}, .payload_type = 16}, + {.format = {"DVI4", 22050, 1}, .payload_type = 17}, + {.format = {"G729", 8000, 1}, .payload_type = 18}, // Payload type assignments currently used by WebRTC. // Includes data to reduce collisions (and thus reassignments) // TODO(bugs.webrtc.org/400630582): Delete this, it's only for test // stability. - {{"reserved-do-not-use", 1, 0}, 102}, - {{kCnCodecName, 16000, 1}, 105}, - {{kCnCodecName, 32000, 1}, 106}, - {{kOpusCodecName, - 48000, - 2, - {{kCodecParamMinPTime, "10"}, - {kCodecParamUseInbandFec, kParamValueTrue}}}, - 111}, + {.format = {"reserved-do-not-use", 1, 0}, .payload_type = 102}, + {.format = {kCnCodecName, 16000, 1}, .payload_type = 105}, + {.format = {kCnCodecName, 32000, 1}, .payload_type = 106}, + {.format = {kOpusCodecName, + 48000, + 2, + {{kCodecParamMinPTime, "10"}, + {kCodecParamUseInbandFec, kParamValueTrue}}}, + .payload_type = 111}, // RED for opus is assigned in the lower range, starting at the top. // Note that the FMTP refers to the opus payload type. - {{kRedCodecName, - 48000, - 2, - {{kCodecParamNotInNameValueFormat, "111/111"}}}, - 63}, + {.format = {kRedCodecName, + 48000, + 2, + {{kCodecParamNotInNameValueFormat, "111/111"}}}, + .payload_type = 63}, // TODO(solenberg): Remove the hard coded 16k,32k,48k DTMF once we // assign payload types dynamically for send side as well. - {{kDtmfCodecName, 48000, 1}, 110}, - {{kDtmfCodecName, 32000, 1}, 112}, - {{kDtmfCodecName, 16000, 1}, 113}, - {{kDtmfCodecName, 8000, 1}, 126}}; + {.format = {kDtmfCodecName, 48000, 1}, .payload_type = 110}, + {.format = {kDtmfCodecName, 32000, 1}, .payload_type = 112}, + {.format = {kDtmfCodecName, 16000, 1}, .payload_type = 113}, + {.format = {kDtmfCodecName, 8000, 1}, .payload_type = 126}}; for (const MapTableEntry& entry : default_audio_mappings) { AddMapping(PayloadType(entry.payload_type), CreateAudioCodec(entry.format)); } diff --git a/third_party/libwebrtc/moz-patch-stack/p0001.patch b/third_party/libwebrtc/moz-patch-stack/p0001.patch @@ -52,7 +52,7 @@ index 339238d664..1610f0002a 100644 networkBehavior.loss_percent = 50; diff --git a/rtc_base/openssl_stream_adapter.cc b/rtc_base/openssl_stream_adapter.cc -index 50be6b5c26..8c952cd3a2 100644 +index 4acbb55890..2b45d37df7 100644 --- a/rtc_base/openssl_stream_adapter.cc +++ b/rtc_base/openssl_stream_adapter.cc @@ -852,10 +852,15 @@ void OpenSSLStreamAdapter::SetTimeout(int delay_ms) { diff --git a/third_party/libwebrtc/moz-patch-stack/s0001.patch b/third_party/libwebrtc/moz-patch-stack/s0001.patch @@ -1400,7 +1400,7 @@ index 62268d946d..9744edba44 100644 # Dependency on chromium's logging (in //base). deps += [ "//base" ] diff --git a/rtc_base/logging.cc b/rtc_base/logging.cc -index f157205e7d..fe82a4bb4c 100644 +index 53faf0eee7..c3a1f94973 100644 --- a/rtc_base/logging.cc +++ b/rtc_base/logging.cc @@ -24,6 +24,7 @@ diff --git a/third_party/libwebrtc/moz-patch-stack/s0009.patch b/third_party/libwebrtc/moz-patch-stack/s0009.patch @@ -68,7 +68,7 @@ index 32e2eb35b2..0ce48a02f1 100644 if (number_of_cores <= 0) { RTC_LOG(LS_ERROR) << "Failed to get number of cores"; diff --git a/rtc_base/physical_socket_server.cc b/rtc_base/physical_socket_server.cc -index 2116af1381..1e10bc8c2f 100644 +index 10adcfe48c..7102e96137 100644 --- a/rtc_base/physical_socket_server.cc +++ b/rtc_base/physical_socket_server.cc @@ -78,7 +78,10 @@ diff --git a/third_party/libwebrtc/moz-patch-stack/s0010.patch b/third_party/libwebrtc/moz-patch-stack/s0010.patch @@ -15,7 +15,7 @@ Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/2b079067648bfe0d0 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rtc_base/physical_socket_server.cc b/rtc_base/physical_socket_server.cc -index 1e10bc8c2f..a807079917 100644 +index 7102e96137..d148c8514f 100644 --- a/rtc_base/physical_socket_server.cc +++ b/rtc_base/physical_socket_server.cc @@ -1548,7 +1548,7 @@ bool PhysicalSocketServer::WaitSelect(int cmsWait, bool process_io) { diff --git a/third_party/libwebrtc/p2p/base/basic_ice_controller.cc b/third_party/libwebrtc/p2p/base/basic_ice_controller.cc @@ -449,7 +449,7 @@ BasicIceController::HandleInitialSelectDampening( if (!field_trials_->initial_select_dampening.has_value() && !field_trials_->initial_select_dampening_ping_received.has_value()) { // experiment not enabled => select connection. - return {new_connection, std::nullopt}; + return {.connection = new_connection}; } int64_t now = TimeMillis(); @@ -470,7 +470,7 @@ BasicIceController::HandleInitialSelectDampening( << initial_select_timestamp_ms_ << " selection delayed by: " << (now - start_wait) << "ms"; initial_select_timestamp_ms_ = 0; - return {new_connection, std::nullopt}; + return {.connection = new_connection}; } // We are not yet ready to select first connection... @@ -493,8 +493,7 @@ BasicIceController::HandleInitialSelectDampening( } RTC_LOG(LS_INFO) << "delay initial selection up to " << min_delay << "ms"; - return {.connection = std::nullopt, - .recheck_event = IceRecheckEvent( + return {.recheck_event = IceRecheckEvent( IceSwitchReason::ICE_CONTROLLER_RECHECK, min_delay)}; } @@ -502,7 +501,7 @@ IceControllerInterface::SwitchResult BasicIceController::ShouldSwitchConnection( IceSwitchReason reason, const Connection* new_connection) { if (!ReadyToSend(new_connection) || selected_connection_ == new_connection) { - return {std::nullopt, std::nullopt}; + return {}; } if (selected_connection_ == nullptr) { @@ -515,7 +514,7 @@ IceControllerInterface::SwitchResult BasicIceController::ShouldSwitchConnection( int compare_a_b_by_networks = CompareCandidatePairNetworks( new_connection, selected_connection_, config_.network_preference); if (compare_a_b_by_networks == b_is_better && !new_connection->receiving()) { - return {std::nullopt, std::nullopt}; + return {}; } bool missed_receiving_unchanged_threshold = false; @@ -537,18 +536,18 @@ IceControllerInterface::SwitchResult BasicIceController::ShouldSwitchConnection( } if (cmp < 0) { - return {new_connection, std::nullopt}; + return {.connection = new_connection}; } else if (cmp > 0) { - return {std::nullopt, recheck_event}; + return {.recheck_event = recheck_event}; } // If everything else is the same, switch only if rtt has improved by // a margin. if (new_connection->rtt() <= selected_connection_->rtt() - kMinImprovement) { - return {new_connection, std::nullopt}; + return {.connection = new_connection}; } - return {std::nullopt, recheck_event}; + return {.recheck_event = recheck_event}; } IceControllerInterface::SwitchResult diff --git a/third_party/libwebrtc/p2p/base/p2p_transport_channel.cc b/third_party/libwebrtc/p2p/base/p2p_transport_channel.cc @@ -219,18 +219,21 @@ P2PTransportChannel::P2PTransportChannel( ParseFieldTrials(field_trials); IceControllerFactoryArgs args{ - [this] { return GetState(); }, [this] { return GetIceRole(); }, - [this](const Connection* connection) { - return IsPortPruned(connection->port()) || - IsRemoteCandidatePruned(connection->remote_candidate()); - }, - &ice_field_trials_, - field_trials ? field_trials->Lookup("WebRTC-IceControllerFieldTrials") - : ""}; + .ice_transport_state_func = [this] { return GetState(); }, + .ice_role_func = [this] { return GetIceRole(); }, + .is_connection_pruned_func = + [this](const Connection* connection) { + return IsPortPruned(connection->port()) || + IsRemoteCandidatePruned(connection->remote_candidate()); + }, + .ice_field_trials = &ice_field_trials_, + .ice_controller_field_trials = + field_trials ? field_trials->Lookup("WebRTC-IceControllerFieldTrials") + : ""}; if (active_ice_controller_factory) { - ActiveIceControllerFactoryArgs active_args{args, - /* ice_agent= */ this}; + ActiveIceControllerFactoryArgs active_args{.legacy_args = args, + .ice_agent = this}; ice_controller_ = active_ice_controller_factory->Create(active_args); } else { ice_controller_ = std::make_unique<WrappingActiveIceController>( diff --git a/third_party/libwebrtc/p2p/base/stun_port_unittest.cc b/third_party/libwebrtc/p2p/base/stun_port_unittest.cc @@ -760,10 +760,10 @@ TEST_P(StunPortIPAddressTypeMetricsTest, TestIPAddressTypeMetrics) { } const IPAddressTypeTestConfig kAllIPAddressTypeTestConfigs[] = { - {"127.0.0.1", webrtc::IPAddressType::kLoopback}, - {"localhost", webrtc::IPAddressType::kLoopback}, - {"10.0.0.3", webrtc::IPAddressType::kPrivate}, - {"1.1.1.1", webrtc::IPAddressType::kPublic}, + {.address = "127.0.0.1", .address_type = webrtc::IPAddressType::kLoopback}, + {.address = "localhost", .address_type = webrtc::IPAddressType::kLoopback}, + {.address = "10.0.0.3", .address_type = webrtc::IPAddressType::kPrivate}, + {.address = "1.1.1.1", .address_type = webrtc::IPAddressType::kPublic}, }; INSTANTIATE_TEST_SUITE_P(All, @@ -1019,9 +1019,11 @@ TEST_P(StunIPv6PortIPAddressTypeMetricsTest, TestIPAddressTypeMetrics) { } const IPAddressTypeTestConfig kAllIPv6AddressTypeTestConfigs[] = { - {"::1", webrtc::IPAddressType::kLoopback}, - {"fd00:4860:4860::8844", webrtc::IPAddressType::kPrivate}, - {"2001:4860:4860::8888", webrtc::IPAddressType::kPublic}, + {.address = "::1", .address_type = webrtc::IPAddressType::kLoopback}, + {.address = "fd00:4860:4860::8844", + .address_type = webrtc::IPAddressType::kPrivate}, + {.address = "2001:4860:4860::8888", + .address_type = webrtc::IPAddressType::kPublic}, }; INSTANTIATE_TEST_SUITE_P(All, diff --git a/third_party/libwebrtc/p2p/base/turn_port_unittest.cc b/third_party/libwebrtc/p2p/base/turn_port_unittest.cc @@ -2183,13 +2183,14 @@ static struct IPAddressTypeTestConfig { absl::string_view address; IPAddressType address_type; } kAllIPAddressTypeTestConfigs[] = { - {"127.0.0.1", IPAddressType::kLoopback}, - {"localhost", IPAddressType::kLoopback}, - {"::1", IPAddressType::kLoopback}, - {"10.0.0.3", IPAddressType::kPrivate}, - {"fd00:4860:4860::8844", IPAddressType::kPrivate}, - {"1.1.1.1", IPAddressType::kPublic}, - {"2001:4860:4860::8888", IPAddressType::kPublic}, + {.address = "127.0.0.1", .address_type = IPAddressType::kLoopback}, + {.address = "localhost", .address_type = IPAddressType::kLoopback}, + {.address = "::1", .address_type = IPAddressType::kLoopback}, + {.address = "10.0.0.3", .address_type = IPAddressType::kPrivate}, + {.address = "fd00:4860:4860::8844", + .address_type = IPAddressType::kPrivate}, + {.address = "1.1.1.1", .address_type = IPAddressType::kPublic}, + {.address = "2001:4860:4860::8888", .address_type = IPAddressType::kPublic}, }; // Used by the test framework to print the param value for parameterized tests. diff --git a/third_party/libwebrtc/p2p/base/wrapping_active_ice_controller_unittest.cc b/third_party/libwebrtc/p2p/base/wrapping_active_ice_controller_unittest.cc @@ -128,10 +128,10 @@ TEST(WrappingActiveIceControllerTest, HandlesImmediateSwitchRequest) { std::vector<const Connection*> conns_to_forget{kConnectionTwo}; int recheck_delay_ms = 10; IceControllerInterface::SwitchResult switch_result{ - kConnection, - IceRecheckEvent(IceSwitchReason::ICE_CONTROLLER_RECHECK, - recheck_delay_ms), - conns_to_forget}; + .connection = kConnection, + .recheck_event = IceRecheckEvent(IceSwitchReason::ICE_CONTROLLER_RECHECK, + recheck_delay_ms), + .connections_to_forget_state_on = conns_to_forget}; // ICE controller should switch to given connection immediately. Sequence check_then_switch; @@ -174,10 +174,10 @@ TEST(WrappingActiveIceControllerTest, HandlesImmediateSortAndSwitchRequest) { std::vector<const Connection*> conns_to_prune{kConnectionThree}; int recheck_delay_ms = 10; IceControllerInterface::SwitchResult switch_result{ - kConnection, - IceRecheckEvent(IceSwitchReason::ICE_CONTROLLER_RECHECK, - recheck_delay_ms), - conns_to_forget}; + .connection = kConnection, + .recheck_event = IceRecheckEvent(IceSwitchReason::ICE_CONTROLLER_RECHECK, + recheck_delay_ms), + .connections_to_forget_state_on = conns_to_forget}; Sequence sort_and_switch; EXPECT_CALL(agent, UpdateConnectionStates()).InSequence(sort_and_switch); @@ -239,10 +239,10 @@ TEST(WrappingActiveIceControllerTest, HandlesSortAndSwitchRequest) { std::vector<const Connection*> conns_to_forget{kConnectionTwo}; int recheck_delay_ms = 10; IceControllerInterface::SwitchResult switch_result{ - kConnection, - IceRecheckEvent(IceSwitchReason::ICE_CONTROLLER_RECHECK, - recheck_delay_ms), - conns_to_forget}; + .connection = kConnection, + .recheck_event = IceRecheckEvent(IceSwitchReason::ICE_CONTROLLER_RECHECK, + recheck_delay_ms), + .connections_to_forget_state_on = conns_to_forget}; // Sort and switch should take place as the subsequent task. Sequence sort_and_switch; diff --git a/third_party/libwebrtc/p2p/dtls/dtls_transport_unittest.cc b/third_party/libwebrtc/p2p/dtls/dtls_transport_unittest.cc @@ -731,8 +731,8 @@ static const struct { int version_bytes; const std::vector<HandshakeTestEvent>& events; } kEventsPerVersion[] = { - {kDtls12VersionBytes, dtls_12_handshake_events}, - {kDtls13VersionBytes, dtls_13_handshake_events}, + {.version_bytes = kDtls12VersionBytes, .events = dtls_12_handshake_events}, + {.version_bytes = kDtls13VersionBytes, .events = dtls_13_handshake_events}, }; struct EndpointConfig { diff --git a/third_party/libwebrtc/p2p/test/turn_server.cc b/third_party/libwebrtc/p2p/test/turn_server.cc @@ -128,7 +128,8 @@ void TurnServer::AddInternalServerSocket( RTC_DCHECK(server_listen_sockets_.end() == server_listen_sockets_.find(socket)); - server_listen_sockets_[socket] = {proto, std::move(ssl_adapter_factory)}; + server_listen_sockets_[socket] = { + .proto = proto, .ssl_adapter_factory = std::move(ssl_adapter_factory)}; socket->SignalReadEvent.connect(this, &TurnServer::OnNewInternalConnection); } diff --git a/third_party/libwebrtc/rtc_base/async_dns_resolver.cc b/third_party/libwebrtc/rtc_base/async_dns_resolver.cc @@ -48,8 +48,7 @@ int ResolveHostname(absl::string_view hostname, std::vector<IPAddress>& addresses) { addresses.clear(); struct addrinfo* result = nullptr; - struct addrinfo hints = {0}; - hints.ai_family = family; + struct addrinfo hints = {.ai_flags = AI_ADDRCONFIG, .ai_family = family}; // `family` here will almost always be AF_UNSPEC, because `family` comes from // AsyncResolver::addr_.family(), which comes from a SocketAddress constructed // with a hostname. When a SocketAddress is constructed with a hostname, its @@ -67,7 +66,6 @@ int ResolveHostname(absl::string_view hostname, // Android (source code, not documentation): // https://android.googlesource.com/platform/bionic/+/ // 7e0bfb511e85834d7c6cb9631206b62f82701d60/libc/netbsd/net/getaddrinfo.c#1657 - hints.ai_flags = AI_ADDRCONFIG; int ret = getaddrinfo(std::string(hostname).c_str(), nullptr, &hints, &result); if (ret != 0) { diff --git a/third_party/libwebrtc/rtc_base/base64_unittest.cc b/third_party/libwebrtc/rtc_base/base64_unittest.cc @@ -66,11 +66,11 @@ struct Base64DecodeTestCase { }; const Base64DecodeTestCase kBase64DecodeTestCases[] = { - {"InvalidCharacters", "invalid;;;", std::nullopt}, - {"InvalidLength", "abcde", std::nullopt}, - {"ValidInput", "abcd", "i\xB7\x1D"}, - {"ValidInputPadding", "abc=", "i\xB7"}, - {"EmptyInput", "", ""}, + {.name = "InvalidCharacters", .data = "invalid;;;", .result = std::nullopt}, + {.name = "InvalidLength", .data = "abcde", .result = std::nullopt}, + {.name = "ValidInput", .data = "abcd", .result = "i\xB7\x1D"}, + {.name = "ValidInputPadding", .data = "abc=", .result = "i\xB7"}, + {.name = "EmptyInput", .data = "", .result = ""}, }; using Base64DecodeTest = TestWithParam<Base64DecodeTestCase>; @@ -93,31 +93,35 @@ TEST_P(Base64DecodeTest, TestDecodeForgiving) { const Base64DecodeTestCase kBase64DecodeForgivingTestCases[] = { { - "ForgivingPadding", - "abc", - "i\xB7", + .name = "ForgivingPadding", + .data = "abc", + .result = "i\xB7", }, { - "WhitespaceForgivenTab", - "ab\tcd", - "i\xB7\x1D", + .name = "WhitespaceForgivenTab", + .data = "ab\tcd", + .result = "i\xB7\x1D", }, { - "WhitespaceForgivenSpace", - "a bc d", - "i\xB7\x1D", + .name = "WhitespaceForgivenSpace", + .data = "a bc d", + .result = "i\xB7\x1D", }, { - "WhitespaceForgivenNewline", - "a\nbc\nd", - "i\xB7\x1D", + .name = "WhitespaceForgivenNewline", + .data = "a\nbc\nd", + .result = "i\xB7\x1D", }, { - "WhitespaceForgivenCarriageReturn", - "a\r\nbc\rd", - "i\xB7\x1D", + .name = "WhitespaceForgivenCarriageReturn", + .data = "a\r\nbc\rd", + .result = "i\xB7\x1D", + }, + { + .name = "WhitespaceForgivenLineFeed", + .data = "a\fbcd", + .result = "i\xB7\x1D", }, - {"WhitespaceForgivenLineFeed", "a\fbcd", "i\xB7\x1D"}, }; using Base64DecodeForgivingTest = TestWithParam<Base64DecodeTestCase>; diff --git a/third_party/libwebrtc/rtc_base/experiments/field_trial_units.cc b/third_party/libwebrtc/rtc_base/experiments/field_trial_units.cc @@ -34,16 +34,18 @@ struct ValueWithUnit { std::optional<ValueWithUnit> ParseValueWithUnit(absl::string_view str) { if (str == "inf") { - return ValueWithUnit{std::numeric_limits<double>::infinity(), ""}; + return ValueWithUnit{.value = std::numeric_limits<double>::infinity(), + .unit = ""}; } else if (str == "-inf") { - return ValueWithUnit{-std::numeric_limits<double>::infinity(), ""}; + return ValueWithUnit{.value = -std::numeric_limits<double>::infinity(), + .unit = ""}; } else { double double_val; char unit_char[RTC_TRIAL_UNIT_SIZE]; unit_char[0] = 0; if (sscanf(std::string(str).c_str(), "%lf%" RTC_TRIAL_UNIT_LENGTH_STR "s", &double_val, unit_char) >= 1) { - return ValueWithUnit{double_val, unit_char}; + return ValueWithUnit{.value = double_val, .unit = unit_char}; } } return std::nullopt; diff --git a/third_party/libwebrtc/rtc_base/experiments/quality_scaling_experiment_unittest.cc b/third_party/libwebrtc/rtc_base/experiments/quality_scaling_experiment_unittest.cc @@ -58,8 +58,17 @@ TEST(QualityScalingExperimentTest, EnabledWithFieldTrial) { } TEST(QualityScalingExperimentTest, ParseSettings) { - const QualityScalingExperiment::Settings kExpected = {1, 2, 3, 4, 5, 6, - 7, 8, 0.9f, 0.99f, 1}; + const QualityScalingExperiment::Settings kExpected = {.vp8_low = 1, + .vp8_high = 2, + .vp9_low = 3, + .vp9_high = 4, + .h264_low = 5, + .h264_high = 6, + .generic_low = 7, + .generic_high = 8, + .alpha_high = 0.9f, + .alpha_low = 0.99f, + .drop = 1}; FieldTrials field_trials( "WebRTC-Video-QualityScaling/Enabled-1,2,3,4,5,6,7,8,0.9,0.99,1/"); const auto settings = QualityScalingExperiment::ParseSettings(field_trials); diff --git a/third_party/libwebrtc/rtc_base/logging.cc b/third_party/libwebrtc/rtc_base/logging.cc @@ -479,7 +479,8 @@ void Log(const LogArgType* fmt, ...) { const char* tag = nullptr; switch (*fmt) { case LogArgType::kLogMetadata: { - meta = {va_arg(args, LogMetadata), ERRCTX_NONE, 0}; + meta = { + .meta = va_arg(args, LogMetadata), .err_ctx = ERRCTX_NONE, .err = 0}; break; } case LogArgType::kLogMetadataErr: { diff --git a/third_party/libwebrtc/rtc_base/openssl_stream_adapter.cc b/third_party/libwebrtc/rtc_base/openssl_stream_adapter.cc @@ -82,10 +82,10 @@ struct SrtpCipherMapEntry { // This isn't elegant, but it's better than an external reference constexpr SrtpCipherMapEntry kSrtpCipherMap[] = { - {"SRTP_AES128_CM_SHA1_80", kSrtpAes128CmSha1_80}, - {"SRTP_AES128_CM_SHA1_32", kSrtpAes128CmSha1_32}, - {"SRTP_AEAD_AES_128_GCM", kSrtpAeadAes128Gcm}, - {"SRTP_AEAD_AES_256_GCM", kSrtpAeadAes256Gcm}}; + {.internal_name = "SRTP_AES128_CM_SHA1_80", .id = kSrtpAes128CmSha1_80}, + {.internal_name = "SRTP_AES128_CM_SHA1_32", .id = kSrtpAes128CmSha1_32}, + {.internal_name = "SRTP_AEAD_AES_128_GCM", .id = kSrtpAeadAes128Gcm}, + {.internal_name = "SRTP_AEAD_AES_256_GCM", .id = kSrtpAeadAes256Gcm}}; #ifdef OPENSSL_IS_BORINGSSL // Enabled by EnableTimeCallbackForTesting. Should never be set in production @@ -1280,16 +1280,17 @@ static const cipher_list OK_ECDSA_ciphers[] = { static const cipher_list OK_DTLS13_ciphers[] = { #ifdef TLS1_3_CK_AES_128_GCM_SHA256 // BoringSSL TLS 1.3 - {static_cast<uint16_t>(TLS1_3_CK_AES_128_GCM_SHA256 & 0xffff), - "TLS_AES_128_GCM_SHA256"}, + {.cipher = static_cast<uint16_t>(TLS1_3_CK_AES_128_GCM_SHA256 & 0xffff), + .cipher_str = "TLS_AES_128_GCM_SHA256"}, #endif #ifdef TLS1_3_CK_AES_256_GCM_SHA256 // BoringSSL TLS 1.3 {static_cast<uint16_t>(TLS1_3_CK_AES_256_GCM_SHA256 & 0xffff), "TLS_AES_256_GCM_SHA256"}, #endif #ifdef TLS1_3_CK_CHACHA20_POLY1305_SHA256 // BoringSSL TLS 1.3 - {static_cast<uint16_t>(TLS1_3_CK_CHACHA20_POLY1305_SHA256 & 0xffff), - "TLS_CHACHA20_POLY1305_SHA256"}, + {.cipher = + static_cast<uint16_t>(TLS1_3_CK_CHACHA20_POLY1305_SHA256 & 0xffff), + .cipher_str = "TLS_CHACHA20_POLY1305_SHA256"}, #endif }; diff --git a/third_party/libwebrtc/rtc_base/physical_socket_server.cc b/third_party/libwebrtc/rtc_base/physical_socket_server.cc @@ -1634,7 +1634,7 @@ void PhysicalSocketServer::AddEpoll(Dispatcher* pdispatcher, uint64_t key) { return; } - struct epoll_event event = {0}; + struct epoll_event event = {}; event.events = GetEpollEvents(pdispatcher->GetRequestedEvents()); if (event.events == 0u) { // Don't add at all if we don't have any requested events. Could indicate a @@ -1657,7 +1657,7 @@ void PhysicalSocketServer::RemoveEpoll(Dispatcher* pdispatcher) { return; } - struct epoll_event event = {0}; + struct epoll_event event = {}; int err = epoll_ctl(epoll_fd_, EPOLL_CTL_DEL, fd, &event); RTC_DCHECK(err == 0 || errno == ENOENT); // Ignore ENOENT, which could occur if this descriptor wasn't added due to @@ -1675,7 +1675,7 @@ void PhysicalSocketServer::UpdateEpoll(Dispatcher* pdispatcher, uint64_t key) { return; } - struct epoll_event event = {0}; + struct epoll_event event = {}; event.events = GetEpollEvents(pdispatcher->GetRequestedEvents()); event.data.u64 = key; // Remove if we don't have any requested events. Could indicate a closed diff --git a/third_party/libwebrtc/rtc_base/ssl_identity_unittest.cc b/third_party/libwebrtc/rtc_base/ssl_identity_unittest.cc @@ -514,58 +514,63 @@ class SSLIdentityExpirationTest : public ::testing::Test { int64_t want; } static const data[] = { // clang-format off - // clang formatting breaks this nice alignment + // clang formatting breaks this nice alignment // Valid examples. - {"19700101000000Z", true, 0}, - {"700101000000Z", false, 0}, - {"19700101000001Z", true, 1}, - {"700101000001Z", false, 1}, - {"19700101000100Z", true, 60}, - {"19700101000101Z", true, 61}, - {"19700101010000Z", true, 3600}, - {"19700101010001Z", true, 3601}, - {"19700101010100Z", true, 3660}, - {"19700101010101Z", true, 3661}, - {"710911012345Z", false, 53400225}, - {"20000101000000Z", true, 946684800}, - {"20000101000000Z", true, 946684800}, - {"20151130140156Z", true, 1448892116}, - {"151130140156Z", false, 1448892116}, - {"20491231235959Z", true, 2524607999}, - {"491231235959Z", false, 2524607999}, - {"20500101000000Z", true, 2524607999+1}, - {"20700101000000Z", true, 3155760000}, - {"21000101000000Z", true, 4102444800}, - {"24000101000000Z", true, 13569465600}, + {.string="19700101000000Z", .long_format=true, .want=0}, + {.string="700101000000Z", .long_format=false, .want=0}, + {.string="19700101000001Z", .long_format=true, .want=1}, + {.string="700101000001Z", .long_format=false, .want=1}, + {.string="19700101000100Z", .long_format=true, .want=60}, + {.string="19700101000101Z", .long_format=true, .want=61}, + {.string="19700101010000Z", .long_format=true, .want=3600}, + {.string="19700101010001Z", .long_format=true, .want=3601}, + {.string="19700101010100Z", .long_format=true, .want=3660}, + {.string="19700101010101Z", .long_format=true, .want=3661}, + {.string="710911012345Z", .long_format=false, .want=53400225}, + {.string="20000101000000Z", .long_format=true, .want=946684800}, + {.string="20000101000000Z", .long_format=true, .want=946684800}, + {.string="20151130140156Z", .long_format=true, .want=1448892116}, + {.string="151130140156Z", .long_format=false, .want=1448892116}, + {.string="20491231235959Z", .long_format=true, .want=2524607999}, + {.string="491231235959Z", .long_format=false, .want=2524607999}, + {.string="20500101000000Z", .long_format=true, .want=2524607999+1}, + {.string="20700101000000Z", .long_format=true, .want=3155760000}, + {.string="21000101000000Z", .long_format=true, .want=4102444800}, + {.string="24000101000000Z", .long_format=true, .want=13569465600}, // Invalid examples. - {"19700101000000", true, -1}, // missing Z long format - {"19700101000000X", true, -1}, // X instead of Z long format - {"197001010000000", true, -1}, // 0 instead of Z long format - {"1970010100000000Z", true, -1}, // excess digits long format - {"700101000000", false, -1}, // missing Z short format - {"700101000000X", false, -1}, // X instead of Z short format - {"7001010000000", false, -1}, // 0 instead of Z short format - {"70010100000000Z", false, -1}, // excess digits short format - {":9700101000000Z", true, -1}, // invalid character - {"1:700101000001Z", true, -1}, // invalid character - {"19:00101000100Z", true, -1}, // invalid character - {"197:0101000101Z", true, -1}, // invalid character - {"1970:101010000Z", true, -1}, // invalid character - {"19700:01010001Z", true, -1}, // invalid character - {"197001:1010100Z", true, -1}, // invalid character - {"1970010:010101Z", true, -1}, // invalid character - {"70010100:000Z", false, -1}, // invalid character - {"700101000:01Z", false, -1}, // invalid character - {"2000010100:000Z", true, -1}, // invalid character - {"21000101000:00Z", true, -1}, // invalid character - {"240001010000:0Z", true, -1}, // invalid character - {"500101000000Z", false, -1}, // but too old for epoch - {"691231235959Z", false, -1}, // too old for epoch - {"19611118043000Z", false, -1}, // way too old for epoch - - // clang-format off + // Long format: missing Z, X instead of Z, 0 instead of Z, + // excess digits. + {.string="19700101000000", .long_format=true, .want=-1}, + {.string="19700101000000X", .long_format=true, .want=-1}, + {.string="197001010000000", .long_format=true, .want=-1}, + {.string="1970010100000000Z", .long_format=true, .want=-1}, + // Short format: missing Z, X instead of Z, 0 instead of Z, + // excess digits. + {.string="700101000000", .long_format=false, .want=-1}, + {.string="700101000000X", .long_format=false, .want=-1}, + {.string="7001010000000", .long_format=false, .want=-1}, + {.string="70010100000000Z", .long_format=false, .want=-1}, + // Invalid character. + {.string=":9700101000000Z", .long_format=true, .want=-1}, + {.string="1:700101000001Z", .long_format=true, .want=-1}, + {.string="19:00101000100Z", .long_format=true, .want=-1}, + {.string="197:0101000101Z", .long_format=true, .want=-1}, + {.string="1970:101010000Z", .long_format=true, .want=-1}, + {.string="19700:01010001Z", .long_format=true, .want=-1}, + {.string="197001:1010100Z", .long_format=true, .want=-1}, + {.string="1970010:010101Z", .long_format=true, .want=-1}, + {.string="70010100:000Z", .long_format=false, .want=-1}, + {.string="700101000:01Z", .long_format=false, .want=-1}, + {.string="2000010100:000Z", .long_format=true, .want=-1}, + {.string="21000101000:00Z", .long_format=true, .want=-1}, + {.string="240001010000:0Z", .long_format=true, .want=-1}, + // Dates prior to unix epoch (January 1st, 1970). + {.string="500101000000Z", .long_format=false, .want=-1}, + {.string="691231235959Z", .long_format=false, .want=-1}, + {.string="19611118043000Z", .long_format=false, .want=-1}, + // clang-format off }; unsigned char buf[EVP_MAX_MD_SIZE]; diff --git a/third_party/libwebrtc/rtc_base/synchronization/yield.cc b/third_party/libwebrtc/rtc_base/synchronization/yield.cc @@ -29,7 +29,7 @@ void YieldCurrentThread() { !RTC_USE_NATIVE_MUTEX_ON_MAC sched_yield(); #else - static const struct timespec ts_null = {0}; + static const struct timespec ts_null = {.tv_sec = 0, .tv_nsec = 0}; nanosleep(&ts_null, nullptr); #endif }