tor-browser

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

commit 0f0bdd4214264bc7f29b286874ef3cbd278a5a9c
parent e6787fd56d89a5aaedcd16b1688e3af3ed959c27
Author: Dan Baker <dbaker@mozilla.com>
Date:   Mon, 27 Oct 2025 14:50:49 -0600

Bug 1995393 - Vendor libwebrtc from b2a3a643c4

Upstream commit: https://webrtc.googlesource.com/src/+/b2a3a643c43e469c84ea26b8fbd8de15973d4902
    clang-tidy: apply modernize-use-designated-initializer to modules/ logging/

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

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

Diffstat:
Mthird_party/libwebrtc/README.mozilla.last-vendor | 4++--
Mthird_party/libwebrtc/logging/rtc_event_log/events/rtc_event_begin_log.cc | 5++++-
Mthird_party/libwebrtc/logging/rtc_event_log/events/rtc_event_end_log.cc | 5++++-
Mthird_party/libwebrtc/logging/rtc_event_log/events/rtc_event_field_encoding.cc | 8+++++---
Mthird_party/libwebrtc/logging/rtc_event_log/events/rtc_event_field_encoding_parser.cc | 2+-
Mthird_party/libwebrtc/logging/rtc_event_log/events/rtc_event_field_encoding_unittest.cc | 67+++++++++++++++++++++++++++++++++++++++++++++++++------------------
Mthird_party/libwebrtc/logging/rtc_event_log/rtc_event_log_parser.cc | 14++++++++------
Mthird_party/libwebrtc/logging/rtc_event_log/rtc_event_log_unittest_helper.cc | 26++++++++++++++------------
Mthird_party/libwebrtc/modules/congestion_controller/goog_cc/send_side_bandwidth_estimation.cc | 8+++++---
Mthird_party/libwebrtc/modules/desktop_capture/desktop_and_cursor_composer_unittest.cc | 26+++++++++++++++++---------
Mthird_party/libwebrtc/modules/desktop_capture/desktop_frame_unittest.cc | 426++++++++++++++++++++++++++++++++++++++++---------------------------------------
Mthird_party/libwebrtc/modules/desktop_capture/desktop_region_unittest.cc | 711++++++++++++++++++++++++++++++++++++++++---------------------------------------
Mthird_party/libwebrtc/modules/desktop_capture/linux/wayland/screencast_stream_utils.cc | 11+++++++----
Mthird_party/libwebrtc/modules/desktop_capture/linux/wayland/shared_screencast_stream.cc | 22++++++++++++++--------
Mthird_party/libwebrtc/modules/desktop_capture/linux/wayland/test/test_screencast_stream_provider.cc | 5+++--
Mthird_party/libwebrtc/modules/remote_bitrate_estimator/transport_sequence_number_feedback_generator_unittest.cc | 6+++---
Mthird_party/libwebrtc/modules/rtp_rtcp/source/absolute_capture_time_interpolator_unittest.cc | 72++++++++++++++++++++++++++++++++++++++++++++----------------------------
Mthird_party/libwebrtc/modules/rtp_rtcp/source/absolute_capture_time_sender_unittest.cc | 169+++++++++++++++++++++++++++++++++++++++++++++++--------------------------------
Mthird_party/libwebrtc/modules/rtp_rtcp/source/rtcp_transceiver_impl.cc | 3++-
Mthird_party/libwebrtc/modules/rtp_rtcp/source/rtp_header_extension_size_unittest.cc | 24+++++++++++++++---------
Mthird_party/libwebrtc/modules/rtp_rtcp/source/rtp_header_extensions.cc | 3++-
Mthird_party/libwebrtc/modules/rtp_rtcp/source/rtp_packet_unittest.cc | 12++++++------
Mthird_party/libwebrtc/modules/rtp_rtcp/source/rtp_rtcp_impl2.cc | 7++++---
Mthird_party/libwebrtc/modules/rtp_rtcp/source/rtp_rtcp_impl2_unittest.cc | 8+++++++-
Mthird_party/libwebrtc/modules/rtp_rtcp/source/rtp_sender.cc | 4++--
Mthird_party/libwebrtc/modules/rtp_rtcp/source/rtp_sender_egress.cc | 3++-
Mthird_party/libwebrtc/modules/rtp_rtcp/source/rtp_sender_video_unittest.cc | 4++--
Mthird_party/libwebrtc/modules/rtp_rtcp/source/source_tracker_unittest.cc | 29++++++++++++++++++-----------
Mthird_party/libwebrtc/modules/rtp_rtcp/source/ulpfec_generator_unittest.cc | 20++++++++++++--------
Mthird_party/libwebrtc/modules/rtp_rtcp/source/video_rtp_depacketizer_h264_unittest.cc | 4+++-
Mthird_party/libwebrtc/modules/video_capture/linux/video_capture_pipewire.cc | 36+++++++++++++++++++-----------------
Mthird_party/libwebrtc/moz-patch-stack/s0001.patch | 8++++----
Mthird_party/libwebrtc/moz-patch-stack/s0003.patch | 2+-
Mthird_party/libwebrtc/moz-patch-stack/s0004.patch | 2+-
Mthird_party/libwebrtc/moz-patch-stack/s0042.patch | 2+-
Mthird_party/libwebrtc/moz-patch-stack/s0049.patch | 8++++----
Mthird_party/libwebrtc/moz-patch-stack/s0074.patch | 4++--
Mthird_party/libwebrtc/moz-patch-stack/s0075.patch | 8++++----
38 files changed, 966 insertions(+), 812 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:48:36.482443+00:00. +libwebrtc updated from /Users/danielbaker/elm/.moz-fast-forward/moz-libwebrtc commit mozpatches on 2025-10-27T20:50:36.608619+00:00. # base of lastest vendoring -98db746a35 +b2a3a643c4 diff --git a/third_party/libwebrtc/logging/rtc_event_log/events/rtc_event_begin_log.cc b/third_party/libwebrtc/logging/rtc_event_log/events/rtc_event_begin_log.cc @@ -53,7 +53,10 @@ RtcEventLogParseStatus RtcEventBeginLog::Parse( ExtendLoggedBatch(output, parser.NumEventsInBatch()); constexpr FieldParameters timestamp_params{ - "timestamp_ms", FieldParameters::kTimestampField, FieldType::kVarInt, 64}; + .name = "timestamp_ms", + .field_id = FieldParameters::kTimestampField, + .field_type = FieldType::kVarInt, + .value_width = 64}; RtcEventLogParseStatusOr<ArrayView<uint64_t>> result = parser.ParseNumericField(timestamp_params); if (!result.ok()) diff --git a/third_party/libwebrtc/logging/rtc_event_log/events/rtc_event_end_log.cc b/third_party/libwebrtc/logging/rtc_event_log/events/rtc_event_end_log.cc @@ -47,7 +47,10 @@ RtcEventLogParseStatus RtcEventEndLog::Parse( ExtendLoggedBatch(output, parser.NumEventsInBatch()); constexpr FieldParameters timestamp_params{ - "timestamp_ms", FieldParameters::kTimestampField, FieldType::kVarInt, 64}; + .name = "timestamp_ms", + .field_id = FieldParameters::kTimestampField, + .field_type = FieldType::kVarInt, + .value_width = 64}; RtcEventLogParseStatusOr<ArrayView<uint64_t>> result = parser.ParseNumericField(timestamp_params); if (!result.ok()) diff --git a/third_party/libwebrtc/logging/rtc_event_log/events/rtc_event_field_encoding.cc b/third_party/libwebrtc/logging/rtc_event_log/events/rtc_event_field_encoding.cc @@ -163,9 +163,11 @@ EventEncoder::EventEncoder(EventParameters params, for (const RtcEvent* event : batch) { timestamps.push_back(EncodeAsUnsigned(event->timestamp_ms())); } - constexpr FieldParameters timestamp_params{"timestamp_ms", - FieldParameters::kTimestampField, - FieldType::kVarInt, 64}; + constexpr FieldParameters timestamp_params{ + .name = "timestamp_ms", + .field_id = FieldParameters::kTimestampField, + .field_type = FieldType::kVarInt, + .value_width = 64}; EncodeField(timestamp_params, timestamps); } } diff --git a/third_party/libwebrtc/logging/rtc_event_log/events/rtc_event_field_encoding_parser.cc b/third_party/libwebrtc/logging/rtc_event_log/events/rtc_event_field_encoding_parser.cc @@ -396,7 +396,7 @@ EventParser::ParseOptionalNumericField(const FieldParameters& params, auto status = ParseField(params); if (!status.ok()) return StatusOr(status); - ValueAndPostionView view{GetValues(), GetPositions()}; + ValueAndPostionView view{.values = GetValues(), .positions = GetPositions()}; if (required_field && view.positions.size() != NumEventsInBatch()) { return StatusOr::Error("Required numerical field not found", __FILE__, __LINE__); diff --git a/third_party/libwebrtc/logging/rtc_event_log/events/rtc_event_field_encoding_unittest.cc b/third_party/libwebrtc/logging/rtc_event_log/events/rtc_event_field_encoding_unittest.cc @@ -184,26 +184,57 @@ class RtcTestEvent final : public RtcEvent { bool IsConfigEvent() const override { return false; } static constexpr EventParameters event_params{ - "TestEvent", static_cast<RtcEvent::Type>(4711)}; + .name = "TestEvent", + .id = static_cast<RtcEvent::Type>(4711)}; static constexpr FieldParameters timestamp_params{ - "timestamp_ms", FieldParameters::kTimestampField, FieldType::kVarInt, 64}; - static constexpr FieldParameters bool_params{"b", 2, FieldType::kFixed8, 1}; - static constexpr FieldParameters signed32_params{"signed32", 3, - FieldType::kVarInt, 32}; - static constexpr FieldParameters unsigned32_params{"unsigned32", 4, - FieldType::kFixed32, 32}; - static constexpr FieldParameters signed64_params{"signed64", 5, - FieldType::kFixed64, 64}; - static constexpr FieldParameters unsigned64_params{"unsigned64", 6, - FieldType::kVarInt, 64}; - static constexpr FieldParameters optional32_params{"optional_signed32", 7, - FieldType::kFixed32, 32}; - static constexpr FieldParameters optional64_params{"optional_signed64", 8, - FieldType::kVarInt, 64}; - static constexpr FieldParameters wrapping21_params{"wrapping21", 9, - FieldType::kFixed32, 21}; + .name = "timestamp_ms", + .field_id = FieldParameters::kTimestampField, + .field_type = FieldType::kVarInt, + .value_width = 64}; + static constexpr FieldParameters bool_params{.name = "b", + .field_id = 2, + .field_type = FieldType::kFixed8, + .value_width = 1}; + static constexpr FieldParameters signed32_params{ + .name = "signed32", + .field_id = 3, + .field_type = FieldType::kVarInt, + .value_width = 32}; + static constexpr FieldParameters unsigned32_params{ + .name = "unsigned32", + .field_id = 4, + .field_type = FieldType::kFixed32, + .value_width = 32}; + static constexpr FieldParameters signed64_params{ + .name = "signed64", + .field_id = 5, + .field_type = FieldType::kFixed64, + .value_width = 64}; + static constexpr FieldParameters unsigned64_params{ + .name = "unsigned64", + .field_id = 6, + .field_type = FieldType::kVarInt, + .value_width = 64}; + static constexpr FieldParameters optional32_params{ + .name = "optional_signed32", + .field_id = 7, + .field_type = FieldType::kFixed32, + .value_width = 32}; + static constexpr FieldParameters optional64_params{ + .name = "optional_signed64", + .field_id = 8, + .field_type = FieldType::kVarInt, + .value_width = 64}; + static constexpr FieldParameters wrapping21_params{ + .name = "wrapping21", + .field_id = 9, + .field_type = FieldType::kFixed32, + .value_width = 21}; static constexpr FieldParameters string_params{ - "string", 10, FieldType::kString, /*value_width = */ 0}; + .name = "string", + .field_id = 10, + .field_type = FieldType::kString, + .value_width = 0}; static constexpr Type kType = static_cast<RtcEvent::Type>(4711); diff --git a/third_party/libwebrtc/logging/rtc_event_log/rtc_event_log_parser.cc b/third_party/libwebrtc/logging/rtc_event_log/rtc_event_log_parser.cc @@ -2676,14 +2676,16 @@ std::vector<LoggedIceEvent> ParsedRtcEventLog::GetIceEvents() const { {ConfigType::kSelected, Combined::kSelected}}); std::vector<LoggedIceEvent> log_events; auto handle_check = [&](const LoggedIceCandidatePairEvent& check) { - log_events.push_back(LoggedIceEvent{check.candidate_pair_id, - Timestamp::Millis(check.log_time_ms()), - check_map[check.type]}); + log_events.push_back( + LoggedIceEvent{.candidate_pair_id = check.candidate_pair_id, + .log_time = Timestamp::Millis(check.log_time_ms()), + .event_type = check_map[check.type]}); }; auto handle_config = [&](const LoggedIceCandidatePairConfig& conf) { - log_events.push_back(LoggedIceEvent{conf.candidate_pair_id, - Timestamp::Millis(conf.log_time_ms()), - config_map[conf.type]}); + log_events.push_back( + LoggedIceEvent{.candidate_pair_id = conf.candidate_pair_id, + .log_time = Timestamp::Millis(conf.log_time_ms()), + .event_type = config_map[conf.type]}); }; RtcEventProcessor process; process.AddEvents(ice_candidate_pair_events(), handle_check); diff --git a/third_party/libwebrtc/logging/rtc_event_log/rtc_event_log_unittest_helper.cc b/third_party/libwebrtc/logging/rtc_event_log/rtc_event_log_unittest_helper.cc @@ -114,17 +114,18 @@ constexpr int kMaxExtensionSizeBytes = 10; constexpr int kMaxNumExtensions = 6; constexpr ExtensionPair kExtensions[kMaxNumExtensions] = { - {RTPExtensionType::kRtpExtensionTransmissionTimeOffset, - RtpExtension::kTimestampOffsetUri}, - {RTPExtensionType::kRtpExtensionAbsoluteSendTime, - RtpExtension::kAbsSendTimeUri}, - {RTPExtensionType::kRtpExtensionTransportSequenceNumber, - RtpExtension::kTransportSequenceNumberUri}, - {RTPExtensionType::kRtpExtensionAudioLevel, RtpExtension::kAudioLevelUri}, - {RTPExtensionType::kRtpExtensionVideoRotation, - RtpExtension::kVideoRotationUri}, - {RTPExtensionType::kRtpExtensionDependencyDescriptor, - RtpExtension::kDependencyDescriptorUri}}; + {.type = RTPExtensionType::kRtpExtensionTransmissionTimeOffset, + .name = RtpExtension::kTimestampOffsetUri}, + {.type = RTPExtensionType::kRtpExtensionAbsoluteSendTime, + .name = RtpExtension::kAbsSendTimeUri}, + {.type = RTPExtensionType::kRtpExtensionTransportSequenceNumber, + .name = RtpExtension::kTransportSequenceNumberUri}, + {.type = RTPExtensionType::kRtpExtensionAudioLevel, + .name = RtpExtension::kAudioLevelUri}, + {.type = RTPExtensionType::kRtpExtensionVideoRotation, + .name = RtpExtension::kVideoRotationUri}, + {.type = RTPExtensionType::kRtpExtensionDependencyDescriptor, + .name = RtpExtension::kDependencyDescriptorUri}}; MATCHER_P2(Near, value, margin, "") { return value - margin < arg && arg < value + margin; @@ -636,7 +637,8 @@ EventGenerator::NewGenericAckReceived() { if (prng_.Rand(0, 2) > 0) { receive_timestamp = prng_.Rand(0, 100000); } - AckedPacket packet[1] = {{prng_.Rand(40, 250), receive_timestamp}}; + AckedPacket packet[1] = {{.packet_number = prng_.Rand(40, 250), + .receive_acked_packet_time_ms = receive_timestamp}}; return std::move(RtcEventGenericAckReceived::CreateLogs( received_packet_number_++, packet)[0]); } diff --git a/third_party/libwebrtc/modules/congestion_controller/goog_cc/send_side_bandwidth_estimation.cc b/third_party/libwebrtc/modules/congestion_controller/goog_cc/send_side_bandwidth_estimation.cc @@ -57,9 +57,11 @@ struct UmaRampUpMetric { }; const UmaRampUpMetric kUmaRampupMetrics[] = { - {"WebRTC.BWE.RampUpTimeTo500kbpsInMs", 500}, - {"WebRTC.BWE.RampUpTimeTo1000kbpsInMs", 1000}, - {"WebRTC.BWE.RampUpTimeTo2000kbpsInMs", 2000}}; + {.metric_name = "WebRTC.BWE.RampUpTimeTo500kbpsInMs", .bitrate_kbps = 500}, + {.metric_name = "WebRTC.BWE.RampUpTimeTo1000kbpsInMs", + .bitrate_kbps = 1000}, + {.metric_name = "WebRTC.BWE.RampUpTimeTo2000kbpsInMs", + .bitrate_kbps = 2000}}; const size_t kNumUmaRampupMetrics = sizeof(kUmaRampupMetrics) / sizeof(kUmaRampupMetrics[0]); diff --git a/third_party/libwebrtc/modules/desktop_capture/desktop_and_cursor_composer_unittest.cc b/third_party/libwebrtc/modules/desktop_capture/desktop_and_cursor_composer_unittest.cc @@ -242,11 +242,19 @@ TEST_F(DesktopAndCursorComposerTest, CursorShouldBeIgnoredIfNoFrameCaptured) { int hotspot_x, hotspot_y; bool inside; } tests[] = { - {0, 0, 0, 0, true}, {50, 50, 0, 0, true}, {100, 50, 0, 0, true}, - {50, 100, 0, 0, true}, {100, 100, 0, 0, true}, {0, 0, 2, 5, true}, - {1, 1, 2, 5, true}, {50, 50, 2, 5, true}, {100, 100, 2, 5, true}, - {0, 0, 5, 2, true}, {50, 50, 5, 2, true}, {100, 100, 5, 2, true}, - {0, 0, 0, 0, false}, + {.x = 0, .y = 0, .hotspot_x = 0, .hotspot_y = 0, .inside = true}, + {.x = 50, .y = 50, .hotspot_x = 0, .hotspot_y = 0, .inside = true}, + {.x = 100, .y = 50, .hotspot_x = 0, .hotspot_y = 0, .inside = true}, + {.x = 50, .y = 100, .hotspot_x = 0, .hotspot_y = 0, .inside = true}, + {.x = 100, .y = 100, .hotspot_x = 0, .hotspot_y = 0, .inside = true}, + {.x = 0, .y = 0, .hotspot_x = 2, .hotspot_y = 5, .inside = true}, + {.x = 1, .y = 1, .hotspot_x = 2, .hotspot_y = 5, .inside = true}, + {.x = 50, .y = 50, .hotspot_x = 2, .hotspot_y = 5, .inside = true}, + {.x = 100, .y = 100, .hotspot_x = 2, .hotspot_y = 5, .inside = true}, + {.x = 0, .y = 0, .hotspot_x = 5, .hotspot_y = 2, .inside = true}, + {.x = 50, .y = 50, .hotspot_x = 5, .hotspot_y = 2, .inside = true}, + {.x = 100, .y = 100, .hotspot_x = 5, .hotspot_y = 2, .inside = true}, + {.x = 0, .y = 0, .hotspot_x = 0, .hotspot_y = 0, .inside = false}, }; for (size_t i = 0; i < std::size(tests); i++) { @@ -282,10 +290,10 @@ TEST_F(DesktopAndCursorComposerTest, CursorShouldBeIgnoredIfFrameMayContainIt) { int y; bool may_contain_cursor; } tests[] = { - {100, 200, true}, - {100, 200, false}, - {150, 250, true}, - {150, 250, false}, + {.x = 100, .y = 200, .may_contain_cursor = true}, + {.x = 100, .y = 200, .may_contain_cursor = false}, + {.x = 150, .y = 250, .may_contain_cursor = true}, + {.x = 150, .y = 250, .may_contain_cursor = false}, }; for (size_t i = 0; i < std::size(tests); i++) { SCOPED_TRACE(i); diff --git a/third_party/libwebrtc/modules/desktop_capture/desktop_frame_unittest.cc b/third_party/libwebrtc/modules/desktop_capture/desktop_frame_unittest.cc @@ -118,21 +118,20 @@ TEST(DesktopFrameTest, FrameDataSwitchesBetweenNonBlackAndBlack) { } TEST(DesktopFrameTest, CopyIntersectingPixelsMatchingRects) { - // clang-format off const TestData tests[] = { - {"0 origin", - DesktopRect::MakeXYWH(0, 0, 2, 2), - DesktopRect::MakeXYWH(0, 0, 2, 2), - 1.0, 1.0, - DesktopRect::MakeXYWH(0, 0, 2, 2)}, - - {"Negative origin", - DesktopRect::MakeXYWH(-1, -1, 2, 2), - DesktopRect::MakeXYWH(-1, -1, 2, 2), - 1.0, 1.0, - DesktopRect::MakeXYWH(-1, -1, 2, 2)} - }; - // clang-format on + {.description = "0 origin", + .dest_frame_rect = DesktopRect::MakeXYWH(0, 0, 2, 2), + .src_frame_rect = DesktopRect::MakeXYWH(0, 0, 2, 2), + .horizontal_scale = 1.0, + .vertical_scale = 1.0, + .expected_overlap_rect = DesktopRect::MakeXYWH(0, 0, 2, 2)}, + + {.description = "Negative origin", + .dest_frame_rect = DesktopRect::MakeXYWH(-1, -1, 2, 2), + .src_frame_rect = DesktopRect::MakeXYWH(-1, -1, 2, 2), + .horizontal_scale = 1.0, + .vertical_scale = 1.0, + .expected_overlap_rect = DesktopRect::MakeXYWH(-1, -1, 2, 2)}}; RunTests(tests); } @@ -140,239 +139,246 @@ TEST(DesktopFrameTest, CopyIntersectingPixelsMatchingRects) { TEST(DesktopFrameTest, CopyIntersectingPixelsMatchingRectsScaled) { // The scale factors shouldn't affect matching rects (they're only applied // to any difference between the origins) - // clang-format off const TestData tests[] = { - {"0 origin 2x", - DesktopRect::MakeXYWH(0, 0, 2, 2), - DesktopRect::MakeXYWH(0, 0, 2, 2), - 2.0, 2.0, - DesktopRect::MakeXYWH(0, 0, 2, 2)}, - - {"0 origin 0.5x", - DesktopRect::MakeXYWH(0, 0, 2, 2), - DesktopRect::MakeXYWH(0, 0, 2, 2), - 0.5, 0.5, - DesktopRect::MakeXYWH(0, 0, 2, 2)}, - - {"Negative origin 2x", - DesktopRect::MakeXYWH(-1, -1, 2, 2), - DesktopRect::MakeXYWH(-1, -1, 2, 2), - 2.0, 2.0, - DesktopRect::MakeXYWH(-1, -1, 2, 2)}, - - {"Negative origin 0.5x", - DesktopRect::MakeXYWH(-1, -1, 2, 2), - DesktopRect::MakeXYWH(-1, -1, 2, 2), - 0.5, 0.5, - DesktopRect::MakeXYWH(-1, -1, 2, 2)} - }; - // clang-format on + {.description = "0 origin 2x", + .dest_frame_rect = DesktopRect::MakeXYWH(0, 0, 2, 2), + .src_frame_rect = DesktopRect::MakeXYWH(0, 0, 2, 2), + .horizontal_scale = 2.0, + .vertical_scale = 2.0, + .expected_overlap_rect = DesktopRect::MakeXYWH(0, 0, 2, 2)}, + + {.description = "0 origin 0.5x", + .dest_frame_rect = DesktopRect::MakeXYWH(0, 0, 2, 2), + .src_frame_rect = DesktopRect::MakeXYWH(0, 0, 2, 2), + .horizontal_scale = 0.5, + .vertical_scale = 0.5, + .expected_overlap_rect = DesktopRect::MakeXYWH(0, 0, 2, 2)}, + + {.description = "Negative origin 2x", + .dest_frame_rect = DesktopRect::MakeXYWH(-1, -1, 2, 2), + .src_frame_rect = DesktopRect::MakeXYWH(-1, -1, 2, 2), + .horizontal_scale = 2.0, + .vertical_scale = 2.0, + .expected_overlap_rect = DesktopRect::MakeXYWH(-1, -1, 2, 2)}, + + {.description = "Negative origin 0.5x", + .dest_frame_rect = DesktopRect::MakeXYWH(-1, -1, 2, 2), + .src_frame_rect = DesktopRect::MakeXYWH(-1, -1, 2, 2), + .horizontal_scale = 0.5, + .vertical_scale = 0.5, + .expected_overlap_rect = DesktopRect::MakeXYWH(-1, -1, 2, 2)}}; RunTests(tests); } TEST(DesktopFrameTest, CopyIntersectingPixelsFullyContainedRects) { - // clang-format off const TestData tests[] = { - {"0 origin top left", - DesktopRect::MakeXYWH(0, 0, 2, 2), - DesktopRect::MakeXYWH(0, 0, 1, 1), - 1.0, 1.0, - DesktopRect::MakeXYWH(0, 0, 1, 1)}, - - {"0 origin bottom right", - DesktopRect::MakeXYWH(0, 0, 2, 2), - DesktopRect::MakeXYWH(1, 1, 1, 1), - 1.0, 1.0, - DesktopRect::MakeXYWH(1, 1, 1, 1)}, - - {"Negative origin bottom left", - DesktopRect::MakeXYWH(-1, -1, 2, 2), - DesktopRect::MakeXYWH(-1, 0, 1, 1), - 1.0, 1.0, - DesktopRect::MakeXYWH(-1, 0, 1, 1)} - }; - // clang-format on + {.description = "0 origin top left", + .dest_frame_rect = DesktopRect::MakeXYWH(0, 0, 2, 2), + .src_frame_rect = DesktopRect::MakeXYWH(0, 0, 1, 1), + .horizontal_scale = 1.0, + .vertical_scale = 1.0, + .expected_overlap_rect = DesktopRect::MakeXYWH(0, 0, 1, 1)}, + + {.description = "0 origin bottom right", + .dest_frame_rect = DesktopRect::MakeXYWH(0, 0, 2, 2), + .src_frame_rect = DesktopRect::MakeXYWH(1, 1, 1, 1), + .horizontal_scale = 1.0, + .vertical_scale = 1.0, + .expected_overlap_rect = DesktopRect::MakeXYWH(1, 1, 1, 1)}, + + {.description = "Negative origin bottom left", + .dest_frame_rect = DesktopRect::MakeXYWH(-1, -1, 2, 2), + .src_frame_rect = DesktopRect::MakeXYWH(-1, 0, 1, 1), + .horizontal_scale = 1.0, + .vertical_scale = 1.0, + .expected_overlap_rect = DesktopRect::MakeXYWH(-1, 0, 1, 1)}}; RunTests(tests); } TEST(DesktopFrameTest, CopyIntersectingPixelsFullyContainedRectsScaled) { - // clang-format off const TestData tests[] = { - {"0 origin top left 2x", - DesktopRect::MakeXYWH(0, 0, 2, 2), - DesktopRect::MakeXYWH(0, 0, 1, 1), - 2.0, 2.0, - DesktopRect::MakeXYWH(0, 0, 1, 1)}, - - {"0 origin top left 0.5x", - DesktopRect::MakeXYWH(0, 0, 2, 2), - DesktopRect::MakeXYWH(0, 0, 1, 1), - 0.5, 0.5, - DesktopRect::MakeXYWH(0, 0, 1, 1)}, - - {"0 origin bottom left 2x", - DesktopRect::MakeXYWH(0, 0, 4, 4), - DesktopRect::MakeXYWH(1, 1, 2, 2), - 2.0, 2.0, - DesktopRect::MakeXYWH(2, 2, 2, 2)}, - - {"0 origin bottom middle 2x/1x", - DesktopRect::MakeXYWH(0, 0, 4, 3), - DesktopRect::MakeXYWH(1, 1, 2, 2), - 2.0, 1.0, - DesktopRect::MakeXYWH(2, 1, 2, 2)}, - - {"0 origin middle 0.5x", - DesktopRect::MakeXYWH(0, 0, 3, 3), - DesktopRect::MakeXYWH(2, 2, 1, 1), - 0.5, 0.5, - DesktopRect::MakeXYWH(1, 1, 1, 1)}, - - {"Negative origin bottom left 2x", - DesktopRect::MakeXYWH(-1, -1, 3, 3), - DesktopRect::MakeXYWH(-1, 0, 1, 1), - 2.0, 2.0, - DesktopRect::MakeXYWH(-1, 1, 1, 1)}, - - {"Negative origin near middle 0.5x", - DesktopRect::MakeXYWH(-2, -2, 2, 2), - DesktopRect::MakeXYWH(0, 0, 1, 1), - 0.5, 0.5, - DesktopRect::MakeXYWH(-1, -1, 1, 1)} - }; - // clang-format on + {.description = "0 origin top left 2x", + .dest_frame_rect = DesktopRect::MakeXYWH(0, 0, 2, 2), + .src_frame_rect = DesktopRect::MakeXYWH(0, 0, 1, 1), + .horizontal_scale = 2.0, + .vertical_scale = 2.0, + .expected_overlap_rect = DesktopRect::MakeXYWH(0, 0, 1, 1)}, + + {.description = "0 origin top left 0.5x", + .dest_frame_rect = DesktopRect::MakeXYWH(0, 0, 2, 2), + .src_frame_rect = DesktopRect::MakeXYWH(0, 0, 1, 1), + .horizontal_scale = 0.5, + .vertical_scale = 0.5, + .expected_overlap_rect = DesktopRect::MakeXYWH(0, 0, 1, 1)}, + + {.description = "0 origin bottom left 2x", + .dest_frame_rect = DesktopRect::MakeXYWH(0, 0, 4, 4), + .src_frame_rect = DesktopRect::MakeXYWH(1, 1, 2, 2), + .horizontal_scale = 2.0, + .vertical_scale = 2.0, + .expected_overlap_rect = DesktopRect::MakeXYWH(2, 2, 2, 2)}, + + {.description = "0 origin bottom middle 2x/1x", + .dest_frame_rect = DesktopRect::MakeXYWH(0, 0, 4, 3), + .src_frame_rect = DesktopRect::MakeXYWH(1, 1, 2, 2), + .horizontal_scale = 2.0, + .vertical_scale = 1.0, + .expected_overlap_rect = DesktopRect::MakeXYWH(2, 1, 2, 2)}, + + {.description = "0 origin middle 0.5x", + .dest_frame_rect = DesktopRect::MakeXYWH(0, 0, 3, 3), + .src_frame_rect = DesktopRect::MakeXYWH(2, 2, 1, 1), + .horizontal_scale = 0.5, + .vertical_scale = 0.5, + .expected_overlap_rect = DesktopRect::MakeXYWH(1, 1, 1, 1)}, + + {.description = "Negative origin bottom left 2x", + .dest_frame_rect = DesktopRect::MakeXYWH(-1, -1, 3, 3), + .src_frame_rect = DesktopRect::MakeXYWH(-1, 0, 1, 1), + .horizontal_scale = 2.0, + .vertical_scale = 2.0, + .expected_overlap_rect = DesktopRect::MakeXYWH(-1, 1, 1, 1)}, + + {.description = "Negative origin near middle 0.5x", + .dest_frame_rect = DesktopRect::MakeXYWH(-2, -2, 2, 2), + .src_frame_rect = DesktopRect::MakeXYWH(0, 0, 1, 1), + .horizontal_scale = 0.5, + .vertical_scale = 0.5, + .expected_overlap_rect = DesktopRect::MakeXYWH(-1, -1, 1, 1)}}; RunTests(tests); } TEST(DesktopFrameTest, CopyIntersectingPixelsPartiallyContainedRects) { - // clang-format off const TestData tests[] = { - {"Top left", - DesktopRect::MakeXYWH(0, 0, 2, 2), - DesktopRect::MakeXYWH(-1, -1, 2, 2), - 1.0, 1.0, - DesktopRect::MakeXYWH(0, 0, 1, 1)}, - - {"Top right", - DesktopRect::MakeXYWH(0, 0, 2, 2), - DesktopRect::MakeXYWH(1, -1, 2, 2), - 1.0, 1.0, - DesktopRect::MakeXYWH(1, 0, 1, 1)}, - - {"Bottom right", - DesktopRect::MakeXYWH(0, 0, 2, 2), - DesktopRect::MakeXYWH(1, 1, 2, 2), - 1.0, 1.0, - DesktopRect::MakeXYWH(1, 1, 1, 1)}, - - {"Bottom left", - DesktopRect::MakeXYWH(0, 0, 2, 2), - DesktopRect::MakeXYWH(-1, 1, 2, 2), - 1.0, 1.0, - DesktopRect::MakeXYWH(0, 1, 1, 1)} - }; - // clang-format on + {.description = "Top left", + .dest_frame_rect = DesktopRect::MakeXYWH(0, 0, 2, 2), + .src_frame_rect = DesktopRect::MakeXYWH(-1, -1, 2, 2), + .horizontal_scale = 1.0, + .vertical_scale = 1.0, + .expected_overlap_rect = DesktopRect::MakeXYWH(0, 0, 1, 1)}, + + {.description = "Top right", + .dest_frame_rect = DesktopRect::MakeXYWH(0, 0, 2, 2), + .src_frame_rect = DesktopRect::MakeXYWH(1, -1, 2, 2), + .horizontal_scale = 1.0, + .vertical_scale = 1.0, + .expected_overlap_rect = DesktopRect::MakeXYWH(1, 0, 1, 1)}, + + {.description = "Bottom right", + .dest_frame_rect = DesktopRect::MakeXYWH(0, 0, 2, 2), + .src_frame_rect = DesktopRect::MakeXYWH(1, 1, 2, 2), + .horizontal_scale = 1.0, + .vertical_scale = 1.0, + .expected_overlap_rect = DesktopRect::MakeXYWH(1, 1, 1, 1)}, + + {.description = "Bottom left", + .dest_frame_rect = DesktopRect::MakeXYWH(0, 0, 2, 2), + .src_frame_rect = DesktopRect::MakeXYWH(-1, 1, 2, 2), + .horizontal_scale = 1.0, + .vertical_scale = 1.0, + .expected_overlap_rect = DesktopRect::MakeXYWH(0, 1, 1, 1)}}; RunTests(tests); } TEST(DesktopFrameTest, CopyIntersectingPixelsPartiallyContainedRectsScaled) { - // clang-format off const TestData tests[] = { - {"Top left 2x", - DesktopRect::MakeXYWH(0, 0, 2, 2), - DesktopRect::MakeXYWH(-1, -1, 3, 3), - 2.0, 2.0, - DesktopRect::MakeXYWH(0, 0, 1, 1)}, - - {"Top right 0.5x", - DesktopRect::MakeXYWH(0, 0, 2, 2), - DesktopRect::MakeXYWH(2, -2, 2, 2), - 0.5, 0.5, - DesktopRect::MakeXYWH(1, 0, 1, 1)}, - - {"Bottom right 2x", - DesktopRect::MakeXYWH(0, 0, 3, 3), - DesktopRect::MakeXYWH(-1, 1, 3, 3), - 2.0, 2.0, - DesktopRect::MakeXYWH(0, 2, 1, 1)}, - - {"Bottom left 0.5x", - DesktopRect::MakeXYWH(0, 0, 2, 2), - DesktopRect::MakeXYWH(-2, 2, 2, 2), - 0.5, 0.5, - DesktopRect::MakeXYWH(0, 1, 1, 1)} - }; - // clang-format on + {.description = "Top left 2x", + .dest_frame_rect = DesktopRect::MakeXYWH(0, 0, 2, 2), + .src_frame_rect = DesktopRect::MakeXYWH(-1, -1, 3, 3), + .horizontal_scale = 2.0, + .vertical_scale = 2.0, + .expected_overlap_rect = DesktopRect::MakeXYWH(0, 0, 1, 1)}, + + {.description = "Top right 0.5x", + .dest_frame_rect = DesktopRect::MakeXYWH(0, 0, 2, 2), + .src_frame_rect = DesktopRect::MakeXYWH(2, -2, 2, 2), + .horizontal_scale = 0.5, + .vertical_scale = 0.5, + .expected_overlap_rect = DesktopRect::MakeXYWH(1, 0, 1, 1)}, + + {.description = "Bottom right 2x", + .dest_frame_rect = DesktopRect::MakeXYWH(0, 0, 3, 3), + .src_frame_rect = DesktopRect::MakeXYWH(-1, 1, 3, 3), + .horizontal_scale = 2.0, + .vertical_scale = 2.0, + .expected_overlap_rect = DesktopRect::MakeXYWH(0, 2, 1, 1)}, + + {.description = "Bottom left 0.5x", + .dest_frame_rect = DesktopRect::MakeXYWH(0, 0, 2, 2), + .src_frame_rect = DesktopRect::MakeXYWH(-2, 2, 2, 2), + .horizontal_scale = 0.5, + .vertical_scale = 0.5, + .expected_overlap_rect = DesktopRect::MakeXYWH(0, 1, 1, 1)}}; RunTests(tests); } TEST(DesktopFrameTest, CopyIntersectingPixelsUncontainedRects) { - // clang-format off const TestData tests[] = { - {"Left", - DesktopRect::MakeXYWH(0, 0, 2, 2), - DesktopRect::MakeXYWH(-1, 0, 1, 2), - 1.0, 1.0, - DesktopRect::MakeXYWH(0, 0, 0, 0)}, - - {"Top", - DesktopRect::MakeXYWH(0, 0, 2, 2), - DesktopRect::MakeXYWH(0, -1, 2, 1), - 1.0, 1.0, - DesktopRect::MakeXYWH(0, 0, 0, 0)}, - - {"Right", - DesktopRect::MakeXYWH(0, 0, 2, 2), - DesktopRect::MakeXYWH(2, 0, 1, 2), - 1.0, 1.0, - DesktopRect::MakeXYWH(0, 0, 0, 0)}, - - - {"Bottom", - DesktopRect::MakeXYWH(0, 0, 2, 2), - DesktopRect::MakeXYWH(0, 2, 2, 1), - 1.0, 1.0, - DesktopRect::MakeXYWH(0, 0, 0, 0)} - }; - // clang-format on + {.description = "Left", + .dest_frame_rect = DesktopRect::MakeXYWH(0, 0, 2, 2), + .src_frame_rect = DesktopRect::MakeXYWH(-1, 0, 1, 2), + .horizontal_scale = 1.0, + .vertical_scale = 1.0, + .expected_overlap_rect = DesktopRect::MakeXYWH(0, 0, 0, 0)}, + + {.description = "Top", + .dest_frame_rect = DesktopRect::MakeXYWH(0, 0, 2, 2), + .src_frame_rect = DesktopRect::MakeXYWH(0, -1, 2, 1), + .horizontal_scale = 1.0, + .vertical_scale = 1.0, + .expected_overlap_rect = DesktopRect::MakeXYWH(0, 0, 0, 0)}, + + {.description = "Right", + .dest_frame_rect = DesktopRect::MakeXYWH(0, 0, 2, 2), + .src_frame_rect = DesktopRect::MakeXYWH(2, 0, 1, 2), + .horizontal_scale = 1.0, + .vertical_scale = 1.0, + .expected_overlap_rect = DesktopRect::MakeXYWH(0, 0, 0, 0)}, + + {.description = "Bottom", + .dest_frame_rect = DesktopRect::MakeXYWH(0, 0, 2, 2), + .src_frame_rect = DesktopRect::MakeXYWH(0, 2, 2, 1), + .horizontal_scale = 1.0, + .vertical_scale = 1.0, + .expected_overlap_rect = DesktopRect::MakeXYWH(0, 0, 0, 0)}}; RunTests(tests); } TEST(DesktopFrameTest, CopyIntersectingPixelsUncontainedRectsScaled) { - // clang-format off const TestData tests[] = { - {"Left 2x", - DesktopRect::MakeXYWH(0, 0, 2, 2), - DesktopRect::MakeXYWH(-1, 0, 2, 2), - 2.0, 2.0, - DesktopRect::MakeXYWH(0, 0, 0, 0)}, - - {"Top 0.5x", - DesktopRect::MakeXYWH(0, 0, 2, 2), - DesktopRect::MakeXYWH(0, -2, 2, 1), - 0.5, 0.5, - DesktopRect::MakeXYWH(0, 0, 0, 0)}, - - {"Right 2x", - DesktopRect::MakeXYWH(0, 0, 2, 2), - DesktopRect::MakeXYWH(1, 0, 1, 2), - 2.0, 2.0, - DesktopRect::MakeXYWH(0, 0, 0, 0)}, - - - {"Bottom 0.5x", - DesktopRect::MakeXYWH(0, 0, 2, 2), - DesktopRect::MakeXYWH(0, 4, 2, 1), - 0.5, 0.5, - DesktopRect::MakeXYWH(0, 0, 0, 0)} - }; - // clang-format on + {.description = "Left 2x", + .dest_frame_rect = DesktopRect::MakeXYWH(0, 0, 2, 2), + .src_frame_rect = DesktopRect::MakeXYWH(-1, 0, 2, 2), + .horizontal_scale = 2.0, + .vertical_scale = 2.0, + .expected_overlap_rect = DesktopRect::MakeXYWH(0, 0, 0, 0)}, + + {.description = "Top 0.5x", + .dest_frame_rect = DesktopRect::MakeXYWH(0, 0, 2, 2), + .src_frame_rect = DesktopRect::MakeXYWH(0, -2, 2, 1), + .horizontal_scale = 0.5, + .vertical_scale = 0.5, + .expected_overlap_rect = DesktopRect::MakeXYWH(0, 0, 0, 0)}, + + {.description = "Right 2x", + .dest_frame_rect = DesktopRect::MakeXYWH(0, 0, 2, 2), + .src_frame_rect = DesktopRect::MakeXYWH(1, 0, 1, 2), + .horizontal_scale = 2.0, + .vertical_scale = 2.0, + .expected_overlap_rect = DesktopRect::MakeXYWH(0, 0, 0, 0)}, + + {.description = "Bottom 0.5x", + .dest_frame_rect = DesktopRect::MakeXYWH(0, 0, 2, 2), + .src_frame_rect = DesktopRect::MakeXYWH(0, 4, 2, 1), + .horizontal_scale = 0.5, + .vertical_scale = 0.5, + .expected_overlap_rect = DesktopRect::MakeXYWH(0, 0, 0, 0)}}; RunTests(tests); } diff --git a/third_party/libwebrtc/modules/desktop_capture/desktop_region_unittest.cc b/third_party/libwebrtc/modules/desktop_capture/desktop_region_unittest.cc @@ -71,27 +71,27 @@ TEST(DesktopRegionTest, NonOverlappingRects) { int count; DesktopRect rects[4]; } cases[] = { - {1, {DesktopRect::MakeXYWH(10, 10, 10, 10)}}, - {2, - {DesktopRect::MakeXYWH(10, 10, 10, 10), - DesktopRect::MakeXYWH(30, 10, 10, 15)}}, - {2, - {DesktopRect::MakeXYWH(10, 10, 10, 10), - DesktopRect::MakeXYWH(10, 30, 10, 5)}}, - {3, - {DesktopRect::MakeXYWH(10, 10, 10, 9), - DesktopRect::MakeXYWH(30, 10, 15, 10), - DesktopRect::MakeXYWH(10, 30, 8, 10)}}, - {4, - {DesktopRect::MakeXYWH(0, 0, 30, 10), - DesktopRect::MakeXYWH(40, 0, 10, 30), - DesktopRect::MakeXYWH(0, 20, 10, 30), - DesktopRect::MakeXYWH(20, 40, 30, 10)}}, - {4, - {DesktopRect::MakeXYWH(0, 0, 10, 100), - DesktopRect::MakeXYWH(20, 10, 30, 10), - DesktopRect::MakeXYWH(20, 30, 30, 10), - DesktopRect::MakeXYWH(20, 50, 30, 10)}}, + {.count = 1, .rects = {DesktopRect::MakeXYWH(10, 10, 10, 10)}}, + {.count = 2, + .rects = {DesktopRect::MakeXYWH(10, 10, 10, 10), + DesktopRect::MakeXYWH(30, 10, 10, 15)}}, + {.count = 2, + .rects = {DesktopRect::MakeXYWH(10, 10, 10, 10), + DesktopRect::MakeXYWH(10, 30, 10, 5)}}, + {.count = 3, + .rects = {DesktopRect::MakeXYWH(10, 10, 10, 9), + DesktopRect::MakeXYWH(30, 10, 15, 10), + DesktopRect::MakeXYWH(10, 30, 8, 10)}}, + {.count = 4, + .rects = {DesktopRect::MakeXYWH(0, 0, 30, 10), + DesktopRect::MakeXYWH(40, 0, 10, 30), + DesktopRect::MakeXYWH(0, 20, 10, 30), + DesktopRect::MakeXYWH(20, 40, 30, 10)}}, + {.count = 4, + .rects = {DesktopRect::MakeXYWH(0, 0, 10, 100), + DesktopRect::MakeXYWH(20, 10, 30, 10), + DesktopRect::MakeXYWH(20, 30, 30, 10), + DesktopRect::MakeXYWH(20, 50, 30, 10)}}, }; for (size_t i = 0; i < (sizeof(cases) / sizeof(Case)); ++i) { @@ -123,96 +123,96 @@ TEST(DesktopRegionTest, TwoRects) { DesktopRect expected_rects[3]; } cases[] = { // Touching rectangles that merge into one. - {DesktopRect::MakeLTRB(100, 100, 200, 200), - DesktopRect::MakeLTRB(0, 100, 100, 200), - 1, - {DesktopRect::MakeLTRB(0, 100, 200, 200)}}, - {DesktopRect::MakeLTRB(100, 100, 200, 200), - DesktopRect::MakeLTRB(100, 0, 200, 100), - 1, - {DesktopRect::MakeLTRB(100, 0, 200, 200)}}, + {.input_rect1 = DesktopRect::MakeLTRB(100, 100, 200, 200), + .input_rect2 = DesktopRect::MakeLTRB(0, 100, 100, 200), + .expected_count = 1, + .expected_rects = {DesktopRect::MakeLTRB(0, 100, 200, 200)}}, + {.input_rect1 = DesktopRect::MakeLTRB(100, 100, 200, 200), + .input_rect2 = DesktopRect::MakeLTRB(100, 0, 200, 100), + .expected_count = 1, + .expected_rects = {DesktopRect::MakeLTRB(100, 0, 200, 200)}}, // Rectangles touching on the vertical edge. - {DesktopRect::MakeLTRB(100, 100, 200, 200), - DesktopRect::MakeLTRB(0, 150, 100, 250), - 3, - {DesktopRect::MakeLTRB(100, 100, 200, 150), - DesktopRect::MakeLTRB(0, 150, 200, 200), - DesktopRect::MakeLTRB(0, 200, 100, 250)}}, - {DesktopRect::MakeLTRB(100, 100, 200, 200), - DesktopRect::MakeLTRB(0, 50, 100, 150), - 3, - {DesktopRect::MakeLTRB(0, 50, 100, 100), - DesktopRect::MakeLTRB(0, 100, 200, 150), - DesktopRect::MakeLTRB(100, 150, 200, 200)}}, - {DesktopRect::MakeLTRB(100, 100, 200, 200), - DesktopRect::MakeLTRB(0, 120, 100, 180), - 3, - {DesktopRect::MakeLTRB(100, 100, 200, 120), - DesktopRect::MakeLTRB(0, 120, 200, 180), - DesktopRect::MakeLTRB(100, 180, 200, 200)}}, + {.input_rect1 = DesktopRect::MakeLTRB(100, 100, 200, 200), + .input_rect2 = DesktopRect::MakeLTRB(0, 150, 100, 250), + .expected_count = 3, + .expected_rects = {DesktopRect::MakeLTRB(100, 100, 200, 150), + DesktopRect::MakeLTRB(0, 150, 200, 200), + DesktopRect::MakeLTRB(0, 200, 100, 250)}}, + {.input_rect1 = DesktopRect::MakeLTRB(100, 100, 200, 200), + .input_rect2 = DesktopRect::MakeLTRB(0, 50, 100, 150), + .expected_count = 3, + .expected_rects = {DesktopRect::MakeLTRB(0, 50, 100, 100), + DesktopRect::MakeLTRB(0, 100, 200, 150), + DesktopRect::MakeLTRB(100, 150, 200, 200)}}, + {.input_rect1 = DesktopRect::MakeLTRB(100, 100, 200, 200), + .input_rect2 = DesktopRect::MakeLTRB(0, 120, 100, 180), + .expected_count = 3, + .expected_rects = {DesktopRect::MakeLTRB(100, 100, 200, 120), + DesktopRect::MakeLTRB(0, 120, 200, 180), + DesktopRect::MakeLTRB(100, 180, 200, 200)}}, // Rectangles touching on the horizontal edge. - {DesktopRect::MakeLTRB(100, 100, 200, 200), - DesktopRect::MakeLTRB(150, 0, 250, 100), - 2, - {DesktopRect::MakeLTRB(150, 0, 250, 100), - DesktopRect::MakeLTRB(100, 100, 200, 200)}}, - {DesktopRect::MakeLTRB(100, 100, 200, 200), - DesktopRect::MakeLTRB(50, 0, 150, 100), - 2, - {DesktopRect::MakeLTRB(50, 0, 150, 100), - DesktopRect::MakeLTRB(100, 100, 200, 200)}}, - {DesktopRect::MakeLTRB(100, 100, 200, 200), - DesktopRect::MakeLTRB(120, 0, 180, 100), - 2, - {DesktopRect::MakeLTRB(120, 0, 180, 100), - DesktopRect::MakeLTRB(100, 100, 200, 200)}}, + {.input_rect1 = DesktopRect::MakeLTRB(100, 100, 200, 200), + .input_rect2 = DesktopRect::MakeLTRB(150, 0, 250, 100), + .expected_count = 2, + .expected_rects = {DesktopRect::MakeLTRB(150, 0, 250, 100), + DesktopRect::MakeLTRB(100, 100, 200, 200)}}, + {.input_rect1 = DesktopRect::MakeLTRB(100, 100, 200, 200), + .input_rect2 = DesktopRect::MakeLTRB(50, 0, 150, 100), + .expected_count = 2, + .expected_rects = {DesktopRect::MakeLTRB(50, 0, 150, 100), + DesktopRect::MakeLTRB(100, 100, 200, 200)}}, + {.input_rect1 = DesktopRect::MakeLTRB(100, 100, 200, 200), + .input_rect2 = DesktopRect::MakeLTRB(120, 0, 180, 100), + .expected_count = 2, + .expected_rects = {DesktopRect::MakeLTRB(120, 0, 180, 100), + DesktopRect::MakeLTRB(100, 100, 200, 200)}}, // Overlapping rectangles. - {DesktopRect::MakeLTRB(100, 100, 200, 200), - DesktopRect::MakeLTRB(50, 50, 150, 150), - 3, - {DesktopRect::MakeLTRB(50, 50, 150, 100), - DesktopRect::MakeLTRB(50, 100, 200, 150), - DesktopRect::MakeLTRB(100, 150, 200, 200)}}, - {DesktopRect::MakeLTRB(100, 100, 200, 200), - DesktopRect::MakeLTRB(150, 50, 250, 150), - 3, - {DesktopRect::MakeLTRB(150, 50, 250, 100), - DesktopRect::MakeLTRB(100, 100, 250, 150), - DesktopRect::MakeLTRB(100, 150, 200, 200)}}, - {DesktopRect::MakeLTRB(100, 100, 200, 200), - DesktopRect::MakeLTRB(0, 120, 150, 180), - 3, - {DesktopRect::MakeLTRB(100, 100, 200, 120), - DesktopRect::MakeLTRB(0, 120, 200, 180), - DesktopRect::MakeLTRB(100, 180, 200, 200)}}, - {DesktopRect::MakeLTRB(100, 100, 200, 200), - DesktopRect::MakeLTRB(120, 0, 180, 150), - 2, - {DesktopRect::MakeLTRB(120, 0, 180, 100), - DesktopRect::MakeLTRB(100, 100, 200, 200)}}, - {DesktopRect::MakeLTRB(100, 0, 200, 300), - DesktopRect::MakeLTRB(0, 100, 300, 200), - 3, - {DesktopRect::MakeLTRB(100, 0, 200, 100), - DesktopRect::MakeLTRB(0, 100, 300, 200), - DesktopRect::MakeLTRB(100, 200, 200, 300)}}, + {.input_rect1 = DesktopRect::MakeLTRB(100, 100, 200, 200), + .input_rect2 = DesktopRect::MakeLTRB(50, 50, 150, 150), + .expected_count = 3, + .expected_rects = {DesktopRect::MakeLTRB(50, 50, 150, 100), + DesktopRect::MakeLTRB(50, 100, 200, 150), + DesktopRect::MakeLTRB(100, 150, 200, 200)}}, + {.input_rect1 = DesktopRect::MakeLTRB(100, 100, 200, 200), + .input_rect2 = DesktopRect::MakeLTRB(150, 50, 250, 150), + .expected_count = 3, + .expected_rects = {DesktopRect::MakeLTRB(150, 50, 250, 100), + DesktopRect::MakeLTRB(100, 100, 250, 150), + DesktopRect::MakeLTRB(100, 150, 200, 200)}}, + {.input_rect1 = DesktopRect::MakeLTRB(100, 100, 200, 200), + .input_rect2 = DesktopRect::MakeLTRB(0, 120, 150, 180), + .expected_count = 3, + .expected_rects = {DesktopRect::MakeLTRB(100, 100, 200, 120), + DesktopRect::MakeLTRB(0, 120, 200, 180), + DesktopRect::MakeLTRB(100, 180, 200, 200)}}, + {.input_rect1 = DesktopRect::MakeLTRB(100, 100, 200, 200), + .input_rect2 = DesktopRect::MakeLTRB(120, 0, 180, 150), + .expected_count = 2, + .expected_rects = {DesktopRect::MakeLTRB(120, 0, 180, 100), + DesktopRect::MakeLTRB(100, 100, 200, 200)}}, + {.input_rect1 = DesktopRect::MakeLTRB(100, 0, 200, 300), + .input_rect2 = DesktopRect::MakeLTRB(0, 100, 300, 200), + .expected_count = 3, + .expected_rects = {DesktopRect::MakeLTRB(100, 0, 200, 100), + DesktopRect::MakeLTRB(0, 100, 300, 200), + DesktopRect::MakeLTRB(100, 200, 200, 300)}}, // One rectangle enclosing another. - {DesktopRect::MakeLTRB(100, 100, 200, 200), - DesktopRect::MakeLTRB(150, 150, 180, 180), - 1, - {DesktopRect::MakeLTRB(100, 100, 200, 200)}}, - {DesktopRect::MakeLTRB(100, 100, 200, 200), - DesktopRect::MakeLTRB(100, 100, 180, 180), - 1, - {DesktopRect::MakeLTRB(100, 100, 200, 200)}}, - {DesktopRect::MakeLTRB(100, 100, 200, 200), - DesktopRect::MakeLTRB(150, 150, 200, 200), - 1, - {DesktopRect::MakeLTRB(100, 100, 200, 200)}}, + {.input_rect1 = DesktopRect::MakeLTRB(100, 100, 200, 200), + .input_rect2 = DesktopRect::MakeLTRB(150, 150, 180, 180), + .expected_count = 1, + .expected_rects = {DesktopRect::MakeLTRB(100, 100, 200, 200)}}, + {.input_rect1 = DesktopRect::MakeLTRB(100, 100, 200, 200), + .input_rect2 = DesktopRect::MakeLTRB(100, 100, 180, 180), + .expected_count = 1, + .expected_rects = {DesktopRect::MakeLTRB(100, 100, 200, 200)}}, + {.input_rect1 = DesktopRect::MakeLTRB(100, 100, 200, 200), + .input_rect2 = DesktopRect::MakeLTRB(150, 150, 200, 200), + .expected_count = 1, + .expected_rects = {DesktopRect::MakeLTRB(100, 100, 200, 200)}}, }; for (size_t i = 0; i < (sizeof(cases) / sizeof(Case)); ++i) { @@ -294,42 +294,43 @@ TEST(DesktopRegionTest, ComplexRegions) { int expected_count; DesktopRect expected_rects[6]; } cases[] = { - {3, - { - DesktopRect::MakeLTRB(100, 100, 200, 200), - DesktopRect::MakeLTRB(0, 100, 100, 200), - DesktopRect::MakeLTRB(310, 110, 320, 120), - }, - 2, - {DesktopRect::MakeLTRB(0, 100, 200, 200), - DesktopRect::MakeLTRB(310, 110, 320, 120)}}, - {3, - {DesktopRect::MakeLTRB(100, 100, 200, 200), - DesktopRect::MakeLTRB(50, 50, 150, 150), - DesktopRect::MakeLTRB(300, 125, 350, 175)}, - 4, - {DesktopRect::MakeLTRB(50, 50, 150, 100), - DesktopRect::MakeLTRB(50, 100, 200, 150), - DesktopRect::MakeLTRB(300, 125, 350, 175), - DesktopRect::MakeLTRB(100, 150, 200, 200)}}, - {4, - {DesktopRect::MakeLTRB(0, 0, 30, 30), - DesktopRect::MakeLTRB(10, 10, 40, 40), - DesktopRect::MakeLTRB(20, 20, 50, 50), - DesktopRect::MakeLTRB(50, 0, 65, 15)}, - 6, - {DesktopRect::MakeLTRB(0, 0, 30, 10), - DesktopRect::MakeLTRB(50, 0, 65, 15), - DesktopRect::MakeLTRB(0, 10, 40, 20), - DesktopRect::MakeLTRB(0, 20, 50, 30), - DesktopRect::MakeLTRB(10, 30, 50, 40), - DesktopRect::MakeLTRB(20, 40, 50, 50)}}, - {3, - {DesktopRect::MakeLTRB(10, 10, 40, 20), - DesktopRect::MakeLTRB(10, 30, 40, 40), - DesktopRect::MakeLTRB(10, 20, 40, 30)}, - 1, - {DesktopRect::MakeLTRB(10, 10, 40, 40)}}, + {.input_count = 3, + .input_rects = + { + DesktopRect::MakeLTRB(100, 100, 200, 200), + DesktopRect::MakeLTRB(0, 100, 100, 200), + DesktopRect::MakeLTRB(310, 110, 320, 120), + }, + .expected_count = 2, + .expected_rects = {DesktopRect::MakeLTRB(0, 100, 200, 200), + DesktopRect::MakeLTRB(310, 110, 320, 120)}}, + {.input_count = 3, + .input_rects = {DesktopRect::MakeLTRB(100, 100, 200, 200), + DesktopRect::MakeLTRB(50, 50, 150, 150), + DesktopRect::MakeLTRB(300, 125, 350, 175)}, + .expected_count = 4, + .expected_rects = {DesktopRect::MakeLTRB(50, 50, 150, 100), + DesktopRect::MakeLTRB(50, 100, 200, 150), + DesktopRect::MakeLTRB(300, 125, 350, 175), + DesktopRect::MakeLTRB(100, 150, 200, 200)}}, + {.input_count = 4, + .input_rects = {DesktopRect::MakeLTRB(0, 0, 30, 30), + DesktopRect::MakeLTRB(10, 10, 40, 40), + DesktopRect::MakeLTRB(20, 20, 50, 50), + DesktopRect::MakeLTRB(50, 0, 65, 15)}, + .expected_count = 6, + .expected_rects = {DesktopRect::MakeLTRB(0, 0, 30, 10), + DesktopRect::MakeLTRB(50, 0, 65, 15), + DesktopRect::MakeLTRB(0, 10, 40, 20), + DesktopRect::MakeLTRB(0, 20, 50, 30), + DesktopRect::MakeLTRB(10, 30, 50, 40), + DesktopRect::MakeLTRB(20, 40, 50, 50)}}, + {.input_count = 3, + .input_rects = {DesktopRect::MakeLTRB(10, 10, 40, 20), + DesktopRect::MakeLTRB(10, 30, 40, 40), + DesktopRect::MakeLTRB(10, 20, 40, 30)}, + .expected_count = 1, + .expected_rects = {DesktopRect::MakeLTRB(10, 10, 40, 40)}}, }; for (size_t i = 0; i < (sizeof(cases) / sizeof(Case)); ++i) { @@ -355,61 +356,61 @@ TEST(DesktopRegionTest, Equals) { int id; } regions[] = { // Same region with one of the rectangles 1 pixel wider/taller. - {2, - {DesktopRect::MakeLTRB(0, 100, 200, 200), - DesktopRect::MakeLTRB(310, 110, 320, 120)}, - 0}, - {2, - {DesktopRect::MakeLTRB(0, 100, 201, 200), - DesktopRect::MakeLTRB(310, 110, 320, 120)}, - 1}, - {2, - {DesktopRect::MakeLTRB(0, 100, 200, 201), - DesktopRect::MakeLTRB(310, 110, 320, 120)}, - 2}, + {.count = 2, + .rects = {DesktopRect::MakeLTRB(0, 100, 200, 200), + DesktopRect::MakeLTRB(310, 110, 320, 120)}, + .id = 0}, + {.count = 2, + .rects = {DesktopRect::MakeLTRB(0, 100, 201, 200), + DesktopRect::MakeLTRB(310, 110, 320, 120)}, + .id = 1}, + {.count = 2, + .rects = {DesktopRect::MakeLTRB(0, 100, 200, 201), + DesktopRect::MakeLTRB(310, 110, 320, 120)}, + .id = 2}, // Same region with one of the rectangles shifted horizontally and // vertically. - {4, - {DesktopRect::MakeLTRB(0, 0, 30, 30), - DesktopRect::MakeLTRB(10, 10, 40, 40), - DesktopRect::MakeLTRB(20, 20, 50, 50), - DesktopRect::MakeLTRB(50, 0, 65, 15)}, - 3}, - {4, - {DesktopRect::MakeLTRB(0, 0, 30, 30), - DesktopRect::MakeLTRB(10, 10, 40, 40), - DesktopRect::MakeLTRB(20, 20, 50, 50), - DesktopRect::MakeLTRB(50, 1, 65, 16)}, - 4}, - {4, - {DesktopRect::MakeLTRB(0, 0, 30, 30), - DesktopRect::MakeLTRB(10, 10, 40, 40), - DesktopRect::MakeLTRB(20, 20, 50, 50), - DesktopRect::MakeLTRB(51, 0, 66, 15)}, - 5}, + {.count = 4, + .rects = {DesktopRect::MakeLTRB(0, 0, 30, 30), + DesktopRect::MakeLTRB(10, 10, 40, 40), + DesktopRect::MakeLTRB(20, 20, 50, 50), + DesktopRect::MakeLTRB(50, 0, 65, 15)}, + .id = 3}, + {.count = 4, + .rects = {DesktopRect::MakeLTRB(0, 0, 30, 30), + DesktopRect::MakeLTRB(10, 10, 40, 40), + DesktopRect::MakeLTRB(20, 20, 50, 50), + DesktopRect::MakeLTRB(50, 1, 65, 16)}, + .id = 4}, + {.count = 4, + .rects = {DesktopRect::MakeLTRB(0, 0, 30, 30), + DesktopRect::MakeLTRB(10, 10, 40, 40), + DesktopRect::MakeLTRB(20, 20, 50, 50), + DesktopRect::MakeLTRB(51, 0, 66, 15)}, + .id = 5}, // Same region defined by a different set of rectangles - one of the // rectangle is split horizontally into two. - {3, - {DesktopRect::MakeLTRB(100, 100, 200, 200), - DesktopRect::MakeLTRB(50, 50, 150, 150), - DesktopRect::MakeLTRB(300, 125, 350, 175)}, - 6}, - {4, - {DesktopRect::MakeLTRB(100, 100, 200, 200), - DesktopRect::MakeLTRB(50, 50, 100, 150), - DesktopRect::MakeLTRB(100, 50, 150, 150), - DesktopRect::MakeLTRB(300, 125, 350, 175)}, - 6}, + {.count = 3, + .rects = {DesktopRect::MakeLTRB(100, 100, 200, 200), + DesktopRect::MakeLTRB(50, 50, 150, 150), + DesktopRect::MakeLTRB(300, 125, 350, 175)}, + .id = 6}, + {.count = 4, + .rects = {DesktopRect::MakeLTRB(100, 100, 200, 200), + DesktopRect::MakeLTRB(50, 50, 100, 150), + DesktopRect::MakeLTRB(100, 50, 150, 150), + DesktopRect::MakeLTRB(300, 125, 350, 175)}, + .id = 6}, // Rectangle region defined by a set of rectangles that merge into one. - {3, - {DesktopRect::MakeLTRB(10, 10, 40, 20), - DesktopRect::MakeLTRB(10, 30, 40, 40), - DesktopRect::MakeLTRB(10, 20, 40, 30)}, - 7}, - {1, {DesktopRect::MakeLTRB(10, 10, 40, 40)}, 7}, + {.count = 3, + .rects = {DesktopRect::MakeLTRB(10, 10, 40, 20), + DesktopRect::MakeLTRB(10, 30, 40, 40), + DesktopRect::MakeLTRB(10, 20, 40, 30)}, + .id = 7}, + {.count = 1, .rects = {DesktopRect::MakeLTRB(10, 10, 40, 40)}, .id = 7}, }; int kTotalRegions = sizeof(regions) / sizeof(Region); @@ -435,18 +436,18 @@ TEST(DesktopRegionTest, Translate) { int expected_count; DesktopRect expected_rects[5]; } cases[] = { - {3, - {DesktopRect::MakeLTRB(0, 0, 30, 30), - DesktopRect::MakeLTRB(10, 10, 40, 40), - DesktopRect::MakeLTRB(20, 20, 50, 50)}, - 3, - 5, - 5, - {DesktopRect::MakeLTRB(3, 5, 33, 15), - DesktopRect::MakeLTRB(3, 15, 43, 25), - DesktopRect::MakeLTRB(3, 25, 53, 35), - DesktopRect::MakeLTRB(13, 35, 53, 45), - DesktopRect::MakeLTRB(23, 45, 53, 55)}}, + {.input_count = 3, + .input_rects = {DesktopRect::MakeLTRB(0, 0, 30, 30), + DesktopRect::MakeLTRB(10, 10, 40, 40), + DesktopRect::MakeLTRB(20, 20, 50, 50)}, + .dx = 3, + .dy = 5, + .expected_count = 5, + .expected_rects = {DesktopRect::MakeLTRB(3, 5, 33, 15), + DesktopRect::MakeLTRB(3, 15, 43, 25), + DesktopRect::MakeLTRB(3, 25, 53, 35), + DesktopRect::MakeLTRB(13, 35, 53, 45), + DesktopRect::MakeLTRB(23, 45, 53, 55)}}, }; for (size_t i = 0; i < (sizeof(cases) / sizeof(Case)); ++i) { @@ -467,42 +468,42 @@ TEST(DesktopRegionTest, Intersect) { int expected_count; DesktopRect expected_rects[5]; } cases[] = { - {1, - {DesktopRect::MakeLTRB(0, 0, 100, 100)}, - 1, - {DesktopRect::MakeLTRB(50, 50, 150, 150)}, - 1, - {DesktopRect::MakeLTRB(50, 50, 100, 100)}}, - - {1, - {DesktopRect::MakeLTRB(100, 0, 200, 300)}, - 1, - {DesktopRect::MakeLTRB(0, 100, 300, 200)}, - 1, - {DesktopRect::MakeLTRB(100, 100, 200, 200)}}, - - {1, - {DesktopRect::MakeLTRB(0, 0, 100, 100)}, - 2, - {DesktopRect::MakeLTRB(50, 10, 150, 30), - DesktopRect::MakeLTRB(50, 30, 160, 50)}, - 1, - {DesktopRect::MakeLTRB(50, 10, 100, 50)}}, - - {1, - {DesktopRect::MakeLTRB(0, 0, 100, 100)}, - 2, - {DesktopRect::MakeLTRB(50, 10, 150, 30), - DesktopRect::MakeLTRB(50, 30, 90, 50)}, - 2, - {DesktopRect::MakeLTRB(50, 10, 100, 30), - DesktopRect::MakeLTRB(50, 30, 90, 50)}}, - {1, - {DesktopRect::MakeLTRB(0, 0, 100, 100)}, - 1, - {DesktopRect::MakeLTRB(100, 50, 200, 200)}, - 0, - {}}, + {.input1_count = 1, + .input1_rects = {DesktopRect::MakeLTRB(0, 0, 100, 100)}, + .input2_count = 1, + .input2_rects = {DesktopRect::MakeLTRB(50, 50, 150, 150)}, + .expected_count = 1, + .expected_rects = {DesktopRect::MakeLTRB(50, 50, 100, 100)}}, + + {.input1_count = 1, + .input1_rects = {DesktopRect::MakeLTRB(100, 0, 200, 300)}, + .input2_count = 1, + .input2_rects = {DesktopRect::MakeLTRB(0, 100, 300, 200)}, + .expected_count = 1, + .expected_rects = {DesktopRect::MakeLTRB(100, 100, 200, 200)}}, + + {.input1_count = 1, + .input1_rects = {DesktopRect::MakeLTRB(0, 0, 100, 100)}, + .input2_count = 2, + .input2_rects = {DesktopRect::MakeLTRB(50, 10, 150, 30), + DesktopRect::MakeLTRB(50, 30, 160, 50)}, + .expected_count = 1, + .expected_rects = {DesktopRect::MakeLTRB(50, 10, 100, 50)}}, + + {.input1_count = 1, + .input1_rects = {DesktopRect::MakeLTRB(0, 0, 100, 100)}, + .input2_count = 2, + .input2_rects = {DesktopRect::MakeLTRB(50, 10, 150, 30), + DesktopRect::MakeLTRB(50, 30, 90, 50)}, + .expected_count = 2, + .expected_rects = {DesktopRect::MakeLTRB(50, 10, 100, 30), + DesktopRect::MakeLTRB(50, 30, 90, 50)}}, + {.input1_count = 1, + .input1_rects = {DesktopRect::MakeLTRB(0, 0, 100, 100)}, + .input2_count = 1, + .input2_rects = {DesktopRect::MakeLTRB(100, 50, 200, 200)}, + .expected_count = 0, + .expected_rects = {}}, }; for (size_t i = 0; i < (sizeof(cases) / sizeof(Case)); ++i) { @@ -528,122 +529,122 @@ TEST(DesktopRegionTest, Subtract) { DesktopRect expected_rects[5]; } cases[] = { // Subtract one rect from another. - {1, - {DesktopRect::MakeLTRB(0, 0, 100, 100)}, - 1, - {DesktopRect::MakeLTRB(50, 50, 150, 150)}, - 2, - {DesktopRect::MakeLTRB(0, 0, 100, 50), - DesktopRect::MakeLTRB(0, 50, 50, 100)}}, - - {1, - {DesktopRect::MakeLTRB(0, 0, 100, 100)}, - 1, - {DesktopRect::MakeLTRB(-50, -50, 50, 50)}, - 2, - {DesktopRect::MakeLTRB(50, 0, 100, 50), - DesktopRect::MakeLTRB(0, 50, 100, 100)}}, - - {1, - {DesktopRect::MakeLTRB(0, 0, 100, 100)}, - 1, - {DesktopRect::MakeLTRB(-50, 50, 50, 150)}, - 2, - {DesktopRect::MakeLTRB(0, 0, 100, 50), - DesktopRect::MakeLTRB(50, 50, 100, 100)}}, - - {1, - {DesktopRect::MakeLTRB(0, 0, 100, 100)}, - 1, - {DesktopRect::MakeLTRB(50, 50, 150, 70)}, - 3, - {DesktopRect::MakeLTRB(0, 0, 100, 50), - DesktopRect::MakeLTRB(0, 50, 50, 70), - DesktopRect::MakeLTRB(0, 70, 100, 100)}}, - - {1, - {DesktopRect::MakeLTRB(0, 0, 100, 100)}, - 1, - {DesktopRect::MakeLTRB(50, 50, 70, 70)}, - 4, - {DesktopRect::MakeLTRB(0, 0, 100, 50), - DesktopRect::MakeLTRB(0, 50, 50, 70), - DesktopRect::MakeLTRB(70, 50, 100, 70), - DesktopRect::MakeLTRB(0, 70, 100, 100)}}, + {.input1_count = 1, + .input1_rects = {DesktopRect::MakeLTRB(0, 0, 100, 100)}, + .input2_count = 1, + .input2_rects = {DesktopRect::MakeLTRB(50, 50, 150, 150)}, + .expected_count = 2, + .expected_rects = {DesktopRect::MakeLTRB(0, 0, 100, 50), + DesktopRect::MakeLTRB(0, 50, 50, 100)}}, + + {.input1_count = 1, + .input1_rects = {DesktopRect::MakeLTRB(0, 0, 100, 100)}, + .input2_count = 1, + .input2_rects = {DesktopRect::MakeLTRB(-50, -50, 50, 50)}, + .expected_count = 2, + .expected_rects = {DesktopRect::MakeLTRB(50, 0, 100, 50), + DesktopRect::MakeLTRB(0, 50, 100, 100)}}, + + {.input1_count = 1, + .input1_rects = {DesktopRect::MakeLTRB(0, 0, 100, 100)}, + .input2_count = 1, + .input2_rects = {DesktopRect::MakeLTRB(-50, 50, 50, 150)}, + .expected_count = 2, + .expected_rects = {DesktopRect::MakeLTRB(0, 0, 100, 50), + DesktopRect::MakeLTRB(50, 50, 100, 100)}}, + + {.input1_count = 1, + .input1_rects = {DesktopRect::MakeLTRB(0, 0, 100, 100)}, + .input2_count = 1, + .input2_rects = {DesktopRect::MakeLTRB(50, 50, 150, 70)}, + .expected_count = 3, + .expected_rects = {DesktopRect::MakeLTRB(0, 0, 100, 50), + DesktopRect::MakeLTRB(0, 50, 50, 70), + DesktopRect::MakeLTRB(0, 70, 100, 100)}}, + + {.input1_count = 1, + .input1_rects = {DesktopRect::MakeLTRB(0, 0, 100, 100)}, + .input2_count = 1, + .input2_rects = {DesktopRect::MakeLTRB(50, 50, 70, 70)}, + .expected_count = 4, + .expected_rects = {DesktopRect::MakeLTRB(0, 0, 100, 50), + DesktopRect::MakeLTRB(0, 50, 50, 70), + DesktopRect::MakeLTRB(70, 50, 100, 70), + DesktopRect::MakeLTRB(0, 70, 100, 100)}}, // Empty result. - {1, - {DesktopRect::MakeLTRB(0, 0, 100, 100)}, - 1, - {DesktopRect::MakeLTRB(0, 0, 100, 100)}, - 0, - {}}, - - {1, - {DesktopRect::MakeLTRB(0, 0, 100, 100)}, - 1, - {DesktopRect::MakeLTRB(-10, -10, 110, 110)}, - 0, - {}}, - - {2, - {DesktopRect::MakeLTRB(0, 0, 100, 100), - DesktopRect::MakeLTRB(50, 50, 150, 150)}, - 2, - {DesktopRect::MakeLTRB(0, 0, 100, 100), - DesktopRect::MakeLTRB(50, 50, 150, 150)}, - 0, - {}}, + {.input1_count = 1, + .input1_rects = {DesktopRect::MakeLTRB(0, 0, 100, 100)}, + .input2_count = 1, + .input2_rects = {DesktopRect::MakeLTRB(0, 0, 100, 100)}, + .expected_count = 0, + .expected_rects = {}}, + + {.input1_count = 1, + .input1_rects = {DesktopRect::MakeLTRB(0, 0, 100, 100)}, + .input2_count = 1, + .input2_rects = {DesktopRect::MakeLTRB(-10, -10, 110, 110)}, + .expected_count = 0, + .expected_rects = {}}, + + {.input1_count = 2, + .input1_rects = {DesktopRect::MakeLTRB(0, 0, 100, 100), + DesktopRect::MakeLTRB(50, 50, 150, 150)}, + .input2_count = 2, + .input2_rects = {DesktopRect::MakeLTRB(0, 0, 100, 100), + DesktopRect::MakeLTRB(50, 50, 150, 150)}, + .expected_count = 0, + .expected_rects = {}}, // One rect out of disjoint set. - {3, - {DesktopRect::MakeLTRB(0, 0, 10, 10), - DesktopRect::MakeLTRB(20, 20, 30, 30), - DesktopRect::MakeLTRB(40, 0, 50, 10)}, - 1, - {DesktopRect::MakeLTRB(20, 20, 30, 30)}, - 2, - {DesktopRect::MakeLTRB(0, 0, 10, 10), - DesktopRect::MakeLTRB(40, 0, 50, 10)}}, + {.input1_count = 3, + .input1_rects = {DesktopRect::MakeLTRB(0, 0, 10, 10), + DesktopRect::MakeLTRB(20, 20, 30, 30), + DesktopRect::MakeLTRB(40, 0, 50, 10)}, + .input2_count = 1, + .input2_rects = {DesktopRect::MakeLTRB(20, 20, 30, 30)}, + .expected_count = 2, + .expected_rects = {DesktopRect::MakeLTRB(0, 0, 10, 10), + DesktopRect::MakeLTRB(40, 0, 50, 10)}}, // Row merging. - {3, - {DesktopRect::MakeLTRB(0, 0, 100, 50), - DesktopRect::MakeLTRB(0, 50, 150, 70), - DesktopRect::MakeLTRB(0, 70, 100, 100)}, - 1, - {DesktopRect::MakeLTRB(100, 50, 150, 70)}, - 1, - {DesktopRect::MakeLTRB(0, 0, 100, 100)}}, + {.input1_count = 3, + .input1_rects = {DesktopRect::MakeLTRB(0, 0, 100, 50), + DesktopRect::MakeLTRB(0, 50, 150, 70), + DesktopRect::MakeLTRB(0, 70, 100, 100)}, + .input2_count = 1, + .input2_rects = {DesktopRect::MakeLTRB(100, 50, 150, 70)}, + .expected_count = 1, + .expected_rects = {DesktopRect::MakeLTRB(0, 0, 100, 100)}}, // No-op subtraction. - {1, - {DesktopRect::MakeLTRB(0, 0, 100, 100)}, - 1, - {DesktopRect::MakeLTRB(100, 0, 200, 100)}, - 1, - {DesktopRect::MakeLTRB(0, 0, 100, 100)}}, - - {1, - {DesktopRect::MakeLTRB(0, 0, 100, 100)}, - 1, - {DesktopRect::MakeLTRB(-100, 0, 0, 100)}, - 1, - {DesktopRect::MakeLTRB(0, 0, 100, 100)}}, - - {1, - {DesktopRect::MakeLTRB(0, 0, 100, 100)}, - 1, - {DesktopRect::MakeLTRB(0, 100, 0, 200)}, - 1, - {DesktopRect::MakeLTRB(0, 0, 100, 100)}}, - - {1, - {DesktopRect::MakeLTRB(0, 0, 100, 100)}, - 1, - {DesktopRect::MakeLTRB(0, -100, 100, 0)}, - 1, - {DesktopRect::MakeLTRB(0, 0, 100, 100)}}, + {.input1_count = 1, + .input1_rects = {DesktopRect::MakeLTRB(0, 0, 100, 100)}, + .input2_count = 1, + .input2_rects = {DesktopRect::MakeLTRB(100, 0, 200, 100)}, + .expected_count = 1, + .expected_rects = {DesktopRect::MakeLTRB(0, 0, 100, 100)}}, + + {.input1_count = 1, + .input1_rects = {DesktopRect::MakeLTRB(0, 0, 100, 100)}, + .input2_count = 1, + .input2_rects = {DesktopRect::MakeLTRB(-100, 0, 0, 100)}, + .expected_count = 1, + .expected_rects = {DesktopRect::MakeLTRB(0, 0, 100, 100)}}, + + {.input1_count = 1, + .input1_rects = {DesktopRect::MakeLTRB(0, 0, 100, 100)}, + .input2_count = 1, + .input2_rects = {DesktopRect::MakeLTRB(0, 100, 0, 200)}, + .expected_count = 1, + .expected_rects = {DesktopRect::MakeLTRB(0, 0, 100, 100)}}, + + {.input1_count = 1, + .input1_rects = {DesktopRect::MakeLTRB(0, 0, 100, 100)}, + .input2_count = 1, + .input2_rects = {DesktopRect::MakeLTRB(0, -100, 100, 0)}, + .expected_count = 1, + .expected_rects = {DesktopRect::MakeLTRB(0, 0, 100, 100)}}, }; for (size_t i = 0; i < (sizeof(cases) / sizeof(Case)); ++i) { @@ -672,11 +673,14 @@ TEST(DesktopRegionTest, SubtractRectOnSameRow) { int end; } spans[3]; } span_sets[] = { - {1, {{0, 3}}}, - {1, {{0, 5}}}, - {1, {{0, 7}}}, - {1, {{0, 12}}}, - {2, {{0, 3}, {4, 5}, {6, 16}}}, + {.count = 1, .spans = {{.start = 0, .end = 3}}}, + {.count = 1, .spans = {{.start = 0, .end = 5}}}, + {.count = 1, .spans = {{.start = 0, .end = 7}}}, + {.count = 1, .spans = {{.start = 0, .end = 12}}}, + {.count = 2, + .spans = {{.start = 0, .end = 3}, + {.start = 4, .end = 5}, + {.start = 6, .end = 16}}}, }; DesktopRegion base_region; @@ -747,11 +751,14 @@ TEST(DesktopRegionTest, SubtractRectOnSameCol) { int end; } spans[3]; } span_sets[] = { - {1, {{0, 3}}}, - {1, {{0, 5}}}, - {1, {{0, 7}}}, - {1, {{0, 12}}}, - {2, {{0, 3}, {4, 5}, {6, 16}}}, + {.count = 1, .spans = {{.start = 0, .end = 3}}}, + {.count = 1, .spans = {{.start = 0, .end = 5}}}, + {.count = 1, .spans = {{.start = 0, .end = 7}}}, + {.count = 1, .spans = {{.start = 0, .end = 12}}}, + {.count = 2, + .spans = {{.start = 0, .end = 3}, + {.start = 4, .end = 5}, + {.start = 6, .end = 16}}}, }; DesktopRegion base_region; diff --git a/third_party/libwebrtc/modules/desktop_capture/linux/wayland/screencast_stream_utils.cc b/third_party/libwebrtc/modules/desktop_capture/linux/wayland/screencast_stream_utils.cc @@ -54,7 +54,8 @@ PipeWireVersion PipeWireVersion::Parse(const absl::string_view& version) { return {}; } - return {major.value(), minor.value(), micro.value()}; + return { + .major = major.value(), .minor = minor.value(), .micro = micro.value()}; } bool PipeWireVersion::operator>=(const PipeWireVersion& other) { @@ -81,8 +82,9 @@ spa_pod* BuildFormat(spa_pod_builder* builder, const struct spa_rectangle* resolution, const struct spa_fraction* frame_rate) { spa_pod_frame frames[2]; - spa_rectangle pw_min_screen_bounds = spa_rectangle{1, 1}; - spa_rectangle pw_max_screen_bounds = spa_rectangle{UINT32_MAX, UINT32_MAX}; + spa_rectangle pw_min_screen_bounds = spa_rectangle{.width = 1, .height = 1}; + spa_rectangle pw_max_screen_bounds = + spa_rectangle{.width = UINT32_MAX, .height = UINT32_MAX}; spa_pod_builder_push_object(builder, &frames[0], SPA_TYPE_OBJECT_Format, SPA_PARAM_EnumFormat); spa_pod_builder_add(builder, SPA_FORMAT_mediaType, @@ -128,7 +130,8 @@ spa_pod* BuildFormat(spa_pod_builder* builder, 0); } if (frame_rate) { - static const spa_fraction pw_min_frame_rate = spa_fraction{0, 1}; + static const spa_fraction pw_min_frame_rate = + spa_fraction{.num = 0, .denom = 1}; spa_pod_builder_add(builder, SPA_FORMAT_VIDEO_framerate, SPA_POD_CHOICE_RANGE_Fraction( frame_rate, &pw_min_frame_rate, frame_rate), diff --git a/third_party/libwebrtc/modules/desktop_capture/linux/wayland/shared_screencast_stream.cc b/third_party/libwebrtc/modules/desktop_capture/linux/wayland/shared_screencast_stream.cc @@ -75,8 +75,12 @@ constexpr int CursorMetaSize(int w, int h) { w * h * kCursorBpp); } -constexpr PipeWireVersion kDmaBufModifierMinVersion = {0, 3, 33}; -constexpr PipeWireVersion kDropSingleModifierMinVersion = {0, 3, 40}; +constexpr PipeWireVersion kDmaBufModifierMinVersion = {.major = 0, + .minor = 3, + .micro = 33}; +constexpr PipeWireVersion kDropSingleModifierMinVersion = {.major = 0, + .minor = 3, + .micro = 40}; class SharedScreenCastStreamPrivate { public: @@ -293,7 +297,7 @@ void SharedScreenCastStreamPrivate::OnStreamParamChanged( that->stream_size_ = DesktopSize(width, height); uint8_t buffer[2048] = {}; - auto builder = spa_pod_builder{buffer, sizeof(buffer)}; + auto builder = spa_pod_builder{.data = buffer, .size = sizeof(buffer)}; // Setup buffers and meta header for new format. @@ -390,7 +394,8 @@ void SharedScreenCastStreamPrivate::OnRenegotiateFormat(void* data, uint64_t) { uint8_t buffer[4096] = {}; - spa_pod_builder builder = spa_pod_builder{buffer, sizeof(buffer)}; + spa_pod_builder builder = + spa_pod_builder{.data = buffer, .size = sizeof(buffer)}; std::vector<const spa_pod*> params; struct spa_rectangle resolution = @@ -510,7 +515,8 @@ bool SharedScreenCastStreamPrivate::StartScreenCastStream( &pw_stream_events_, this); uint8_t buffer[4096] = {}; - spa_pod_builder builder = spa_pod_builder{buffer, sizeof(buffer)}; + spa_pod_builder builder = + spa_pod_builder{.data = buffer, .size = sizeof(buffer)}; std::vector<const spa_pod*> params; const bool has_required_pw_client_version = @@ -986,9 +992,9 @@ bool SharedScreenCastStreamPrivate::ProcessDMABuffer( std::vector<EglDmaBuf::PlaneData> plane_datas; for (uint32_t i = 0; i < n_planes; ++i) { EglDmaBuf::PlaneData data = { - static_cast<int32_t>(spa_buffer->datas[i].fd), - static_cast<uint32_t>(spa_buffer->datas[i].chunk->stride), - static_cast<uint32_t>(spa_buffer->datas[i].chunk->offset)}; + .fd = static_cast<int32_t>(spa_buffer->datas[i].fd), + .stride = static_cast<uint32_t>(spa_buffer->datas[i].chunk->stride), + .offset = static_cast<uint32_t>(spa_buffer->datas[i].chunk->offset)}; plane_datas.push_back(data); } diff --git a/third_party/libwebrtc/modules/desktop_capture/linux/wayland/test/test_screencast_stream_provider.cc b/third_party/libwebrtc/modules/desktop_capture/linux/wayland/test/test_screencast_stream_provider.cc @@ -96,7 +96,8 @@ TestScreenCastStreamProvider::TestScreenCastStreamProvider(Observer* observer, &pw_stream_events_, this); uint8_t buffer[2048] = {}; - spa_pod_builder builder = spa_pod_builder{buffer, sizeof(buffer)}; + spa_pod_builder builder = + spa_pod_builder{.data = buffer, .size = sizeof(buffer)}; std::vector<const spa_pod*> params; @@ -291,7 +292,7 @@ void TestScreenCastStreamProvider::OnStreamParamChanged( auto stride = SPA_ROUND_UP_N(that->width_ * kBytesPerPixel, 4); uint8_t buffer[1024] = {}; - auto builder = spa_pod_builder{buffer, sizeof(buffer)}; + auto builder = spa_pod_builder{.data = buffer, .size = sizeof(buffer)}; // Setup buffers and meta header for new format. diff --git a/third_party/libwebrtc/modules/remote_bitrate_estimator/transport_sequence_number_feedback_generator_unittest.cc b/third_party/libwebrtc/modules/remote_bitrate_estimator/transport_sequence_number_feedback_generator_unittest.cc @@ -526,7 +526,7 @@ TEST_F(RemoteEstimatorProxyOnRequestTest, RequestSinglePacketFeedback) { })); constexpr FeedbackRequest kSinglePacketFeedbackRequest = { - /*include_timestamps=*/true, /*sequence_count=*/1}; + .include_timestamps = true, .sequence_count = 1}; IncomingPacketV2(kBaseSeq + 3, kBaseTime + 3 * kMaxSmallDelta, kSinglePacketFeedbackRequest); } @@ -558,7 +558,7 @@ TEST_F(RemoteEstimatorProxyOnRequestTest, RequestLastFivePacketFeedback) { })); constexpr FeedbackRequest kFivePacketsFeedbackRequest = { - /*include_timestamps=*/true, /*sequence_count=*/5}; + .include_timestamps = true, .sequence_count = 5}; IncomingPacketV2(kBaseSeq + i, kBaseTime + i * kMaxSmallDelta, kFivePacketsFeedbackRequest); } @@ -589,7 +589,7 @@ TEST_F(RemoteEstimatorProxyOnRequestTest, })); constexpr FeedbackRequest kFivePacketsFeedbackRequest = { - /*include_timestamps=*/true, /*sequence_count=*/5}; + .include_timestamps = true, .sequence_count = 5}; IncomingPacketV2(kBaseSeq + i, kBaseTime + i * kMaxSmallDelta, kFivePacketsFeedbackRequest); } diff --git a/third_party/libwebrtc/modules/rtp_rtcp/source/absolute_capture_time_interpolator_unittest.cc b/third_party/libwebrtc/modules/rtp_rtcp/source/absolute_capture_time_interpolator_unittest.cc @@ -47,10 +47,12 @@ TEST(AbsoluteCaptureTimeInterpolatorTest, ReceiveExtensionReturnsExtension) { constexpr int kRtpClockFrequency = 64'000; constexpr uint32_t kRtpTimestamp0 = 1020300000; constexpr uint32_t kRtpTimestamp1 = kRtpTimestamp0 + 1280; - const AbsoluteCaptureTime kExtension0 = {Int64MsToUQ32x32(9000), - Int64MsToQ32x32(-350)}; - const AbsoluteCaptureTime kExtension1 = {Int64MsToUQ32x32(9020), - std::nullopt}; + const AbsoluteCaptureTime kExtension0 = { + .absolute_capture_timestamp = Int64MsToUQ32x32(9000), + .estimated_capture_clock_offset = Int64MsToQ32x32(-350)}; + const AbsoluteCaptureTime kExtension1 = { + .absolute_capture_timestamp = Int64MsToUQ32x32(9020), + .estimated_capture_clock_offset = std::nullopt}; SimulatedClock clock(0); AbsoluteCaptureTimeInterpolator interpolator(&clock); @@ -91,8 +93,9 @@ TEST(AbsoluteCaptureTimeInterpolatorTest, InterpolateLaterPacketArrivingLater) { constexpr uint32_t kRtpTimestamp0 = 1020300000; constexpr uint32_t kRtpTimestamp1 = kRtpTimestamp0 + 1280; constexpr uint32_t kRtpTimestamp2 = kRtpTimestamp0 + 2560; - const AbsoluteCaptureTime kExtension = {Int64MsToUQ32x32(9000), - Int64MsToQ32x32(-350)}; + const AbsoluteCaptureTime kExtension = { + .absolute_capture_timestamp = Int64MsToUQ32x32(9000), + .estimated_capture_clock_offset = Int64MsToQ32x32(-350)}; SimulatedClock clock(0); AbsoluteCaptureTimeInterpolator interpolator(&clock); @@ -127,8 +130,9 @@ TEST(AbsoluteCaptureTimeInterpolatorTest, constexpr uint32_t kRtpTimestamp0 = 1020300000; constexpr uint32_t kRtpTimestamp1 = kRtpTimestamp0 - 1280; constexpr uint32_t kRtpTimestamp2 = kRtpTimestamp0 - 2560; - const AbsoluteCaptureTime kExtension = {Int64MsToUQ32x32(9000), - Int64MsToQ32x32(-350)}; + const AbsoluteCaptureTime kExtension = { + .absolute_capture_timestamp = Int64MsToUQ32x32(9000), + .estimated_capture_clock_offset = Int64MsToQ32x32(-350)}; SimulatedClock clock(0); AbsoluteCaptureTimeInterpolator interpolator(&clock); @@ -163,8 +167,9 @@ TEST(AbsoluteCaptureTimeInterpolatorTest, constexpr uint32_t kRtpTimestamp0 = uint32_t{0} - 80; constexpr uint32_t kRtpTimestamp1 = 1280 - 80; constexpr uint32_t kRtpTimestamp2 = 2560 - 80; - const AbsoluteCaptureTime kExtension = {Int64MsToUQ32x32(9000), - Int64MsToQ32x32(-350)}; + const AbsoluteCaptureTime kExtension = { + .absolute_capture_timestamp = Int64MsToUQ32x32(9000), + .estimated_capture_clock_offset = Int64MsToQ32x32(-350)}; SimulatedClock clock(0); AbsoluteCaptureTimeInterpolator interpolator(&clock); @@ -199,8 +204,9 @@ TEST(AbsoluteCaptureTimeInterpolatorTest, constexpr uint32_t kRtpTimestamp0 = 799; constexpr uint32_t kRtpTimestamp1 = kRtpTimestamp0 - 1280; constexpr uint32_t kRtpTimestamp2 = kRtpTimestamp0 - 2560; - const AbsoluteCaptureTime kExtension = {Int64MsToUQ32x32(9000), - Int64MsToQ32x32(-350)}; + const AbsoluteCaptureTime kExtension = { + .absolute_capture_timestamp = Int64MsToUQ32x32(9000), + .estimated_capture_clock_offset = Int64MsToQ32x32(-350)}; SimulatedClock clock(0); AbsoluteCaptureTimeInterpolator interpolator(&clock); @@ -234,8 +240,9 @@ TEST(AbsoluteCaptureTimeInterpolatorTest, SkipInterpolateIfTooLate) { constexpr uint32_t kRtpTimestamp0 = 1020300000; constexpr uint32_t kRtpTimestamp1 = kRtpTimestamp0 + 1280; constexpr uint32_t kRtpTimestamp2 = kRtpTimestamp1 + 1280; - const AbsoluteCaptureTime kExtension = {Int64MsToUQ32x32(9000), - Int64MsToQ32x32(-350)}; + const AbsoluteCaptureTime kExtension = { + .absolute_capture_timestamp = Int64MsToUQ32x32(9000), + .estimated_capture_clock_offset = Int64MsToQ32x32(-350)}; SimulatedClock clock(0); AbsoluteCaptureTimeInterpolator interpolator(&clock); @@ -265,8 +272,9 @@ TEST(AbsoluteCaptureTimeInterpolatorTest, SkipInterpolateIfSourceChanged) { constexpr int kRtpClockFrequency = 64'000; constexpr uint32_t kRtpTimestamp0 = 1020300000; constexpr uint32_t kRtpTimestamp1 = kRtpTimestamp0 + 1280; - const AbsoluteCaptureTime kExtension = {Int64MsToUQ32x32(9000), - Int64MsToQ32x32(-350)}; + const AbsoluteCaptureTime kExtension = { + .absolute_capture_timestamp = Int64MsToUQ32x32(9000), + .estimated_capture_clock_offset = Int64MsToQ32x32(-350)}; SimulatedClock clock(0); AbsoluteCaptureTimeInterpolator interpolator(&clock); @@ -288,8 +296,9 @@ TEST(AbsoluteCaptureTimeInterpolatorTest, constexpr int kRtpClockFrequency1 = 32'000; constexpr uint32_t kRtpTimestamp0 = 1020300000; constexpr uint32_t kRtpTimestamp1 = kRtpTimestamp0 + 640; - const AbsoluteCaptureTime kExtension = {Int64MsToUQ32x32(9000), - Int64MsToQ32x32(-350)}; + const AbsoluteCaptureTime kExtension = { + .absolute_capture_timestamp = Int64MsToUQ32x32(9000), + .estimated_capture_clock_offset = Int64MsToQ32x32(-350)}; SimulatedClock clock(0); AbsoluteCaptureTimeInterpolator interpolator(&clock); @@ -309,8 +318,9 @@ TEST(AbsoluteCaptureTimeInterpolatorTest, constexpr uint32_t kSource = 1337; constexpr uint32_t kRtpTimestamp0 = 1020300000; constexpr uint32_t kRtpTimestamp1 = kRtpTimestamp0 + 640; - const AbsoluteCaptureTime kExtension = {Int64MsToUQ32x32(9000), - Int64MsToQ32x32(-350)}; + const AbsoluteCaptureTime kExtension = { + .absolute_capture_timestamp = Int64MsToUQ32x32(9000), + .estimated_capture_clock_offset = Int64MsToQ32x32(-350)}; SimulatedClock clock(0); AbsoluteCaptureTimeInterpolator interpolator(&clock); @@ -333,8 +343,9 @@ TEST(AbsoluteCaptureTimeInterpolatorTest, SkipInterpolateIsSticky) { constexpr uint32_t kRtpTimestamp0 = 1020300000; constexpr uint32_t kRtpTimestamp1 = kRtpTimestamp0 + 1280; constexpr uint32_t kRtpTimestamp2 = kRtpTimestamp1 + 1280; - const AbsoluteCaptureTime kExtension = {Int64MsToUQ32x32(9000), - Int64MsToQ32x32(-350)}; + const AbsoluteCaptureTime kExtension = { + .absolute_capture_timestamp = Int64MsToUQ32x32(9000), + .estimated_capture_clock_offset = Int64MsToQ32x32(-350)}; SimulatedClock clock(0); AbsoluteCaptureTimeInterpolator interpolator(&clock); @@ -372,7 +383,8 @@ TEST(AbsoluteCaptureTimeInterpolatorTest, MetricsAreUpdated) { clock.AdvanceTimeMilliseconds(10); interpolator.OnReceivePacket( kSource, kRtpTimestamp0 + 10, kFrequency, - AbsoluteCaptureTime{Int64MsToUQ32x32(5000), std::nullopt}); + AbsoluteCaptureTime{.absolute_capture_timestamp = Int64MsToUQ32x32(5000), + .estimated_capture_clock_offset = std::nullopt}); EXPECT_METRIC_EQ(metrics::NumSamples("WebRTC.Call.AbsCapture.ExtensionWait"), 1); @@ -380,7 +392,9 @@ TEST(AbsoluteCaptureTimeInterpolatorTest, MetricsAreUpdated) { clock.AdvanceTimeMilliseconds(10); interpolator.OnReceivePacket( kSource, kRtpTimestamp0 + 20, kFrequency, - AbsoluteCaptureTime{Int64MsToUQ32x32(20), Int64MsToUQ32x32(0)}); + AbsoluteCaptureTime{ + .absolute_capture_timestamp = Int64MsToUQ32x32(20), + .estimated_capture_clock_offset = Int64MsToUQ32x32(0)}); EXPECT_METRIC_EQ(metrics::NumSamples("WebRTC.Call.AbsCapture.Delta"), 2); EXPECT_METRIC_EQ(metrics::NumSamples("WebRTC.Call.AbsCapture.DeltaDeviation"), 1); @@ -399,8 +413,9 @@ TEST(AbsoluteCaptureTimeInterpolatorTest, DeltaRecordedCorrectly) { interpolator.OnReceivePacket( kSource, kRtpTimestamp0 + 10, kFrequency, AbsoluteCaptureTime{ - uint64_t{clock.ConvertTimestampToNtpTime(Timestamp::Millis(5))}, - std::nullopt}); + .absolute_capture_timestamp = + uint64_t{clock.ConvertTimestampToNtpTime(Timestamp::Millis(5))}, + .estimated_capture_clock_offset = std::nullopt}); EXPECT_METRIC_EQ(metrics::NumSamples("WebRTC.Call.AbsCapture.ExtensionWait"), 1); @@ -412,8 +427,9 @@ TEST(AbsoluteCaptureTimeInterpolatorTest, DeltaRecordedCorrectly) { interpolator.OnReceivePacket( kSource, kRtpTimestamp0 + 15, kFrequency, AbsoluteCaptureTime{ - uint64_t{clock.ConvertTimestampToNtpTime(Timestamp::Millis(16))}, - std::nullopt}); + .absolute_capture_timestamp = + uint64_t{clock.ConvertTimestampToNtpTime(Timestamp::Millis(16))}, + .estimated_capture_clock_offset = std::nullopt}); sample = metrics::MinSample("WebRTC.Call.AbsCapture.Delta"); // Since we capture with abs(), this should also be recorded as 6 ms diff --git a/third_party/libwebrtc/modules/rtp_rtcp/source/absolute_capture_time_sender_unittest.cc b/third_party/libwebrtc/modules/rtp_rtcp/source/absolute_capture_time_sender_unittest.cc @@ -40,12 +40,15 @@ TEST(AbsoluteCaptureTimeSenderTest, InterpolateLaterPacketSentLater) { constexpr uint32_t kRtpTimestamp0 = 1020300000; constexpr uint32_t kRtpTimestamp1 = kRtpTimestamp0 + 1280; constexpr uint32_t kRtpTimestamp2 = kRtpTimestamp0 + 2560; - const AbsoluteCaptureTime kExtension0 = {Int64MsToUQ32x32(9000), - Int64MsToQ32x32(-350)}; - const AbsoluteCaptureTime kExtension1 = {Int64MsToUQ32x32(9000 + 20), - Int64MsToQ32x32(-350)}; - const AbsoluteCaptureTime kExtension2 = {Int64MsToUQ32x32(9000 + 40), - Int64MsToQ32x32(-350)}; + const AbsoluteCaptureTime kExtension0 = { + .absolute_capture_timestamp = Int64MsToUQ32x32(9000), + .estimated_capture_clock_offset = Int64MsToQ32x32(-350)}; + const AbsoluteCaptureTime kExtension1 = { + .absolute_capture_timestamp = Int64MsToUQ32x32(9000 + 20), + .estimated_capture_clock_offset = Int64MsToQ32x32(-350)}; + const AbsoluteCaptureTime kExtension2 = { + .absolute_capture_timestamp = Int64MsToUQ32x32(9000 + 40), + .estimated_capture_clock_offset = Int64MsToQ32x32(-350)}; SimulatedClock clock(0); AbsoluteCaptureTimeSender sender(&clock); @@ -71,12 +74,15 @@ TEST(AbsoluteCaptureTimeSenderTest, InterpolateEarlierPacketSentLater) { constexpr uint32_t kRtpTimestamp0 = 1020300000; constexpr uint32_t kRtpTimestamp1 = kRtpTimestamp0 - 1280; constexpr uint32_t kRtpTimestamp2 = kRtpTimestamp0 - 2560; - const AbsoluteCaptureTime kExtension0 = {Int64MsToUQ32x32(9000), - Int64MsToQ32x32(-350)}; - const AbsoluteCaptureTime kExtension1 = {Int64MsToUQ32x32(9000 - 20), - Int64MsToQ32x32(-350)}; - const AbsoluteCaptureTime kExtension2 = {Int64MsToUQ32x32(9000 - 40), - Int64MsToQ32x32(-350)}; + const AbsoluteCaptureTime kExtension0 = { + .absolute_capture_timestamp = Int64MsToUQ32x32(9000), + .estimated_capture_clock_offset = Int64MsToQ32x32(-350)}; + const AbsoluteCaptureTime kExtension1 = { + .absolute_capture_timestamp = Int64MsToUQ32x32(9000 - 20), + .estimated_capture_clock_offset = Int64MsToQ32x32(-350)}; + const AbsoluteCaptureTime kExtension2 = { + .absolute_capture_timestamp = Int64MsToUQ32x32(9000 - 40), + .estimated_capture_clock_offset = Int64MsToQ32x32(-350)}; SimulatedClock clock(0); AbsoluteCaptureTimeSender sender(&clock); @@ -104,12 +110,15 @@ TEST(AbsoluteCaptureTimeSenderTest, constexpr uint32_t kRtpTimestamp0 = uint32_t{0} - 80; constexpr uint32_t kRtpTimestamp1 = 1280 - 80; constexpr uint32_t kRtpTimestamp2 = 2560 - 80; - const AbsoluteCaptureTime kExtension0 = {Int64MsToUQ32x32(9000), - Int64MsToQ32x32(-350)}; - const AbsoluteCaptureTime kExtension1 = {Int64MsToUQ32x32(9000 + 20), - Int64MsToQ32x32(-350)}; - const AbsoluteCaptureTime kExtension2 = {Int64MsToUQ32x32(9000 + 40), - Int64MsToQ32x32(-350)}; + const AbsoluteCaptureTime kExtension0 = { + .absolute_capture_timestamp = Int64MsToUQ32x32(9000), + .estimated_capture_clock_offset = Int64MsToQ32x32(-350)}; + const AbsoluteCaptureTime kExtension1 = { + .absolute_capture_timestamp = Int64MsToUQ32x32(9000 + 20), + .estimated_capture_clock_offset = Int64MsToQ32x32(-350)}; + const AbsoluteCaptureTime kExtension2 = { + .absolute_capture_timestamp = Int64MsToUQ32x32(9000 + 40), + .estimated_capture_clock_offset = Int64MsToQ32x32(-350)}; SimulatedClock clock(0); AbsoluteCaptureTimeSender sender(&clock); @@ -137,12 +146,15 @@ TEST(AbsoluteCaptureTimeSenderTest, constexpr uint32_t kRtpTimestamp0 = 799; constexpr uint32_t kRtpTimestamp1 = kRtpTimestamp0 - 1280; constexpr uint32_t kRtpTimestamp2 = kRtpTimestamp0 - 2560; - const AbsoluteCaptureTime kExtension0 = {Int64MsToUQ32x32(9000), - Int64MsToQ32x32(-350)}; - const AbsoluteCaptureTime kExtension1 = {Int64MsToUQ32x32(9000 - 20), - Int64MsToQ32x32(-350)}; - const AbsoluteCaptureTime kExtension2 = {Int64MsToUQ32x32(9000 - 40), - Int64MsToQ32x32(-350)}; + const AbsoluteCaptureTime kExtension0 = { + .absolute_capture_timestamp = Int64MsToUQ32x32(9000), + .estimated_capture_clock_offset = Int64MsToQ32x32(-350)}; + const AbsoluteCaptureTime kExtension1 = { + .absolute_capture_timestamp = Int64MsToUQ32x32(9000 - 20), + .estimated_capture_clock_offset = Int64MsToQ32x32(-350)}; + const AbsoluteCaptureTime kExtension2 = { + .absolute_capture_timestamp = Int64MsToUQ32x32(9000 - 40), + .estimated_capture_clock_offset = Int64MsToQ32x32(-350)}; SimulatedClock clock(0); AbsoluteCaptureTimeSender sender(&clock); @@ -169,12 +181,15 @@ TEST(AbsoluteCaptureTimeSenderTest, SkipInterpolateIfTooLate) { constexpr uint32_t kRtpTimestamp0 = 1020300000; constexpr uint32_t kRtpTimestamp1 = kRtpTimestamp0 + 1280; constexpr uint32_t kRtpTimestamp2 = kRtpTimestamp0 + 2560; - const AbsoluteCaptureTime kExtension0 = {Int64MsToUQ32x32(9000), - Int64MsToQ32x32(-350)}; - const AbsoluteCaptureTime kExtension1 = {Int64MsToUQ32x32(9000 + 20), - Int64MsToQ32x32(-350)}; - const AbsoluteCaptureTime kExtension2 = {Int64MsToUQ32x32(9000 + 40), - Int64MsToQ32x32(-350)}; + const AbsoluteCaptureTime kExtension0 = { + .absolute_capture_timestamp = Int64MsToUQ32x32(9000), + .estimated_capture_clock_offset = Int64MsToQ32x32(-350)}; + const AbsoluteCaptureTime kExtension1 = { + .absolute_capture_timestamp = Int64MsToUQ32x32(9000 + 20), + .estimated_capture_clock_offset = Int64MsToQ32x32(-350)}; + const AbsoluteCaptureTime kExtension2 = { + .absolute_capture_timestamp = Int64MsToUQ32x32(9000 + 40), + .estimated_capture_clock_offset = Int64MsToQ32x32(-350)}; SimulatedClock clock(0); AbsoluteCaptureTimeSender sender(&clock); @@ -206,12 +221,15 @@ TEST(AbsoluteCaptureTimeSenderTest, SkipInterpolateIfSourceChanged) { constexpr uint32_t kRtpTimestamp0 = 1020300000; constexpr uint32_t kRtpTimestamp1 = kRtpTimestamp0 + 1280; constexpr uint32_t kRtpTimestamp2 = kRtpTimestamp0 + 2560; - const AbsoluteCaptureTime kExtension0 = {Int64MsToUQ32x32(9000), - Int64MsToQ32x32(-350)}; - const AbsoluteCaptureTime kExtension1 = {Int64MsToUQ32x32(9000 + 20), - Int64MsToQ32x32(-350)}; - const AbsoluteCaptureTime kExtension2 = {Int64MsToUQ32x32(9000 + 40), - Int64MsToQ32x32(-350)}; + const AbsoluteCaptureTime kExtension0 = { + .absolute_capture_timestamp = Int64MsToUQ32x32(9000), + .estimated_capture_clock_offset = Int64MsToQ32x32(-350)}; + const AbsoluteCaptureTime kExtension1 = { + .absolute_capture_timestamp = Int64MsToUQ32x32(9000 + 20), + .estimated_capture_clock_offset = Int64MsToQ32x32(-350)}; + const AbsoluteCaptureTime kExtension2 = { + .absolute_capture_timestamp = Int64MsToUQ32x32(9000 + 40), + .estimated_capture_clock_offset = Int64MsToQ32x32(-350)}; SimulatedClock clock(0); AbsoluteCaptureTimeSender sender(&clock); @@ -238,12 +256,15 @@ TEST(AbsoluteCaptureTimeSenderTest, SkipInterpolateWhenForced) { constexpr uint32_t kRtpTimestamp0 = 1020300000; constexpr uint32_t kRtpTimestamp1 = kRtpTimestamp0 + 1280; constexpr uint32_t kRtpTimestamp2 = kRtpTimestamp0 + 2560; - const AbsoluteCaptureTime kExtension0 = {Int64MsToUQ32x32(9000), - Int64MsToQ32x32(-350)}; - const AbsoluteCaptureTime kExtension1 = {Int64MsToUQ32x32(9000 + 20), - Int64MsToQ32x32(-350)}; - const AbsoluteCaptureTime kExtension2 = {Int64MsToUQ32x32(9000 + 40), - Int64MsToQ32x32(-350)}; + const AbsoluteCaptureTime kExtension0 = { + .absolute_capture_timestamp = Int64MsToUQ32x32(9000), + .estimated_capture_clock_offset = Int64MsToQ32x32(-350)}; + const AbsoluteCaptureTime kExtension1 = { + .absolute_capture_timestamp = Int64MsToUQ32x32(9000 + 20), + .estimated_capture_clock_offset = Int64MsToQ32x32(-350)}; + const AbsoluteCaptureTime kExtension2 = { + .absolute_capture_timestamp = Int64MsToUQ32x32(9000 + 40), + .estimated_capture_clock_offset = Int64MsToQ32x32(-350)}; SimulatedClock clock(0); AbsoluteCaptureTimeSender sender(&clock); @@ -273,12 +294,15 @@ TEST(AbsoluteCaptureTimeSenderTest, SkipInterpolateIfRtpClockFrequencyChanged) { constexpr uint32_t kRtpTimestamp0 = 1020300000; constexpr uint32_t kRtpTimestamp1 = kRtpTimestamp0 + 640; constexpr uint32_t kRtpTimestamp2 = kRtpTimestamp0 + 1280; - const AbsoluteCaptureTime kExtension0 = {Int64MsToUQ32x32(9000), - Int64MsToQ32x32(-350)}; - const AbsoluteCaptureTime kExtension1 = {Int64MsToUQ32x32(9000 + 20), - Int64MsToQ32x32(-350)}; - const AbsoluteCaptureTime kExtension2 = {Int64MsToUQ32x32(9000 + 40), - Int64MsToQ32x32(-350)}; + const AbsoluteCaptureTime kExtension0 = { + .absolute_capture_timestamp = Int64MsToUQ32x32(9000), + .estimated_capture_clock_offset = Int64MsToQ32x32(-350)}; + const AbsoluteCaptureTime kExtension1 = { + .absolute_capture_timestamp = Int64MsToUQ32x32(9000 + 20), + .estimated_capture_clock_offset = Int64MsToQ32x32(-350)}; + const AbsoluteCaptureTime kExtension2 = { + .absolute_capture_timestamp = Int64MsToUQ32x32(9000 + 40), + .estimated_capture_clock_offset = Int64MsToQ32x32(-350)}; SimulatedClock clock(0); AbsoluteCaptureTimeSender sender(&clock); @@ -304,12 +328,15 @@ TEST(AbsoluteCaptureTimeSenderTest, constexpr uint32_t kSource = 1337; constexpr int kRtpClockFrequency = 0; constexpr uint32_t kRtpTimestamp = 1020300000; - const AbsoluteCaptureTime kExtension0 = {Int64MsToUQ32x32(9000), - Int64MsToQ32x32(-350)}; - const AbsoluteCaptureTime kExtension1 = {Int64MsToUQ32x32(9000 + 20), - Int64MsToQ32x32(-350)}; - const AbsoluteCaptureTime kExtension2 = {Int64MsToUQ32x32(9000 + 40), - Int64MsToQ32x32(-350)}; + const AbsoluteCaptureTime kExtension0 = { + .absolute_capture_timestamp = Int64MsToUQ32x32(9000), + .estimated_capture_clock_offset = Int64MsToQ32x32(-350)}; + const AbsoluteCaptureTime kExtension1 = { + .absolute_capture_timestamp = Int64MsToUQ32x32(9000 + 20), + .estimated_capture_clock_offset = Int64MsToQ32x32(-350)}; + const AbsoluteCaptureTime kExtension2 = { + .absolute_capture_timestamp = Int64MsToUQ32x32(9000 + 40), + .estimated_capture_clock_offset = Int64MsToQ32x32(-350)}; SimulatedClock clock(0); AbsoluteCaptureTimeSender sender(&clock); @@ -337,12 +364,15 @@ TEST(AbsoluteCaptureTimeSenderTest, constexpr uint32_t kRtpTimestamp0 = 1020300000; constexpr uint32_t kRtpTimestamp1 = kRtpTimestamp0 + 1280; constexpr uint32_t kRtpTimestamp2 = kRtpTimestamp0 + 2560; - const AbsoluteCaptureTime kExtension0 = {Int64MsToUQ32x32(9000), - Int64MsToQ32x32(-350)}; - const AbsoluteCaptureTime kExtension1 = {Int64MsToUQ32x32(9000 + 20), - Int64MsToQ32x32(370)}; - const AbsoluteCaptureTime kExtension2 = {Int64MsToUQ32x32(9000 + 40), - std::nullopt}; + const AbsoluteCaptureTime kExtension0 = { + .absolute_capture_timestamp = Int64MsToUQ32x32(9000), + .estimated_capture_clock_offset = Int64MsToQ32x32(-350)}; + const AbsoluteCaptureTime kExtension1 = { + .absolute_capture_timestamp = Int64MsToUQ32x32(9000 + 20), + .estimated_capture_clock_offset = Int64MsToQ32x32(370)}; + const AbsoluteCaptureTime kExtension2 = { + .absolute_capture_timestamp = Int64MsToUQ32x32(9000 + 40), + .estimated_capture_clock_offset = std::nullopt}; SimulatedClock clock(0); AbsoluteCaptureTimeSender sender(&clock); @@ -370,17 +400,18 @@ TEST(AbsoluteCaptureTimeSenderTest, constexpr uint32_t kRtpTimestamp0 = 1020300000; constexpr uint32_t kRtpTimestamp1 = kRtpTimestamp0 + 1280; constexpr uint32_t kRtpTimestamp2 = kRtpTimestamp0 + 2560; - const AbsoluteCaptureTime kExtension0 = {Int64MsToUQ32x32(9000), - Int64MsToQ32x32(-350)}; + const AbsoluteCaptureTime kExtension0 = { + .absolute_capture_timestamp = Int64MsToUQ32x32(9000), + .estimated_capture_clock_offset = Int64MsToQ32x32(-350)}; const AbsoluteCaptureTime kExtension1 = { - Int64MsToUQ32x32(9000 + 20 + - AbsoluteCaptureTimeSender::kInterpolationMaxError.ms()), - Int64MsToQ32x32(-350)}; + .absolute_capture_timestamp = Int64MsToUQ32x32( + 9000 + 20 + AbsoluteCaptureTimeSender::kInterpolationMaxError.ms()), + .estimated_capture_clock_offset = Int64MsToQ32x32(-350)}; const AbsoluteCaptureTime kExtension2 = { - Int64MsToUQ32x32(9000 + 40 + - AbsoluteCaptureTimeSender::kInterpolationMaxError.ms() + - 1), - Int64MsToQ32x32(-350)}; + .absolute_capture_timestamp = Int64MsToUQ32x32( + 9000 + 40 + AbsoluteCaptureTimeSender::kInterpolationMaxError.ms() + + 1), + .estimated_capture_clock_offset = Int64MsToQ32x32(-350)}; SimulatedClock clock(0); AbsoluteCaptureTimeSender sender(&clock); diff --git a/third_party/libwebrtc/modules/rtp_rtcp/source/rtcp_transceiver_impl.cc b/third_party/libwebrtc/modules/rtp_rtcp/source/rtcp_transceiver_impl.cc @@ -351,7 +351,8 @@ void RtcpTransceiverImpl::HandleSenderReport( return; RemoteSenderState& remote_sender = remote_senders_[sender_report.sender_ssrc()]; - remote_sender.last_received_sender_report = {{now, sender_report.ntp()}}; + remote_sender.last_received_sender_report = { + {.local_received_time = now, .remote_sent_time = sender_report.ntp()}}; HandleReportBlocks(sender_report.sender_ssrc(), now, sender_report.report_blocks(), report_blocks); diff --git a/third_party/libwebrtc/modules/rtp_rtcp/source/rtp_header_extension_size_unittest.cc b/third_party/libwebrtc/modules/rtp_rtcp/source/rtp_header_extension_size_unittest.cc @@ -27,7 +27,8 @@ constexpr int kId = 1; constexpr int kIdForceTwoByteHeader = 15; TEST(RtpHeaderExtensionSizeTest, ReturnsZeroIfNoExtensionsAreRegistered) { - constexpr RtpExtensionSize kExtensionSizes[] = {{RtpMid::kId, 3}}; + constexpr RtpExtensionSize kExtensionSizes[] = { + {.type = RtpMid::kId, .value_size = 3}}; // Register different extension than ask size for. RtpHeaderExtensionMap registered; registered.Register<RtpStreamId>(kId); @@ -36,7 +37,8 @@ TEST(RtpHeaderExtensionSizeTest, ReturnsZeroIfNoExtensionsAreRegistered) { } TEST(RtpHeaderExtensionSizeTest, IncludesSizeOfExtensionHeaders) { - constexpr RtpExtensionSize kExtensionSizes[] = {{RtpMid::kId, 3}}; + constexpr RtpExtensionSize kExtensionSizes[] = { + {.type = RtpMid::kId, .value_size = 3}}; RtpHeaderExtensionMap registered; registered.Register<RtpMid>(kId); @@ -46,7 +48,8 @@ TEST(RtpHeaderExtensionSizeTest, IncludesSizeOfExtensionHeaders) { } TEST(RtpHeaderExtensionSizeTest, RoundsUpTo32bitAlignmant) { - constexpr RtpExtensionSize kExtensionSizes[] = {{RtpMid::kId, 5}}; + constexpr RtpExtensionSize kExtensionSizes[] = { + {.type = RtpMid::kId, .value_size = 5}}; RtpHeaderExtensionMap registered; registered.Register<RtpMid>(kId); @@ -55,8 +58,9 @@ TEST(RtpHeaderExtensionSizeTest, RoundsUpTo32bitAlignmant) { } TEST(RtpHeaderExtensionSizeTest, SumsSeveralExtensions) { - constexpr RtpExtensionSize kExtensionSizes[] = {{RtpMid::kId, 16}, - {RtpStreamId::kId, 2}}; + constexpr RtpExtensionSize kExtensionSizes[] = { + {.type = RtpMid::kId, .value_size = 16}, + {.type = RtpStreamId::kId, .value_size = 2}}; RtpHeaderExtensionMap registered; registered.Register<RtpMid>(kId); registered.Register<RtpStreamId>(14); @@ -67,8 +71,9 @@ TEST(RtpHeaderExtensionSizeTest, SumsSeveralExtensions) { } TEST(RtpHeaderExtensionSizeTest, LargeIdForce2BytesHeader) { - constexpr RtpExtensionSize kExtensionSizes[] = {{RtpMid::kId, 3}, - {RtpStreamId::kId, 2}}; + constexpr RtpExtensionSize kExtensionSizes[] = { + {.type = RtpMid::kId, .value_size = 3}, + {.type = RtpStreamId::kId, .value_size = 2}}; RtpHeaderExtensionMap registered; registered.Register<RtpMid>(kId); registered.Register<RtpStreamId>(kIdForceTwoByteHeader); @@ -79,8 +84,9 @@ TEST(RtpHeaderExtensionSizeTest, LargeIdForce2BytesHeader) { } TEST(RtpHeaderExtensionSizeTest, LargeValueForce2BytesHeader) { - constexpr RtpExtensionSize kExtensionSizes[] = {{RtpMid::kId, 17}, - {RtpStreamId::kId, 4}}; + constexpr RtpExtensionSize kExtensionSizes[] = { + {.type = RtpMid::kId, .value_size = 17}, + {.type = RtpStreamId::kId, .value_size = 4}}; RtpHeaderExtensionMap registered; registered.Register<RtpMid>(1); registered.Register<RtpStreamId>(2); diff --git a/third_party/libwebrtc/modules/rtp_rtcp/source/rtp_header_extensions.cc b/third_party/libwebrtc/modules/rtp_rtcp/source/rtp_header_extensions.cc @@ -323,7 +323,8 @@ bool TransportSequenceNumberV2::Parse( // If `sequence_count` is zero no feedback is requested. if (sequence_count != 0) { - *feedback_request = {include_timestamps, sequence_count}; + *feedback_request = {.include_timestamps = include_timestamps, + .sequence_count = sequence_count}; } } return true; diff --git a/third_party/libwebrtc/modules/rtp_rtcp/source/rtp_packet_unittest.cc b/third_party/libwebrtc/modules/rtp_rtcp/source/rtp_packet_unittest.cc @@ -1066,8 +1066,8 @@ TEST(RtpPacketTest, CreateAndParseAbsoluteCaptureTime) { send_packet.SetSsrc(kSsrc); constexpr AbsoluteCaptureTime kAbsoluteCaptureTime{ - /*absolute_capture_timestamp=*/9876543210123456789ULL, - /*estimated_capture_clock_offset=*/-1234567890987654321LL}; + .absolute_capture_timestamp = 9876543210123456789ULL, + .estimated_capture_clock_offset = -1234567890987654321LL}; ASSERT_TRUE(send_packet.SetExtension<AbsoluteCaptureTimeExtension>( kAbsoluteCaptureTime)); @@ -1096,8 +1096,8 @@ TEST(RtpPacketTest, send_packet.SetSsrc(kSsrc); constexpr AbsoluteCaptureTime kAbsoluteCaptureTime{ - /*absolute_capture_timestamp=*/9876543210123456789ULL, - /*estimated_capture_clock_offset=*/std::nullopt}; + .absolute_capture_timestamp = 9876543210123456789ULL, + .estimated_capture_clock_offset = std::nullopt}; ASSERT_TRUE(send_packet.SetExtension<AbsoluteCaptureTimeExtension>( kAbsoluteCaptureTime)); @@ -1185,7 +1185,7 @@ TEST(RtpPacketTest, CreateAndParseTransportSequenceNumberV2Preallocated) { constexpr int kTransportSequenceNumber = 12345; constexpr std::optional<FeedbackRequest> kNoFeedbackRequest = - FeedbackRequest{/*include_timestamps=*/false, /*sequence_count=*/0}; + FeedbackRequest{.include_timestamps = false, .sequence_count = 0}; send_packet.ReserveExtension<TransportSequenceNumberV2>(); send_packet.SetExtension<TransportSequenceNumberV2>(kTransportSequenceNumber, kNoFeedbackRequest); @@ -1218,7 +1218,7 @@ TEST(RtpPacketTest, constexpr int kTransportSequenceNumber = 12345; constexpr std::optional<FeedbackRequest> kFeedbackRequest = - FeedbackRequest{/*include_timestamps=*/true, /*sequence_count=*/3}; + FeedbackRequest{.include_timestamps = true, .sequence_count = 3}; send_packet.SetExtension<TransportSequenceNumberV2>(kTransportSequenceNumber, kFeedbackRequest); diff --git a/third_party/libwebrtc/modules/rtp_rtcp/source/rtp_rtcp_impl2.cc b/third_party/libwebrtc/modules/rtp_rtcp/source/rtp_rtcp_impl2.cc @@ -551,9 +551,10 @@ ModuleRtpRtcpImpl2::GetNonSenderRttStats() const { RTCPReceiver::NonSenderRttStats non_sender_rtt_stats = rtcp_receiver_.GetNonSenderRTT(); return {{ - non_sender_rtt_stats.round_trip_time(), - non_sender_rtt_stats.total_round_trip_time(), - non_sender_rtt_stats.round_trip_time_measurements(), + .round_trip_time = non_sender_rtt_stats.round_trip_time(), + .total_round_trip_time = non_sender_rtt_stats.total_round_trip_time(), + .round_trip_time_measurements = + non_sender_rtt_stats.round_trip_time_measurements(), }}; } diff --git a/third_party/libwebrtc/modules/rtp_rtcp/source/rtp_rtcp_impl2_unittest.cc b/third_party/libwebrtc/modules/rtp_rtcp/source/rtp_rtcp_impl2_unittest.cc @@ -364,7 +364,13 @@ class RtpRtcpImpl2Test : public ::testing::Test { rtp_video_header.simulcastIdx = 0; rtp_video_header.codec = kVideoCodecVP8; rtp_video_header.video_type_header = vp8_header; - rtp_video_header.video_timing = {0u, 0u, 0u, 0u, 0u, 0u, false}; + rtp_video_header.video_timing = {.encode_start_delta_ms = 0u, + .encode_finish_delta_ms = 0u, + .packetization_finish_delta_ms = 0u, + .pacer_exit_delta_ms = 0u, + .network_timestamp_delta_ms = 0u, + .network2_timestamp_delta_ms = 0u, + .flags = false}; const uint8_t payload[100] = {0}; bool success = module->impl_->OnSendingRtpFrame(0, 0, kPayloadType, true); diff --git a/third_party/libwebrtc/modules/rtp_rtcp/source/rtp_sender.cc b/third_party/libwebrtc/modules/rtp_rtcp/source/rtp_sender.cc @@ -91,8 +91,8 @@ constexpr RtpExtensionSize kVideoExtensionSizes[] = { CreateMaxExtensionSize<RepairedRtpStreamId>(), CreateMaxExtensionSize<RtpMid>(), CreateMaxExtensionSize<CorruptionDetectionExtension>(), - {RtpGenericFrameDescriptorExtension00::kId, - RtpGenericFrameDescriptorExtension00::kMaxSizeBytes}, + {.type = RtpGenericFrameDescriptorExtension00::kId, + .value_size = RtpGenericFrameDescriptorExtension00::kMaxSizeBytes}, }; // Size info for header extensions that might be used in audio packets. diff --git a/third_party/libwebrtc/modules/rtp_rtcp/source/rtp_sender_egress.cc b/third_party/libwebrtc/modules/rtp_rtcp/source/rtp_sender_egress.cc @@ -250,7 +250,8 @@ void RtpSenderEgress::SendPacket(std::unique_ptr<RtpPacketToSend> packet, } } - auto compound_packet = Packet{std::move(packet), pacing_info, now}; + auto compound_packet = + Packet{.rtp_packet = std::move(packet), .info = pacing_info, .now = now}; if (enable_send_packet_batching_ && !is_audio_) { packets_to_send_.push_back(std::move(compound_packet)); } else { diff --git a/third_party/libwebrtc/modules/rtp_rtcp/source/rtp_sender_video_unittest.cc b/third_party/libwebrtc/modules/rtp_rtcp/source/rtp_sender_video_unittest.cc @@ -1393,8 +1393,8 @@ TEST_F(RtpSenderVideoTest, AbsoluteCaptureTime) { TEST_F(RtpSenderVideoTest, AbsoluteCaptureTimeWithExtensionProvided) { constexpr AbsoluteCaptureTime kAbsoluteCaptureTime = { - 123, - std::optional<int64_t>(456), + .absolute_capture_timestamp = 123, + .estimated_capture_clock_offset = std::optional<int64_t>(456), }; uint8_t kFrame[kMaxPacketLength]; rtp_module_.RegisterRtpHeaderExtension(AbsoluteCaptureTimeExtension::Uri(), diff --git a/third_party/libwebrtc/modules/rtp_rtcp/source/source_tracker_unittest.cc b/third_party/libwebrtc/modules/rtp_rtcp/source/source_tracker_unittest.cc @@ -55,8 +55,10 @@ class ExpectedSourceTracker { for (const auto& packet_info : packet_infos) { RtpSource::Extensions extensions = { - packet_info.audio_level(), packet_info.absolute_capture_time(), - packet_info.local_capture_clock_offset()}; + .audio_level = packet_info.audio_level(), + .absolute_capture_time = packet_info.absolute_capture_time(), + .local_capture_clock_offset = + packet_info.local_capture_clock_offset()}; for (const auto& csrc : packet_info.csrcs()) { entries_.emplace_front(now, csrc, RtpSourceType::CSRC, @@ -271,8 +273,8 @@ TEST(SourceTrackerTest, OnFrameDeliveredRecordsSourcesDistinctSsrcs) { constexpr std::optional<uint8_t> kAudioLevel0 = 50; constexpr std::optional<uint8_t> kAudioLevel1 = 20; constexpr std::optional<AbsoluteCaptureTime> kAbsoluteCaptureTime = - AbsoluteCaptureTime{/*absolute_capture_timestamp=*/12, - /*estimated_capture_clock_offset=*/std::nullopt}; + AbsoluteCaptureTime{.absolute_capture_timestamp = 12, + .estimated_capture_clock_offset = std::nullopt}; constexpr std::optional<TimeDelta> kLocalCaptureClockOffset = std::nullopt; constexpr Timestamp kReceiveTime0 = Timestamp::Millis(60); constexpr Timestamp kReceiveTime1 = Timestamp::Millis(70); @@ -327,8 +329,8 @@ TEST(SourceTrackerTest, OnFrameDeliveredRecordsSourcesSameSsrc) { constexpr std::optional<uint8_t> kAudioLevel1 = 20; constexpr std::optional<uint8_t> kAudioLevel2 = 10; constexpr std::optional<AbsoluteCaptureTime> kAbsoluteCaptureTime = - AbsoluteCaptureTime{/*absolute_capture_timestamp=*/12, - /*estimated_capture_clock_offset=*/std::nullopt}; + AbsoluteCaptureTime{.absolute_capture_timestamp = 12, + .estimated_capture_clock_offset = std::nullopt}; constexpr std::optional<TimeDelta> kLocalCaptureClockOffset = std::nullopt; constexpr Timestamp kReceiveTime0 = Timestamp::Millis(60); constexpr Timestamp kReceiveTime1 = Timestamp::Millis(70); @@ -391,11 +393,14 @@ TEST(SourceTrackerTest, OnFrameDeliveredUpdatesSources) { constexpr std::optional<uint8_t> kAudioLevel1 = std::nullopt; constexpr std::optional<uint8_t> kAudioLevel2 = 10; constexpr std::optional<AbsoluteCaptureTime> kAbsoluteCaptureTime0 = - AbsoluteCaptureTime{12, 34}; + AbsoluteCaptureTime{.absolute_capture_timestamp = 12, + .estimated_capture_clock_offset = 34}; constexpr std::optional<AbsoluteCaptureTime> kAbsoluteCaptureTime1 = - AbsoluteCaptureTime{56, 78}; + AbsoluteCaptureTime{.absolute_capture_timestamp = 56, + .estimated_capture_clock_offset = 78}; constexpr std::optional<AbsoluteCaptureTime> kAbsoluteCaptureTime2 = - AbsoluteCaptureTime{89, 90}; + AbsoluteCaptureTime{.absolute_capture_timestamp = 89, + .estimated_capture_clock_offset = 90}; constexpr std::optional<TimeDelta> kLocalCaptureClockOffset0 = TimeDelta::Millis(123); constexpr std::optional<TimeDelta> kLocalCaptureClockOffset1 = @@ -495,9 +500,11 @@ TEST(SourceTrackerTest, TimedOutSourcesAreRemoved) { constexpr std::optional<uint8_t> kAudioLevel0 = 50; constexpr std::optional<uint8_t> kAudioLevel1 = std::nullopt; constexpr std::optional<AbsoluteCaptureTime> kAbsoluteCaptureTime0 = - AbsoluteCaptureTime{12, 34}; + AbsoluteCaptureTime{.absolute_capture_timestamp = 12, + .estimated_capture_clock_offset = 34}; constexpr std::optional<AbsoluteCaptureTime> kAbsoluteCaptureTime1 = - AbsoluteCaptureTime{56, 78}; + AbsoluteCaptureTime{.absolute_capture_timestamp = 56, + .estimated_capture_clock_offset = 78}; constexpr std::optional<TimeDelta> kLocalCaptureClockOffset0 = TimeDelta::Millis(123); constexpr std::optional<TimeDelta> kLocalCaptureClockOffset1 = diff --git a/third_party/libwebrtc/modules/rtp_rtcp/source/ulpfec_generator_unittest.cc b/third_party/libwebrtc/modules/rtp_rtcp/source/ulpfec_generator_unittest.cc @@ -86,7 +86,8 @@ TEST_F(UlpfecGeneratorTest, NoEmptyFecWithSeqNumGaps) { protected_packets.push_back({12, 3, 54, 0}); protected_packets.push_back({21, 0, 55, 0}); protected_packets.push_back({13, 3, 57, 1}); - FecProtectionParams params = {117, 3, kFecMaskBursty}; + FecProtectionParams params = { + .fec_rate = 117, .max_fec_frames = 3, .fec_mask_type = kFecMaskBursty}; ulpfec_generator_.SetProtectionParameters(params, params); for (Packet p : protected_packets) { RtpPacketToSend packet(nullptr); @@ -115,7 +116,8 @@ TEST_F(UlpfecGeneratorTest, OneFrameFec) { // of packets is within `kMaxExcessOverhead`, and (2) the total number of // media packets for 1 frame is at least `minimum_media_packets_fec_`. constexpr size_t kNumPackets = 4; - FecProtectionParams params = {15, 3, kFecMaskRandom}; + FecProtectionParams params = { + .fec_rate = 15, .max_fec_frames = 3, .fec_mask_type = kFecMaskRandom}; packet_generator_.NewFrame(kNumPackets); // Expecting one FEC packet. ulpfec_generator_.SetProtectionParameters(params, params); @@ -150,7 +152,8 @@ TEST_F(UlpfecGeneratorTest, TwoFrameFec) { constexpr size_t kNumPackets = 2; constexpr size_t kNumFrames = 2; - FecProtectionParams params = {15, 3, kFecMaskRandom}; + FecProtectionParams params = { + .fec_rate = 15, .max_fec_frames = 3, .fec_mask_type = kFecMaskRandom}; // Expecting one FEC packet. ulpfec_generator_.SetProtectionParameters(params, params); uint32_t last_timestamp = 0; @@ -178,7 +181,8 @@ TEST_F(UlpfecGeneratorTest, MixedMediaRtpHeaderLengths) { constexpr size_t kLongRtpHeaderLength = 16; // Only one frame required to generate FEC. - FecProtectionParams params = {127, 1, kFecMaskRandom}; + FecProtectionParams params = { + .fec_rate = 127, .max_fec_frames = 1, .fec_mask_type = kFecMaskRandom}; ulpfec_generator_.SetProtectionParameters(params, params); // Fill up internal buffer with media packets with short RTP header length. @@ -216,10 +220,10 @@ TEST_F(UlpfecGeneratorTest, MixedMediaRtpHeaderLengths) { } TEST_F(UlpfecGeneratorTest, UpdatesProtectionParameters) { - const FecProtectionParams kKeyFrameParams = {25, /*max_fec_frames=*/2, - kFecMaskRandom}; - const FecProtectionParams kDeltaFrameParams = {25, /*max_fec_frames=*/5, - kFecMaskRandom}; + const FecProtectionParams kKeyFrameParams = { + .fec_rate = 25, .max_fec_frames = 2, .fec_mask_type = kFecMaskRandom}; + const FecProtectionParams kDeltaFrameParams = { + .fec_rate = 25, .max_fec_frames = 5, .fec_mask_type = kFecMaskRandom}; ulpfec_generator_.SetProtectionParameters(kDeltaFrameParams, kKeyFrameParams); diff --git a/third_party/libwebrtc/modules/rtp_rtcp/source/video_rtp_depacketizer_h264_unittest.cc b/third_party/libwebrtc/modules/rtp_rtcp/source/video_rtp_depacketizer_h264_unittest.cc @@ -96,7 +96,9 @@ TEST(VideoRtpDepacketizerH264Test, SingleNaluSpsWithResolution) { TEST(VideoRtpDepacketizerH264Test, StapAKey) { const NaluInfo kExpectedNalus[] = { - {H264::kSps, 0, -1}, {H264::kPps, 1, 2}, {H264::kIdr, -1, 0}}; + {.type = H264::kSps, .sps_id = 0, .pps_id = -1}, + {.type = H264::kPps, .sps_id = 1, .pps_id = 2}, + {.type = H264::kIdr, .sps_id = -1, .pps_id = 0}}; // clang-format off: split example data on NAL unit boundaries. const uint8_t kPayload[] = { H264::kStapA, // F=0, NRI=0, Type=24. diff --git a/third_party/libwebrtc/modules/video_capture/linux/video_capture_pipewire.cc b/third_party/libwebrtc/modules/video_capture/linux/video_capture_pipewire.cc @@ -55,20 +55,20 @@ struct { uint32_t spa_format; VideoType video_type; } constexpr kSupportedFormats[] = { - {SPA_VIDEO_FORMAT_I420, VideoType::kI420}, - {SPA_VIDEO_FORMAT_NV12, VideoType::kNV12}, - {SPA_VIDEO_FORMAT_YUY2, VideoType::kYUY2}, - {SPA_VIDEO_FORMAT_UYVY, VideoType::kUYVY}, + {.spa_format = SPA_VIDEO_FORMAT_I420, .video_type = VideoType::kI420}, + {.spa_format = SPA_VIDEO_FORMAT_NV12, .video_type = VideoType::kNV12}, + {.spa_format = SPA_VIDEO_FORMAT_YUY2, .video_type = VideoType::kYUY2}, + {.spa_format = SPA_VIDEO_FORMAT_UYVY, .video_type = VideoType::kUYVY}, // PipeWire is big-endian for the formats, while libyuv is little-endian // This means that BGRA == ARGB, RGBA == ABGR and similar // This follows mapping in libcamera PipeWire plugin: // https://gitlab.freedesktop.org/pipewire/pipewire/-/blob/master/spa/plugins/libcamera/libcamera-utils.cpp - {SPA_VIDEO_FORMAT_BGRA, VideoType::kARGB}, - {SPA_VIDEO_FORMAT_RGBA, VideoType::kABGR}, - {SPA_VIDEO_FORMAT_ARGB, VideoType::kBGRA}, - {SPA_VIDEO_FORMAT_RGB, VideoType::kBGR24}, - {SPA_VIDEO_FORMAT_BGR, VideoType::kRGB24}, - {SPA_VIDEO_FORMAT_RGB16, VideoType::kRGB565}, + {.spa_format = SPA_VIDEO_FORMAT_BGRA, .video_type = VideoType::kARGB}, + {.spa_format = SPA_VIDEO_FORMAT_RGBA, .video_type = VideoType::kABGR}, + {.spa_format = SPA_VIDEO_FORMAT_ARGB, .video_type = VideoType::kBGRA}, + {.spa_format = SPA_VIDEO_FORMAT_RGB, .video_type = VideoType::kBGR24}, + {.spa_format = SPA_VIDEO_FORMAT_BGR, .video_type = VideoType::kRGB24}, + {.spa_format = SPA_VIDEO_FORMAT_RGB16, .video_type = VideoType::kRGB565}, }; VideoType VideoCaptureModulePipeWire::PipeWireRawFormatToVideoType( @@ -150,21 +150,22 @@ static spa_pod* BuildFormat(spa_pod_builder* builder, 0); } - spa_rectangle resolution = spa_rectangle{width, height}; + spa_rectangle resolution = spa_rectangle{.width = width, .height = height}; spa_pod_builder_add(builder, SPA_FORMAT_VIDEO_size, SPA_POD_Rectangle(&resolution), 0); // Framerate can be also set to 0 to be unspecified if (frame_rate) { - spa_fraction framerate = spa_fraction{static_cast<uint32_t>(frame_rate), 1}; + spa_fraction framerate = + spa_fraction{.num = static_cast<uint32_t>(frame_rate), .denom = 1}; spa_pod_builder_add(builder, SPA_FORMAT_VIDEO_framerate, SPA_POD_Fraction(&framerate), 0); } else { // Default to some reasonable values spa_fraction preferred_frame_rate = - spa_fraction{static_cast<uint32_t>(30), 1}; - spa_fraction min_frame_rate = spa_fraction{1, 1}; - spa_fraction max_frame_rate = spa_fraction{30, 1}; + spa_fraction{.num = static_cast<uint32_t>(30), .denom = 1}; + spa_fraction min_frame_rate = spa_fraction{.num = 1, .denom = 1}; + spa_fraction max_frame_rate = spa_fraction{.num = 30, .denom = 1}; spa_pod_builder_add( builder, SPA_FORMAT_VIDEO_framerate, SPA_POD_CHOICE_RANGE_Fraction(&preferred_frame_rate, &min_frame_rate, @@ -219,7 +220,8 @@ int32_t VideoCaptureModulePipeWire::StartCapture( pw_stream_add_listener(stream_, &stream_listener_, &stream_events, this); - spa_pod_builder builder = spa_pod_builder{buffer, sizeof(buffer)}; + spa_pod_builder builder = + spa_pod_builder{.data = buffer, .size = sizeof(buffer)}; std::vector<const spa_pod*> params; uint32_t width = capability.width; uint32_t height = capability.height; @@ -335,7 +337,7 @@ void VideoCaptureModulePipeWire::OnFormatChanged(const struct spa_pod* format) { << static_cast<int>(configured_capability_.videoType); uint8_t buffer[1024] = {}; - auto builder = spa_pod_builder{buffer, sizeof(buffer)}; + auto builder = spa_pod_builder{.data = buffer, .size = sizeof(buffer)}; // Setup buffers and meta header for new format. std::vector<const spa_pod*> params; diff --git a/third_party/libwebrtc/moz-patch-stack/s0001.patch b/third_party/libwebrtc/moz-patch-stack/s0001.patch @@ -609,10 +609,10 @@ index 589b387d11..2b936a151e 100644 method_ = new_method; } diff --git a/modules/rtp_rtcp/source/rtp_header_extensions.cc b/modules/rtp_rtcp/source/rtp_header_extensions.cc -index 2c31b17568..39eb769f1c 100644 +index 83afe0fe6b..c0e46cc918 100644 --- a/modules/rtp_rtcp/source/rtp_header_extensions.cc +++ b/modules/rtp_rtcp/source/rtp_header_extensions.cc -@@ -421,6 +421,45 @@ bool PlayoutDelayLimits::Write(ArrayView<uint8_t> data, +@@ -422,6 +422,45 @@ bool PlayoutDelayLimits::Write(ArrayView<uint8_t> data, return true; } @@ -701,7 +701,7 @@ index 66147a2ef0..60e582bf29 100644 } } diff --git a/modules/rtp_rtcp/source/rtp_packet_unittest.cc b/modules/rtp_rtcp/source/rtp_packet_unittest.cc -index ab5cc141cc..b37a131947 100644 +index 06804b6a11..7f58ad6376 100644 --- a/modules/rtp_rtcp/source/rtp_packet_unittest.cc +++ b/modules/rtp_rtcp/source/rtp_packet_unittest.cc @@ -140,6 +140,18 @@ constexpr uint8_t kPacketWithMid[] = { @@ -769,7 +769,7 @@ index 0b87d6d065..d69ae9420b 100644 } // namespace webrtc diff --git a/modules/rtp_rtcp/source/rtp_sender.cc b/modules/rtp_rtcp/source/rtp_sender.cc -index 45d5dbf686..c7e9a2a594 100644 +index ef9d0250f6..7e2e5eb3e2 100644 --- a/modules/rtp_rtcp/source/rtp_sender.cc +++ b/modules/rtp_rtcp/source/rtp_sender.cc @@ -139,6 +139,10 @@ bool IsNonVolatile(RTPExtensionType type) { diff --git a/third_party/libwebrtc/moz-patch-stack/s0003.patch b/third_party/libwebrtc/moz-patch-stack/s0003.patch @@ -61,7 +61,7 @@ index 555269ae24..c5e84e0368 100644 std::optional<TimeDelta> LastRtt() const; diff --git a/modules/rtp_rtcp/source/rtp_rtcp_impl2.cc b/modules/rtp_rtcp/source/rtp_rtcp_impl2.cc -index 7234bda64a..4f461f159e 100644 +index e552033d0a..77b38cb463 100644 --- a/modules/rtp_rtcp/source/rtp_rtcp_impl2.cc +++ b/modules/rtp_rtcp/source/rtp_rtcp_impl2.cc @@ -529,6 +529,11 @@ void ModuleRtpRtcpImpl2::GetSendStreamDataCounters( diff --git a/third_party/libwebrtc/moz-patch-stack/s0004.patch b/third_party/libwebrtc/moz-patch-stack/s0004.patch @@ -63,7 +63,7 @@ index c5e84e0368..3b0ca48f5b 100644 std::optional<TimeDelta> AverageRtt() const; std::optional<TimeDelta> LastRtt() const; diff --git a/modules/rtp_rtcp/source/rtp_rtcp_impl2.cc b/modules/rtp_rtcp/source/rtp_rtcp_impl2.cc -index 4f461f159e..3949ca3804 100644 +index 77b38cb463..72e5645d03 100644 --- a/modules/rtp_rtcp/source/rtp_rtcp_impl2.cc +++ b/modules/rtp_rtcp/source/rtp_rtcp_impl2.cc @@ -530,8 +530,10 @@ void ModuleRtpRtcpImpl2::GetSendStreamDataCounters( diff --git a/third_party/libwebrtc/moz-patch-stack/s0042.patch b/third_party/libwebrtc/moz-patch-stack/s0042.patch @@ -69,7 +69,7 @@ index bb8c521514..ec3f6e39d7 100644 std::optional<TimeDelta> AverageRtt() const; std::optional<TimeDelta> LastRtt() const; diff --git a/modules/rtp_rtcp/source/rtp_rtcp_impl2.cc b/modules/rtp_rtcp/source/rtp_rtcp_impl2.cc -index 3949ca3804..80225eb427 100644 +index 72e5645d03..d3f073881b 100644 --- a/modules/rtp_rtcp/source/rtp_rtcp_impl2.cc +++ b/modules/rtp_rtcp/source/rtp_rtcp_impl2.cc @@ -529,11 +529,11 @@ void ModuleRtpRtcpImpl2::GetSendStreamDataCounters( diff --git a/third_party/libwebrtc/moz-patch-stack/s0049.patch b/third_party/libwebrtc/moz-patch-stack/s0049.patch @@ -12,7 +12,7 @@ Subject: Bug 1766646 - (fix-ae0d117d51) ifdef our Csrc impl vs upstream's 5 files changed, 20 insertions(+) diff --git a/modules/rtp_rtcp/source/rtp_header_extensions.cc b/modules/rtp_rtcp/source/rtp_header_extensions.cc -index 39eb769f1c..7936e51945 100644 +index c0e46cc918..b26f0943e0 100644 --- a/modules/rtp_rtcp/source/rtp_header_extensions.cc +++ b/modules/rtp_rtcp/source/rtp_header_extensions.cc @@ -182,6 +182,7 @@ bool AudioLevelExtension::Write(ArrayView<uint8_t> data, @@ -31,7 +31,7 @@ index 39eb769f1c..7936e51945 100644 // From RFC 5450: Transmission Time Offsets in RTP Streams. // -@@ -421,6 +423,7 @@ bool PlayoutDelayLimits::Write(ArrayView<uint8_t> data, +@@ -422,6 +424,7 @@ bool PlayoutDelayLimits::Write(ArrayView<uint8_t> data, return true; } @@ -39,7 +39,7 @@ index 39eb769f1c..7936e51945 100644 // CSRCAudioLevel // Sample Audio Level Encoding Using the One-Byte Header Format // Note that the range of len is 1 to 15 which is encoded as 0 to 14 -@@ -459,6 +462,7 @@ bool CsrcAudioLevel::Write(ArrayView<uint8_t> data, +@@ -460,6 +463,7 @@ bool CsrcAudioLevel::Write(ArrayView<uint8_t> data, // This extension if used must have at least one audio level return csrcAudioLevels.numAudioLevels; } @@ -111,7 +111,7 @@ index 60e582bf29..30d19e16eb 100644 } } diff --git a/modules/rtp_rtcp/source/rtp_sender.cc b/modules/rtp_rtcp/source/rtp_sender.cc -index c7e9a2a594..91e5e239b9 100644 +index 7e2e5eb3e2..fe6a3dc178 100644 --- a/modules/rtp_rtcp/source/rtp_sender.cc +++ b/modules/rtp_rtcp/source/rtp_sender.cc @@ -114,7 +114,9 @@ bool IsNonVolatile(RTPExtensionType type) { diff --git a/third_party/libwebrtc/moz-patch-stack/s0074.patch b/third_party/libwebrtc/moz-patch-stack/s0074.patch @@ -10,7 +10,7 @@ Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/158a888cad8869a2f 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/modules/desktop_capture/linux/wayland/shared_screencast_stream.cc b/modules/desktop_capture/linux/wayland/shared_screencast_stream.cc -index c28fd732df..5eb20ac152 100644 +index 7db86570d0..58e11c1e15 100644 --- a/modules/desktop_capture/linux/wayland/shared_screencast_stream.cc +++ b/modules/desktop_capture/linux/wayland/shared_screencast_stream.cc @@ -57,6 +57,13 @@ @@ -27,7 +27,7 @@ index c28fd732df..5eb20ac152 100644 namespace webrtc { const int kBytesPerPixel = 4; -@@ -298,7 +305,7 @@ void SharedScreenCastStreamPrivate::OnStreamParamChanged( +@@ -302,7 +309,7 @@ void SharedScreenCastStreamPrivate::OnStreamParamChanged( that->modifier_ = has_modifier ? that->spa_video_format_.modifier : DRM_FORMAT_MOD_INVALID; std::vector<const spa_pod*> params; diff --git a/third_party/libwebrtc/moz-patch-stack/s0075.patch b/third_party/libwebrtc/moz-patch-stack/s0075.patch @@ -12,10 +12,10 @@ Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/237d19fe96dd7d25b 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/modules/desktop_capture/linux/wayland/shared_screencast_stream.cc b/modules/desktop_capture/linux/wayland/shared_screencast_stream.cc -index 5eb20ac152..bd21833091 100644 +index 58e11c1e15..61ca561e8d 100644 --- a/modules/desktop_capture/linux/wayland/shared_screencast_stream.cc +++ b/modules/desktop_capture/linux/wayland/shared_screencast_stream.cc -@@ -436,7 +436,9 @@ bool SharedScreenCastStreamPrivate::StartScreenCastStream( +@@ -441,7 +441,9 @@ bool SharedScreenCastStreamPrivate::StartScreenCastStream( RTC_LOG(LS_ERROR) << "Unable to open PipeWire library"; return false; } @@ -26,7 +26,7 @@ index 5eb20ac152..bd21833091 100644 pw_stream_node_id_ = stream_node_id; -@@ -525,7 +527,8 @@ bool SharedScreenCastStreamPrivate::StartScreenCastStream( +@@ -531,7 +533,8 @@ bool SharedScreenCastStreamPrivate::StartScreenCastStream( for (uint32_t format : {SPA_VIDEO_FORMAT_BGRA, SPA_VIDEO_FORMAT_RGBA, SPA_VIDEO_FORMAT_BGRx, SPA_VIDEO_FORMAT_RGBx}) { // Modifiers can be used with PipeWire >= 0.3.33 @@ -36,7 +36,7 @@ index 5eb20ac152..bd21833091 100644 modifiers_ = egl_dmabuf_->QueryDmaBufModifiers(format); if (!modifiers_.empty()) { -@@ -976,7 +979,7 @@ bool SharedScreenCastStreamPrivate::ProcessDMABuffer( +@@ -982,7 +985,7 @@ bool SharedScreenCastStreamPrivate::ProcessDMABuffer( const uint n_planes = spa_buffer->n_datas;