tor-browser

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

commit 566abf4c1f885dd2f7d4bf1038fef44fd61855aa
parent 465c8c13c433cc9d959dcf451b7f8f4ec8772759
Author: Dan Baker <dbaker@mozilla.com>
Date:   Thu, 23 Oct 2025 14:55:14 -0600

Bug 1995393 - Vendor libwebrtc from 59d21f6bc8

Upstream commit: https://webrtc.googlesource.com/src/+/59d21f6bc8a05f91ccffc64cb118ba58526fcede
    Print RTCP message types in rtc_event_log_to_text

    Bug: None
    Change-Id: I20287fb632cdb1fc46fb6b5ff9958fefc7ab58b9
    Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/404242
    Reviewed-by: Erik Språng <sprang@webrtc.org>
    Commit-Queue: Björn Terelius <terelius@webrtc.org>
    Cr-Commit-Position: refs/heads/main@{#45329}

Diffstat:
Mthird_party/libwebrtc/README.mozilla.last-vendor | 4++--
Mthird_party/libwebrtc/logging/rtc_event_log/rtc_event_processor_order.h | 98+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Mthird_party/libwebrtc/rtc_tools/BUILD.gn | 1+
Mthird_party/libwebrtc/rtc_tools/rtc_event_log_to_text/converter.cc | 201+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++----
4 files changed, 294 insertions(+), 10 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-23T20:52:52.753539+00:00. +libwebrtc updated from /Users/danielbaker/elm/.moz-fast-forward/moz-libwebrtc commit mozpatches on 2025-10-23T20:54:58.860135+00:00. # base of lastest vendoring -91c1c68065 +59d21f6bc8 diff --git a/third_party/libwebrtc/logging/rtc_event_log/rtc_event_processor_order.h b/third_party/libwebrtc/logging/rtc_event_log/rtc_event_processor_order.h @@ -453,6 +453,20 @@ class TieBreaker<LoggedRtcpCongestionControlFeedback> { }; template <> +class TieBreaker<LoggedRtcpPacketLossNotification> { + public: + static constexpr int type_order(PacketDirection direction) { + return static_cast<int>(direction == PacketDirection::kIncomingPacket + ? TypeOrder::RtcpIn + : TypeOrder::RtcpOut); + } + static std::optional<uint16_t> transport_seq_num_accessor( + const LoggedRtcpPacketLossNotification&) { + return std::optional<uint16_t>(); + } +}; + +template <> class TieBreaker<LoggedRtcpPacketSenderReport> { public: static constexpr int type_order(PacketDirection direction) { @@ -481,6 +495,90 @@ class TieBreaker<LoggedRtcpPacketReceiverReport> { }; template <> +class TieBreaker<LoggedRtcpPacketExtendedReports> { + public: + static constexpr int type_order(PacketDirection direction) { + return static_cast<int>(direction == PacketDirection::kIncomingPacket + ? TypeOrder::RtcpIn + : TypeOrder::RtcpOut); + } + static std::optional<uint16_t> transport_seq_num_accessor( + const LoggedRtcpPacketExtendedReports&) { + return std::optional<uint16_t>(); + } +}; + +template <> +class TieBreaker<LoggedRtcpPacketNack> { + public: + static constexpr int type_order(PacketDirection direction) { + return static_cast<int>(direction == PacketDirection::kIncomingPacket + ? TypeOrder::RtcpIn + : TypeOrder::RtcpOut); + } + static std::optional<uint16_t> transport_seq_num_accessor( + const LoggedRtcpPacketNack&) { + return std::optional<uint16_t>(); + } +}; + +template <> +class TieBreaker<LoggedRtcpPacketRemb> { + public: + static constexpr int type_order(PacketDirection direction) { + return static_cast<int>(direction == PacketDirection::kIncomingPacket + ? TypeOrder::RtcpIn + : TypeOrder::RtcpOut); + } + static std::optional<uint16_t> transport_seq_num_accessor( + const LoggedRtcpPacketRemb&) { + return std::optional<uint16_t>(); + } +}; + +template <> +class TieBreaker<LoggedRtcpPacketFir> { + public: + static constexpr int type_order(PacketDirection direction) { + return static_cast<int>(direction == PacketDirection::kIncomingPacket + ? TypeOrder::RtcpIn + : TypeOrder::RtcpOut); + } + static std::optional<uint16_t> transport_seq_num_accessor( + const LoggedRtcpPacketFir&) { + return std::optional<uint16_t>(); + } +}; + +template <> +class TieBreaker<LoggedRtcpPacketPli> { + public: + static constexpr int type_order(PacketDirection direction) { + return static_cast<int>(direction == PacketDirection::kIncomingPacket + ? TypeOrder::RtcpIn + : TypeOrder::RtcpOut); + } + static std::optional<uint16_t> transport_seq_num_accessor( + const LoggedRtcpPacketPli&) { + return std::optional<uint16_t>(); + } +}; + +template <> +class TieBreaker<LoggedRtcpPacketBye> { + public: + static constexpr int type_order(PacketDirection direction) { + return static_cast<int>(direction == PacketDirection::kIncomingPacket + ? TypeOrder::RtcpIn + : TypeOrder::RtcpOut); + } + static std::optional<uint16_t> transport_seq_num_accessor( + const LoggedRtcpPacketBye&) { + return std::optional<uint16_t>(); + } +}; + +template <> class TieBreaker<LoggedAlrStateEvent> { public: static constexpr int type_order = static_cast<int>(TypeOrder::AlrState); diff --git a/third_party/libwebrtc/rtc_tools/BUILD.gn b/third_party/libwebrtc/rtc_tools/BUILD.gn @@ -501,6 +501,7 @@ if (rtc_include_tests) { "../logging:rtc_stream_config", "../rtc_base:checks", "../rtc_base:logging", + "../rtc_base:stringutils", "//third_party/abseil-cpp/absl/base:core_headers", "//third_party/abseil-cpp/absl/flags:flag", "//third_party/abseil-cpp/absl/flags:parse", diff --git a/third_party/libwebrtc/rtc_tools/rtc_event_log_to_text/converter.cc b/third_party/libwebrtc/rtc_tools/rtc_event_log_to_text/converter.cc @@ -12,6 +12,7 @@ #include <cinttypes> #include <cstdio> +#include <functional> #include <map> #include <string> #include <vector> @@ -50,6 +51,7 @@ #include "logging/rtc_event_log/rtc_event_processor.h" #include "logging/rtc_event_log/rtc_stream_config.h" #include "rtc_base/logging.h" +#include "rtc_base/strings/str_join.h" namespace webrtc { namespace { @@ -65,6 +67,17 @@ void PrintHeaderExtensionConfig( } } +inline const char* GetLabel(PacketDirection direction) { + static constexpr char kInLabel[] = "IN"; + static constexpr char kOutLabel[] = "OUT"; + return direction == PacketDirection::kIncomingPacket ? kInLabel : kOutLabel; +} + +template <typename T> +auto bind_direction(std::function<void(const T&, PacketDirection)> f, + PacketDirection direction) { + return [f, direction](const T& msg) { f(msg, direction); }; +} } // namespace bool Convert(std::string inputfile, @@ -326,7 +339,7 @@ bool Convert(std::string inputfile, auto incoming_rtp_packet_handler = [&](const LoggedRtpPacketIncoming& event) { fprintf(output, "RTP_IN %" PRId64, event.log_time_ms()); fprintf(output, " ssrc=%u", event.rtp.header.ssrc); - fprintf(output, " seq_no=%u", event.rtp.header.sequenceNumber); + fprintf(output, " seq_num=%u", event.rtp.header.sequenceNumber); fprintf(output, " marker=%u", event.rtp.header.markerBit); fprintf(output, " pt=%u", event.rtp.header.payloadType); fprintf(output, " timestamp=%u", event.rtp.header.timestamp); @@ -349,7 +362,7 @@ bool Convert(std::string inputfile, event.rtp.header.extension.videoRotation); } if (event.rtp.header.extension.hasTransportSequenceNumber) { - fprintf(output, " transport_seq_no=%u", + fprintf(output, " transport_seq_num=%u", event.rtp.header.extension.transportSequenceNumber); } fprintf(output, " header_length=%zu", event.rtp.header_length); @@ -361,7 +374,7 @@ bool Convert(std::string inputfile, auto outgoing_rtp_packet_handler = [&](const LoggedRtpPacketOutgoing& event) { fprintf(output, "RTP_OUT %" PRId64, event.log_time_ms()); fprintf(output, " ssrc=%u", event.rtp.header.ssrc); - fprintf(output, " seq_no=%u", event.rtp.header.sequenceNumber); + fprintf(output, " seq_num=%u", event.rtp.header.sequenceNumber); fprintf(output, " marker=%u", event.rtp.header.markerBit); fprintf(output, " pt=%u", event.rtp.header.payloadType); fprintf(output, " timestamp=%u", event.rtp.header.timestamp); @@ -384,7 +397,7 @@ bool Convert(std::string inputfile, event.rtp.header.extension.videoRotation); } if (event.rtp.header.extension.hasTransportSequenceNumber) { - fprintf(output, " transport_seq_no=%u", + fprintf(output, " transport_seq_num=%u", event.rtp.header.extension.transportSequenceNumber); } fprintf(output, " header_length=%zu", event.rtp.header_length); @@ -405,17 +418,88 @@ bool Convert(std::string inputfile, event.log_time_ms()); }; + auto rr_handler = [&output](const LoggedRtcpPacketReceiverReport& msg, + PacketDirection direction) { + fprintf(output, "RTCP_RR_%s %" PRId64 " <contents omitted>\n", + GetLabel(direction), msg.log_time_ms()); + }; + + auto sr_handler = [&output](const LoggedRtcpPacketSenderReport& msg, + PacketDirection direction) { + fprintf(output, "RTCP_SR_%s %" PRId64 " <contents omitted>\n", + GetLabel(direction), msg.log_time_ms()); + }; + + auto xr_handler = [&output](const LoggedRtcpPacketExtendedReports& msg, + PacketDirection direction) { + fprintf(output, "RTCP_XR_%s %" PRId64 " <contents omitted>\n", + GetLabel(direction), msg.log_time_ms()); + }; + + auto nack_handler = [&output](const LoggedRtcpPacketNack& msg, + PacketDirection direction) { + fprintf(output, "RTCP_NACK_%s %" PRId64 " seq_nums=%s\n", + GetLabel(direction), msg.log_time_ms(), + StrJoin(msg.nack.packet_ids(), ",").c_str()); + }; + + auto remb_handler = [&output](const LoggedRtcpPacketRemb& msg, + PacketDirection direction) { + fprintf(output, "RTCP_REMB_%s %" PRId64 " <contents omitted>\n", + GetLabel(direction), msg.log_time_ms()); + }; + + auto fir_handler = [&output](const LoggedRtcpPacketFir& msg, + PacketDirection direction) { + fprintf(output, "RTCP_FIR_%s %" PRId64 " <contents omitted>\n", + GetLabel(direction), msg.log_time_ms()); + }; + + auto pli_handler = [&output](const LoggedRtcpPacketPli& msg, + PacketDirection direction) { + fprintf(output, "RTCP_PLI_%s %" PRId64 " <contents omitted>\n", + GetLabel(direction), msg.log_time_ms()); + }; + + auto bye_handler = [&output](const LoggedRtcpPacketBye& msg, + PacketDirection direction) { + fprintf(output, "RTCP_BYE_%s %" PRId64 " <contents omitted>\n", + GetLabel(direction), msg.log_time_ms()); + }; + + auto transport_feedback_handler = + [&output](const LoggedRtcpPacketTransportFeedback& msg, + PacketDirection direction) { + fprintf(output, "RTCP_TWCC_%s %" PRId64 " <contents omitted>\n", + GetLabel(direction), msg.log_time_ms()); + }; + + auto congestion_feedback_handler = + [&output](const LoggedRtcpCongestionControlFeedback& msg, + PacketDirection direction) { + fprintf(output, "RTCP_CCFB_%s %" PRId64 " <contents omitted>\n", + GetLabel(direction), msg.log_time_ms()); + }; + + auto loss_notification_handler = + [&output](const LoggedRtcpPacketLossNotification& msg, + PacketDirection direction) { + fprintf(output, + "RTCP_LOSS_NOTIFICATION_%s %" PRId64 " <contents omitted>\n", + GetLabel(direction), msg.log_time_ms()); + }; + auto generic_packet_received_handler = [&](const LoggedGenericPacketReceived& event) { fprintf(output, - "GENERIC_PACKET_RECV %" PRId64 " packet_no=%" PRId64 + "GENERIC_PACKET_RECV %" PRId64 " packet_num=%" PRId64 " length=%d\n", event.log_time_ms(), event.packet_number, event.packet_length); }; auto generic_packet_sent_handler = [&](const LoggedGenericPacketSent& event) { fprintf(output, - "GENERIC_PACKET_SENT %" PRId64 " packet_no=%" PRId64 + "GENERIC_PACKET_SENT %" PRId64 " packet_num=%" PRId64 " overhead_length=%zu " "payload_length=%zu padding_length=%zu\n", event.log_time_ms(), event.packet_number, event.overhead_length, @@ -505,12 +589,113 @@ bool Convert(std::string inputfile, processor.AddEvents(stream.outgoing_packets, outgoing_rtp_packet_handler); } - // RTCP + // RTCP packets processor.AddEvents(parsed_log.incoming_rtcp_packets(), incoming_rtcp_packet_handler); processor.AddEvents(parsed_log.outgoing_rtcp_packets(), outgoing_rtcp_packet_handler); + // RTCP submessages + processor.AddEvents(parsed_log.receiver_reports(kIncomingPacket), + bind_direction<LoggedRtcpPacketReceiverReport>( + rr_handler, kIncomingPacket), + kIncomingPacket); + + processor.AddEvents(parsed_log.receiver_reports(kOutgoingPacket), + bind_direction<LoggedRtcpPacketReceiverReport>( + rr_handler, kOutgoingPacket), + kOutgoingPacket); + + processor.AddEvents( + parsed_log.sender_reports(kIncomingPacket), + bind_direction<LoggedRtcpPacketSenderReport>(sr_handler, kIncomingPacket), + kIncomingPacket); + processor.AddEvents( + parsed_log.sender_reports(kOutgoingPacket), + bind_direction<LoggedRtcpPacketSenderReport>(sr_handler, kOutgoingPacket), + kOutgoingPacket); + + processor.AddEvents(parsed_log.extended_reports(kIncomingPacket), + bind_direction<LoggedRtcpPacketExtendedReports>( + xr_handler, kIncomingPacket), + kIncomingPacket); + processor.AddEvents(parsed_log.extended_reports(kOutgoingPacket), + bind_direction<LoggedRtcpPacketExtendedReports>( + xr_handler, kOutgoingPacket), + kOutgoingPacket); + + processor.AddEvents( + parsed_log.nacks(kIncomingPacket), + bind_direction<LoggedRtcpPacketNack>(nack_handler, kIncomingPacket), + kIncomingPacket); + processor.AddEvents( + parsed_log.nacks(kOutgoingPacket), + bind_direction<LoggedRtcpPacketNack>(nack_handler, kOutgoingPacket), + kOutgoingPacket); + + processor.AddEvents( + parsed_log.rembs(kIncomingPacket), + bind_direction<LoggedRtcpPacketRemb>(remb_handler, kIncomingPacket), + kIncomingPacket); + processor.AddEvents( + parsed_log.rembs(kOutgoingPacket), + bind_direction<LoggedRtcpPacketRemb>(remb_handler, kOutgoingPacket), + kOutgoingPacket); + + processor.AddEvents( + parsed_log.firs(kIncomingPacket), + bind_direction<LoggedRtcpPacketFir>(fir_handler, kIncomingPacket), + kIncomingPacket); + processor.AddEvents( + parsed_log.firs(kOutgoingPacket), + bind_direction<LoggedRtcpPacketFir>(fir_handler, kOutgoingPacket), + kOutgoingPacket); + + processor.AddEvents( + parsed_log.plis(kIncomingPacket), + bind_direction<LoggedRtcpPacketPli>(pli_handler, kIncomingPacket), + kIncomingPacket); + processor.AddEvents( + parsed_log.plis(kOutgoingPacket), + bind_direction<LoggedRtcpPacketPli>(pli_handler, kOutgoingPacket), + kOutgoingPacket); + + processor.AddEvents( + parsed_log.byes(kIncomingPacket), + bind_direction<LoggedRtcpPacketBye>(bye_handler, kIncomingPacket), + kIncomingPacket); + processor.AddEvents( + parsed_log.byes(kOutgoingPacket), + bind_direction<LoggedRtcpPacketBye>(bye_handler, kOutgoingPacket), + kOutgoingPacket); + + processor.AddEvents(parsed_log.transport_feedbacks(kIncomingPacket), + bind_direction<LoggedRtcpPacketTransportFeedback>( + transport_feedback_handler, kIncomingPacket), + kIncomingPacket); + processor.AddEvents(parsed_log.transport_feedbacks(kOutgoingPacket), + bind_direction<LoggedRtcpPacketTransportFeedback>( + transport_feedback_handler, kOutgoingPacket), + kOutgoingPacket); + + processor.AddEvents(parsed_log.congestion_feedback(kIncomingPacket), + bind_direction<LoggedRtcpCongestionControlFeedback>( + congestion_feedback_handler, kIncomingPacket), + kIncomingPacket); + processor.AddEvents(parsed_log.congestion_feedback(kOutgoingPacket), + bind_direction<LoggedRtcpCongestionControlFeedback>( + congestion_feedback_handler, kOutgoingPacket), + kOutgoingPacket); + + processor.AddEvents(parsed_log.loss_notifications(kIncomingPacket), + bind_direction<LoggedRtcpPacketLossNotification>( + loss_notification_handler, kIncomingPacket), + kIncomingPacket); + processor.AddEvents(parsed_log.loss_notifications(kOutgoingPacket), + bind_direction<LoggedRtcpPacketLossNotification>( + loss_notification_handler, kOutgoingPacket), + kOutgoingPacket); + // Generic packets processor.AddEvents(parsed_log.generic_packets_received(), generic_packet_received_handler); @@ -527,6 +712,6 @@ bool Convert(std::string inputfile, processor.ProcessEventsInOrder(); return true; -} +} // NOLINT(readability/fn_size) } // namespace webrtc