tor-browser

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

commit 0d3f0c78935ed724534266f21bcf796d343ba923
parent 6cad922420fe5044caffa835cbae65bd2db92bfa
Author: Dan Baker <dbaker@mozilla.com>
Date:   Mon, 27 Oct 2025 14:24:43 -0600

Bug 1995393 - Vendor libwebrtc from cd1ddc2390

Upstream commit: https://webrtc.googlesource.com/src/+/cd1ddc2390c790cb04c084695653a5f2287a6b3f
    Prepare tests for change in RTP stats object lifetimes.

    Trying to enable "WebRTC-RTP-Lifetime" by default revealed that the
    tests updated in this CL either were not prepared for inbound-rtp being
    missing prior to the first packet having been received and crashing or
    was using fake objects where packet counters and current direction of
    transceivers were not set, resulting in the objects being missing for
    the fake scenario being tested.

    This CL updates the test or test expectations such that they don't care
    if "WebRTC-RTP-Lifetime" is enabled or disabled.

    Bug: chromium:406585888
    Change-Id: I449a1e1be4cb56cfb68a347ee77cd08d03c443a5
    Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/406721
    Commit-Queue: Henrik Boström <hbos@webrtc.org>
    Reviewed-by: Harald Alvestrand <hta@webrtc.org>
    Cr-Commit-Position: refs/heads/main@{#45460}

Diffstat:
Mthird_party/libwebrtc/README.mozilla.last-vendor | 4++--
Mthird_party/libwebrtc/pc/peer_connection_integrationtest.cc | 4+++-
Mthird_party/libwebrtc/pc/rtc_stats_collector_unittest.cc | 13+++++++++++++
Mthird_party/libwebrtc/pc/test/fake_peer_connection_for_stats.h | 2++
Mthird_party/libwebrtc/test/peer_scenario/tests/bwe_ramp_up_test.cc | 11+++++++++--
5 files changed, 29 insertions(+), 5 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-27T20:22:29.671599+00:00. +libwebrtc updated from /Users/danielbaker/elm/.moz-fast-forward/moz-libwebrtc commit mozpatches on 2025-10-27T20:24:31.600141+00:00. # base of lastest vendoring -fdf0cbb8a1 +cd1ddc2390 diff --git a/third_party/libwebrtc/pc/peer_connection_integrationtest.cc b/third_party/libwebrtc/pc/peer_connection_integrationtest.cc @@ -3249,7 +3249,9 @@ TEST_P(PeerConnectionIntegrationTest, DisableAndEnableAudioPlayout) { double GetAudioEnergyStat(PeerConnectionIntegrationWrapper* pc) { auto report = pc->NewGetStats(); auto inbound_rtps = report->GetStatsOfType<RTCInboundRtpStreamStats>(); - RTC_CHECK(!inbound_rtps.empty()); + if (inbound_rtps.empty()) { + return 0.0; + } auto* inbound_rtp = inbound_rtps[0]; if (!inbound_rtp->total_audio_energy.has_value()) { return 0.0; diff --git a/third_party/libwebrtc/pc/rtc_stats_collector_unittest.cc b/third_party/libwebrtc/pc/rtc_stats_collector_unittest.cc @@ -713,6 +713,7 @@ class RTCStatsCollectorTest : public ::testing::Test { video_media_info.receivers[0].local_stats.push_back(SsrcReceiverInfo()); video_media_info.receivers[0].local_stats[0].ssrc = 4; video_media_info.receivers[0].codec_payload_type = recv_codec.payload_type; + video_media_info.receivers[0].packets_received = 123; // transport graph.transport_id = "TTransportName1"; pc_->AddVideoChannel("VideoMid", "TransportName", video_media_info); @@ -799,6 +800,7 @@ class RTCStatsCollectorTest : public ::testing::Test { media_info.receivers.push_back(VoiceReceiverInfo()); media_info.receivers[0].local_stats.push_back(SsrcReceiverInfo()); media_info.receivers[0].local_stats[0].ssrc = kRemoteSsrc; + media_info.receivers[0].packets_received = 123; media_info.receivers[0].codec_payload_type = recv_codec.payload_type; // remote-outbound-rtp if (add_remote_outbound_stats) { @@ -994,12 +996,14 @@ TEST_F(RTCStatsCollectorTest, ValidSsrcCollisionDoesNotCrash) { VoiceMediaInfo mid1_info; mid1_info.receivers.emplace_back(); mid1_info.receivers[0].add_ssrc(1); + mid1_info.receivers[0].packets_received = 123; mid1_info.senders.emplace_back(); mid1_info.senders[0].add_ssrc(2); pc_->AddVoiceChannel("Mid1", "Transport1", mid1_info); VideoMediaInfo mid2_info; mid2_info.receivers.emplace_back(); mid2_info.receivers[0].add_ssrc(3); + mid2_info.receivers[0].packets_received = 123; mid2_info.senders.emplace_back(); mid2_info.senders[0].add_ssrc(4); pc_->AddVideoChannel("Mid2", "Transport1", mid2_info); @@ -1008,12 +1012,14 @@ TEST_F(RTCStatsCollectorTest, ValidSsrcCollisionDoesNotCrash) { VoiceMediaInfo mid3_info; mid3_info.receivers.emplace_back(); mid3_info.receivers[0].add_ssrc(1); + mid3_info.receivers[0].packets_received = 123; mid3_info.senders.emplace_back(); mid3_info.senders[0].add_ssrc(2); pc_->AddVoiceChannel("Mid3", "Transport2", mid3_info); VideoMediaInfo mid4_info; mid4_info.receivers.emplace_back(); mid4_info.receivers[0].add_ssrc(3); + mid4_info.receivers[0].packets_received = 123; mid4_info.senders.emplace_back(); mid4_info.senders[0].add_ssrc(4); pc_->AddVideoChannel("Mid4", "Transport2", mid4_info); @@ -1111,6 +1117,7 @@ TEST_F(RTCStatsCollectorTest, CollectRTCCodecStatsOnlyIfReferenced) { VoiceReceiverInfo inbound_audio_info; inbound_audio_info.add_ssrc(10); inbound_audio_info.codec_payload_type = 1; + inbound_audio_info.packets_received = 123; voice_media_info.receivers.push_back(inbound_audio_info); VoiceSenderInfo outbound_audio_info; @@ -1121,6 +1128,7 @@ TEST_F(RTCStatsCollectorTest, CollectRTCCodecStatsOnlyIfReferenced) { VideoReceiverInfo inbound_video_info; inbound_video_info.add_ssrc(30); inbound_video_info.codec_payload_type = 3; + inbound_video_info.packets_received = 123; video_media_info.receivers.push_back(inbound_video_info); VideoSenderInfo outbound_video_info; @@ -1298,6 +1306,7 @@ TEST_F(RTCStatsCollectorTest, SamePayloadTypeButDifferentFmtpLines) { inbound_codec_pt111_nofec.payload_type, inbound_codec_pt111_nofec)); info_nofec.receivers.emplace_back(); info_nofec.receivers[0].add_ssrc(123); + info_nofec.receivers[0].packets_received = 123; info_nofec.receivers[0].codec_payload_type = inbound_codec_pt111_nofec.payload_type; VideoMediaInfo info_fec; @@ -1305,6 +1314,7 @@ TEST_F(RTCStatsCollectorTest, SamePayloadTypeButDifferentFmtpLines) { inbound_codec_pt111_fec.payload_type, inbound_codec_pt111_fec)); info_fec.receivers.emplace_back(); info_fec.receivers[0].add_ssrc(321); + info_fec.receivers[0].packets_received = 123; info_fec.receivers[0].codec_payload_type = inbound_codec_pt111_fec.payload_type; @@ -1345,6 +1355,7 @@ TEST_F(RTCStatsCollectorTest, SamePayloadTypeButDifferentFmtpLines) { inbound_codec_pt112_fec.payload_type, inbound_codec_pt112_fec)); info_fec_pt112.receivers.emplace_back(); info_fec_pt112.receivers[0].add_ssrc(112); + info_fec_pt112.receivers[0].packets_received = 123; info_fec_pt112.receivers[0].codec_payload_type = inbound_codec_pt112_fec.payload_type; pc_->AddVideoChannel("Mid5", "BundledTransport", info_fec_pt112); @@ -2267,6 +2278,7 @@ TEST_F(RTCStatsCollectorTest, CollectRTCInboundRtpStreamStats_Audio_PlayoutId) { voice_media_info.receivers.push_back(VoiceReceiverInfo()); voice_media_info.receivers[0].local_stats.push_back(SsrcReceiverInfo()); voice_media_info.receivers[0].local_stats[0].ssrc = 1; + voice_media_info.receivers[0].packets_received = 123; pc_->AddVoiceChannel("AudioMid", "TransportName", voice_media_info); stats_->SetupRemoteTrackAndReceiver(MediaType::AUDIO, "RemoteAudioTrackID", @@ -2495,6 +2507,7 @@ TEST_F(RTCStatsCollectorTest, CollectGoogTimingFrameInfo) { video_media_info.receivers.push_back(VideoReceiverInfo()); video_media_info.receivers[0].local_stats.push_back(SsrcReceiverInfo()); video_media_info.receivers[0].local_stats[0].ssrc = 1; + video_media_info.receivers[0].packets_received = 123; TimingFrameInfo timing_frame_info; timing_frame_info.rtp_timestamp = 1; timing_frame_info.capture_time_ms = 2; diff --git a/third_party/libwebrtc/pc/test/fake_peer_connection_for_stats.h b/third_party/libwebrtc/pc/test/fake_peer_connection_for_stats.h @@ -548,6 +548,8 @@ class FakePeerConnectionForStats : public FakePeerConnectionBase { signaling_thread_, make_ref_counted<RtpTransceiver>( context_->env(), media_type, context_.get(), &codec_lookup_helper_)); + transceiver->internal()->set_current_direction( + RtpTransceiverDirection::kSendRecv); transceivers_.push_back(transceiver); return transceiver; } diff --git a/third_party/libwebrtc/test/peer_scenario/tests/bwe_ramp_up_test.cc b/third_party/libwebrtc/test/peer_scenario/tests/bwe_ramp_up_test.cc @@ -184,10 +184,17 @@ TEST(BweRampupTest, RampUpWithUndemuxableRtpPackets) { DataRate initial_bwe = GetAvailableSendBitrate(GetStatsAndProcess(s, caller)); s.ProcessMessages(TimeDelta::Seconds(2)); + // Since the packets are undemuxable, no packets or frames will be received. + // This means either that inbound-rtp does not exist at all or that it exists + // but no frames have been received, depending on status of field trial + // "WebRTC-RTP-Lifetime" which controls if inbound-rtp is created before or + // after first packet is received. + // TODO(crbug.com/406585888): When cleaning up the field trial, change this + // assertion to `ASSERT_THAT(callee_inbound_stats, SizeIs(0))`. auto callee_inbound_stats = GetStatsAndProcess(s, callee)->GetStatsOfType<RTCInboundRtpStreamStats>(); - ASSERT_THAT(callee_inbound_stats, SizeIs(1)); - ASSERT_EQ(*callee_inbound_stats[0]->frames_received, 0u); + ASSERT_TRUE(callee_inbound_stats.empty() || + *callee_inbound_stats[0]->frames_received == 0u); DataRate final_bwe = GetAvailableSendBitrate(GetStatsAndProcess(s, caller)); // Ensure BWE has increased from the initial BWE. BWE will not increase unless