commit 9733648515575659601fce761700e09886317313 parent d6706fdd97cb86b71dc921be12b168417d39a050 Author: Dan Baker <dbaker@mozilla.com> Date: Mon, 27 Oct 2025 16:22:44 -0600 Bug 1995393 - Vendor libwebrtc from 85b252711c Upstream commit: https://webrtc.googlesource.com/src/+/85b252711c2ba8245b5dc73e5824ea3e492672d4 L4S: implement ccfbMessagesReceived stats https://w3c.github.io/webrtc-stats/#dom-rtctransportstats-ccfbmessagesreceived Bug: webrtc:437303401 Change-Id: I2d63e6ecacfb74d808f81d0bad7a35cf9929bcbf Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/403661 Reviewed-by: Harald Alvestrand <hta@webrtc.org> Reviewed-by: Per Kjellander <perkj@webrtc.org> Commit-Queue: Harald Alvestrand <hta@webrtc.org> Cr-Commit-Position: refs/heads/main@{#45498} Diffstat:
16 files changed, 86 insertions(+), 35 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-27T21:46:23.302071+00:00. +libwebrtc updated from /Users/danielbaker/elm/.moz-fast-forward/moz-libwebrtc commit mozpatches on 2025-10-27T22:22:32.280413+00:00. # base of lastest vendoring -1ff10c878b +85b252711c diff --git a/third_party/libwebrtc/api/stats/rtcstats_objects.h b/third_party/libwebrtc/api/stats/rtcstats_objects.h @@ -476,6 +476,8 @@ class RTC_EXPORT RTCTransportStats final : public RTCStats { std::optional<std::string> ice_role; std::optional<std::string> ice_local_username_fragment; std::optional<std::string> ice_state; + // https://w3c.github.io/webrtc-stats/#dom-rtctransportstats-ccfbmessagesreceived + std::optional<int> ccfb_messages_received; }; // https://w3c.github.io/webrtc-stats/#playoutstats-dict* diff --git a/third_party/libwebrtc/call/call.cc b/third_party/libwebrtc/call/call.cc @@ -280,8 +280,8 @@ class Call final : public webrtc::Call, void SetPreferredRtcpCcAckType( RtcpFeedbackType preferred_rtcp_cc_ack_type) override; - int FeedbackAccordingToRfc8888Count() override; - int FeedbackAccordingToTransportCcCount() override; + std::optional<int> FeedbackAccordingToRfc8888Count() override; + std::optional<int> FeedbackAccordingToTransportCcCount() override; TaskQueueBase* network_thread() const override; TaskQueueBase* worker_thread() const override; @@ -1154,6 +1154,10 @@ Call::Stats Call::GetStats() const { stats.max_padding_bitrate_bps = configured_max_padding_bitrate_bps_.load(std::memory_order_relaxed); + // Congestion control feedback messages received. + stats.ccfb_messages_received = + transport_send_->ReceivedCongestionControlFeedbackCount(); + return stats; } @@ -1165,11 +1169,11 @@ void Call::SetPreferredRtcpCcAckType( } // else default to transport CC if correct header extension is negotiated } -int Call::FeedbackAccordingToRfc8888Count() { +std::optional<int> Call::FeedbackAccordingToRfc8888Count() { return transport_send_->ReceivedCongestionControlFeedbackCount(); } -int Call::FeedbackAccordingToTransportCcCount() { +std::optional<int> Call::FeedbackAccordingToTransportCcCount() { return transport_send_->ReceivedTransportCcFeedbackCount(); } diff --git a/third_party/libwebrtc/call/call.h b/third_party/libwebrtc/call/call.h @@ -12,6 +12,7 @@ #include <cstdint> #include <memory> +#include <optional> #include <string> #include "absl/strings/string_view.h" @@ -149,9 +150,8 @@ class Call { // Decides which RTCP feedback type to use for congestion control. virtual void SetPreferredRtcpCcAckType( RtcpFeedbackType preferred_rtcp_cc_ack_type) = 0; - - virtual int FeedbackAccordingToRfc8888Count() = 0; - virtual int FeedbackAccordingToTransportCcCount() = 0; + virtual std::optional<int> FeedbackAccordingToRfc8888Count() = 0; + virtual std::optional<int> FeedbackAccordingToTransportCcCount() = 0; virtual TaskQueueBase* network_thread() const = 0; virtual TaskQueueBase* worker_thread() const = 0; diff --git a/third_party/libwebrtc/call/rtp_transport_controller_send.cc b/third_party/libwebrtc/call/rtp_transport_controller_send.cc @@ -635,6 +635,24 @@ void RtpTransportControllerSend:: packet_router_.ConfigureForRfc8888Feedback(sending_packets_as_ect1_); } +std::optional<int> +RtpTransportControllerSend::ReceivedCongestionControlFeedbackCount() const { + RTC_DCHECK_RUN_ON(&sequence_checker_); + if (!transport_maybe_support_ecn_) { + return std::nullopt; + } + return feedback_count_; +} + +std::optional<int> +RtpTransportControllerSend::ReceivedTransportCcFeedbackCount() const { + RTC_DCHECK_RUN_ON(&sequence_checker_); + if (transport_maybe_support_ecn_) { + return std::nullopt; + } + return transport_cc_feedback_count_; +} + void RtpTransportControllerSend::OnTransportFeedback( Timestamp receive_time, const rtcp::TransportFeedback& feedback) { diff --git a/third_party/libwebrtc/call/rtp_transport_controller_send.h b/third_party/libwebrtc/call/rtp_transport_controller_send.h @@ -145,14 +145,8 @@ class RtpTransportControllerSend final // Called once it's known that the remote end supports RFC 8888. void EnableCongestionControlFeedbackAccordingToRfc8888() override; - int ReceivedCongestionControlFeedbackCount() const override { - RTC_DCHECK_RUN_ON(&sequence_checker_); - return feedback_count_; - } - int ReceivedTransportCcFeedbackCount() const override { - RTC_DCHECK_RUN_ON(&sequence_checker_); - return transport_cc_feedback_count_; - } + std::optional<int> ReceivedCongestionControlFeedbackCount() const override; + std::optional<int> ReceivedTransportCcFeedbackCount() const override; private: void MaybeCreateControllers() RTC_RUN_ON(sequence_checker_); diff --git a/third_party/libwebrtc/call/rtp_transport_controller_send_interface.h b/third_party/libwebrtc/call/rtp_transport_controller_send_interface.h @@ -162,9 +162,9 @@ class RtpTransportControllerSendInterface { // Called once it's known that the remote end supports RFC 8888. virtual void EnableCongestionControlFeedbackAccordingToRfc8888() = 0; // Count of RFC8888 feedback reports received - virtual int ReceivedCongestionControlFeedbackCount() const = 0; + virtual std::optional<int> ReceivedCongestionControlFeedbackCount() const = 0; // Count of transport-cc feedback reports received - virtual int ReceivedTransportCcFeedbackCount() const = 0; + virtual std::optional<int> ReceivedTransportCcFeedbackCount() const = 0; }; } // namespace webrtc diff --git a/third_party/libwebrtc/call/test/mock_rtp_transport_controller_send.h b/third_party/libwebrtc/call/test/mock_rtp_transport_controller_send.h @@ -119,11 +119,14 @@ class MockRtpTransportControllerSend EnableCongestionControlFeedbackAccordingToRfc8888, (), (override)); - MOCK_METHOD(int, + MOCK_METHOD(std::optional<int>, ReceivedCongestionControlFeedbackCount, (), (const, override)); - MOCK_METHOD(int, ReceivedTransportCcFeedbackCount, (), (const, override)); + MOCK_METHOD(std::optional<int>, + ReceivedTransportCcFeedbackCount, + (), + (const, override)); }; } // namespace webrtc #endif // CALL_TEST_MOCK_RTP_TRANSPORT_CONTROLLER_SEND_H_ diff --git a/third_party/libwebrtc/media/engine/fake_webrtc_call.h b/third_party/libwebrtc/media/engine/fake_webrtc_call.h @@ -433,8 +433,8 @@ class FakeCall final : public Call, public PacketReceiver { const BitrateSettings& /* preferences */) override {} void SetPreferredRtcpCcAckType( RtcpFeedbackType preferred_rtcp_cc_ack_type) override {} - int FeedbackAccordingToRfc8888Count() { return 0; } - int FeedbackAccordingToTransportCcCount() { return 0; } + std::optional<int> FeedbackAccordingToRfc8888Count() { return 0; } + std::optional<int> FeedbackAccordingToTransportCcCount() { return 0; } private: AudioSendStream* CreateAudioSendStream( diff --git a/third_party/libwebrtc/moz-patch-stack/s0119.patch b/third_party/libwebrtc/moz-patch-stack/s0119.patch @@ -7,12 +7,12 @@ Differential Revision: https://phabricator.services.mozilla.com/D258499 Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/19164e58323d59c1f66f7fcf671b8d0b6366f708 --- call/call.cc | 13 ------------- - call/call.h | 11 ++--------- + call/call.h | 12 ++---------- modules/desktop_capture/BUILD.gn | 5 +++++ - 3 files changed, 7 insertions(+), 22 deletions(-) + 3 files changed, 7 insertions(+), 23 deletions(-) diff --git a/call/call.cc b/call/call.cc -index 0b756c03a1..8cbffd0374 100644 +index 91ec1a54bc..e41922dffa 100644 --- a/call/call.cc +++ b/call/call.cc @@ -513,19 +513,6 @@ class Call final : public webrtc::Call, @@ -36,10 +36,10 @@ index 0b756c03a1..8cbffd0374 100644 std::unique_ptr<RtpTransportControllerSendInterface> transport_send; if (config.rtp_transport_controller_send_factory != nullptr) { diff --git a/call/call.h b/call/call.h -index 5e3d3de221..aa9da48ebe 100644 +index b2146118ff..cda8733859 100644 --- a/call/call.h +++ b/call/call.h -@@ -25,6 +25,7 @@ +@@ -26,6 +26,7 @@ #include "api/transport/bitrate_settings.h" #include "call/audio_receive_stream.h" #include "call/audio_send_stream.h" @@ -47,7 +47,7 @@ index 5e3d3de221..aa9da48ebe 100644 #include "call/call_config.h" #include "call/flexfec_receive_stream.h" #include "call/packet_receiver.h" -@@ -50,15 +51,7 @@ namespace webrtc { +@@ -51,16 +52,7 @@ namespace webrtc { class Call { public: @@ -59,6 +59,7 @@ index 5e3d3de221..aa9da48ebe 100644 - int recv_bandwidth_bps = 0; // Estimated available receive bandwidth. - int64_t pacer_delay_ms = 0; - int64_t rtt_ms = -1; +- std::optional<int64_t> ccfb_messages_received = std::nullopt; - }; + using Stats = CallBasicStats; diff --git a/third_party/libwebrtc/pc/peer_connection.cc b/third_party/libwebrtc/pc/peer_connection.cc @@ -3003,14 +3003,14 @@ void PeerConnection::RequestUsagePatternReportForTesting() { int PeerConnection::FeedbackAccordingToRfc8888CountForTesting() const { return worker_thread()->BlockingCall([this]() { RTC_DCHECK_RUN_ON(worker_thread()); - return call_->FeedbackAccordingToRfc8888Count(); + return call_->FeedbackAccordingToRfc8888Count().value_or(0); }); } int PeerConnection::FeedbackAccordingToTransportCcCountForTesting() const { return worker_thread()->BlockingCall([this]() { RTC_DCHECK_RUN_ON(worker_thread()); - return call_->FeedbackAccordingToTransportCcCount(); + return call_->FeedbackAccordingToTransportCcCount().value_or(0); }); } diff --git a/third_party/libwebrtc/pc/rtc_stats_collector.cc b/third_party/libwebrtc/pc/rtc_stats_collector.cc @@ -1364,7 +1364,7 @@ void RTCStatsCollector::ProducePartialResultsOnNetworkThreadImpl( ProduceIceCandidateAndPairStats_n(timestamp, transport_stats_by_name, call_stats_, partial_report); ProduceTransportStats_n(timestamp, transport_stats_by_name, - transport_cert_stats, partial_report); + transport_cert_stats, call_stats_, partial_report); ProduceRTPStreamStats_n(timestamp, transceiver_stats_infos_, partial_report); } @@ -1957,6 +1957,7 @@ void RTCStatsCollector::ProduceTransportStats_n( Timestamp timestamp, const std::map<std::string, TransportStats>& transport_stats_by_name, const std::map<std::string, CertificateStatsPair>& transport_cert_stats, + const Call::Stats& call_stats, RTCStatsReport* report) const { RTC_DCHECK_RUN_ON(network_thread_); Thread::ScopedDisallowBlockingCalls no_blocking_calls; @@ -2059,6 +2060,8 @@ void RTCStatsCollector::ProduceTransportStats_n( channel_transport_stats->srtp_cipher = SrtpCryptoSuiteToName(channel_stats.srtp_crypto_suite); } + channel_transport_stats->ccfb_messages_received = + call_stats_.ccfb_messages_received; report->AddStats(std::move(channel_transport_stats)); } } diff --git a/third_party/libwebrtc/pc/rtc_stats_collector.h b/third_party/libwebrtc/pc/rtc_stats_collector.h @@ -225,6 +225,7 @@ class RTCStatsCollector : public RefCountInterface { Timestamp timestamp, const std::map<std::string, TransportStats>& transport_stats_by_name, const std::map<std::string, CertificateStatsPair>& transport_cert_stats, + const Call::Stats& call_stats, RTCStatsReport* report) const; // Helper function to stats-producing functions. diff --git a/third_party/libwebrtc/pc/rtc_stats_collector_unittest.cc b/third_party/libwebrtc/pc/rtc_stats_collector_unittest.cc @@ -2955,19 +2955,23 @@ TEST_F(RTCStatsCollectorTest, CollectRTCTransportStatsWithCrypto) { rtp_transport_channel_stats.dtls_state = DtlsTransportState::kConnected; rtp_transport_channel_stats.ice_transport_stats .selected_candidate_pair_changes = 1; - rtp_transport_channel_stats.ssl_version_bytes = 0x0203; - rtp_transport_channel_stats.dtls_role = SSL_CLIENT; rtp_transport_channel_stats.ice_transport_stats.ice_role = ICEROLE_CONTROLLING; rtp_transport_channel_stats.ice_transport_stats.ice_local_username_fragment = "thelocalufrag"; rtp_transport_channel_stats.ice_transport_stats.ice_state = IceTransportState::kConnected; + rtp_transport_channel_stats.ssl_version_bytes = 0x0203; + rtp_transport_channel_stats.dtls_role = SSL_CLIENT; rtp_transport_channel_stats.tls_cipher_suite_name = "TLS_RSA_WITH_AES_128_CBC_SHA"; rtp_transport_channel_stats.srtp_crypto_suite = kSrtpAes128CmSha1_80; pc_->SetTransportStats(kTransportName, {rtp_transport_channel_stats}); + Call::Stats call_stats; + call_stats.ccfb_messages_received = 5; + pc_->SetCallStats(call_stats); + // Get stats scoped_refptr<const RTCStatsReport> report = stats_->GetStatsReport(); @@ -2989,6 +2993,8 @@ TEST_F(RTCStatsCollectorTest, CollectRTCTransportStatsWithCrypto) { expected_rtp_transport.dtls_role = "client"; expected_rtp_transport.dtls_cipher = "TLS_RSA_WITH_AES_128_CBC_SHA"; expected_rtp_transport.srtp_cipher = "AES_CM_128_HMAC_SHA1_80"; + // CCFB stats. + expected_rtp_transport.ccfb_messages_received = 5; ASSERT_TRUE(report->Get(expected_rtp_transport.id())); EXPECT_EQ( diff --git a/third_party/libwebrtc/pc/rtc_stats_integrationtest.cc b/third_party/libwebrtc/pc/rtc_stats_integrationtest.cc @@ -1018,6 +1018,8 @@ class RTCStatsReportVerifier { verifier.TestAttributeIsDefined(transport.ice_role); verifier.TestAttributeIsDefined(transport.ice_local_username_fragment); verifier.TestAttributeIsDefined(transport.ice_state); + // TODO: bugs.webrtc.org/437303401 - Flip when enabling L4S by default. + verifier.TestAttributeIsUndefined(transport.ccfb_messages_received); return verifier.ExpectAllAttributesSuccessfullyTested(); } @@ -1239,6 +1241,22 @@ TEST_F(RTCStatsIntegrationTest, ExperimentalPsnrStats) { } } +TEST_F(RTCStatsIntegrationTest, ExperimentalTransportCcfbStats) { + StartCall("WebRTC-RFC8888CongestionControlFeedback/Enabled/"); + + // This assumes all other stats are ok and tests the stats which should be + // different under the field trial. + scoped_refptr<const RTCStatsReport> report = GetStatsFromCaller(); + for (const RTCStats& stats : *report) { + if (stats.type() == RTCTransportStats::kType) { + const RTCTransportStats& transport(stats.cast_to<RTCTransportStats>()); + RTCStatsVerifier verifier(report.get(), &transport); + verifier.TestAttributeIsNonNegative<int>( + transport.ccfb_messages_received); + } + } +} + class RTCStatsRtpLifetimeTest : public RTCStatsIntegrationTest { public: RTCStatsRtpLifetimeTest() : RTCStatsIntegrationTest() { diff --git a/third_party/libwebrtc/stats/rtcstats_objects.cc b/third_party/libwebrtc/stats/rtcstats_objects.cc @@ -432,7 +432,8 @@ WEBRTC_RTCSTATS_IMPL(RTCTransportStats, RTCStats, "transport", &selected_candidate_pair_changes), AttributeInit("iceRole", &ice_role), AttributeInit("iceLocalUsernameFragment", &ice_local_username_fragment), - AttributeInit("iceState", &ice_state)) + AttributeInit("iceState", &ice_state), + AttributeInit("ccfbMessagesReceived", &ccfb_messages_received)) // clang-format on RTCTransportStats::RTCTransportStats(std::string id, Timestamp timestamp)